Skip to content

Commit cc903dd

Browse files
ASP.NET Push Botunknown
ASP.NET Push Bot
authored and
unknown
committedOct 1, 2015
⬆️ dnvm.ps1, dnvm.cmd, dnvm.sh
Source: aspnet/dnvm@f0a8ba2
1 parent 36968d5 commit cc903dd

File tree

2 files changed

+65
-53
lines changed

2 files changed

+65
-53
lines changed
 

‎dnvm.ps1

+34-23
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function _WriteOut {
6767

6868
### Constants
6969
$ProductVersion="1.0.0"
70-
$BuildVersion="rc1-15522"
70+
$BuildVersion="rc1-15523"
7171
$Authors="Microsoft Open Technologies, Inc."
7272

7373
# If the Version hasn't been replaced...
@@ -438,13 +438,13 @@ function Get-RuntimeAliasOrRuntimeInfo(
438438
filter List-Parts {
439439
param($aliases, $items)
440440

441-
$location = ""
441+
$location = ""
442442

443-
$binDir = Join-Path $_.FullName "bin"
444-
if ((Test-Path $binDir)) {
443+
$binDir = Join-Path $_.FullName "bin"
444+
if ((Test-Path $binDir)) {
445445
$location = $_.Parent.FullName
446446
}
447-
$active = IsOnPath $binDir
447+
$active = IsOnPath $binDir
448448

449449
$fullAlias=""
450450
$delim=""
@@ -1012,10 +1012,10 @@ filter ColorActive {
10121012

10131013
<#
10141014
.SYNOPSIS
1015-
Displays the DNVM version.
1015+
Displays the DNVM version.
10161016
#>
10171017
function dnvm-version {
1018-
_WriteOut "$FullVersion"
1018+
_WriteOut "$FullVersion"
10191019
}
10201020

10211021
<#
@@ -1044,9 +1044,9 @@ function dnvm-list {
10441044
}
10451045
}
10461046

1047-
$aliases | Where-Object {$_.Orphan} | ForEach-Object {
1048-
$items += $_ | Select-Object @{label='Name';expression={$_.Name}}, @{label='FullName';expression={Join-Path $RuntimesDir $_.Name}} | List-Parts $aliases
1049-
}
1047+
$aliases | Where-Object {$_.Orphan} | ForEach-Object {
1048+
$items += $_ | Select-Object @{label='Name';expression={$_.Name}}, @{label='FullName';expression={Join-Path $RuntimesDir $_.Name}} | List-Parts $aliases
1049+
}
10501050

10511051
if($PassThru) {
10521052
$items
@@ -1106,12 +1106,12 @@ function dnvm-alias {
11061106
[Parameter(Position=1)]
11071107
[string]$Version,
11081108

1109-
[Alias("arch")]
1109+
[Alias("arch", "a")]
11101110
[ValidateSet("", "x86", "x64", "arm")]
11111111
[string]$Architecture = "",
11121112

11131113
[Alias("r")]
1114-
[ValidateSet("", "clr","coreclr", "mono")]
1114+
[ValidateSet("", "clr", "coreclr", "mono")]
11151115
[Parameter(ParameterSetName="Write")]
11161116
[string]$Runtime = "",
11171117

@@ -1174,17 +1174,16 @@ function dnvm-unalias {
11741174
#>
11751175
function dnvm-upgrade {
11761176
param(
1177-
[Alias("a")]
11781177
[Parameter(Mandatory=$false, Position=0)]
11791178
[string]$Alias = "default",
11801179

1181-
[Alias("arch")]
1180+
[Alias("arch", "a")]
11821181
[ValidateSet("", "x86", "x64", "arm")]
11831182
[Parameter(Mandatory=$false)]
11841183
[string]$Architecture = "",
11851184

11861185
[Alias("r")]
1187-
[ValidateSet("", "clr", "coreclr")]
1186+
[ValidateSet("", "clr", "coreclr", "mono")]
11881187
[Parameter(Mandatory=$false)]
11891188
[string]$Runtime = "",
11901189

@@ -1205,9 +1204,11 @@ function dnvm-upgrade {
12051204
[Parameter(Mandatory=$false)]
12061205
[switch]$Ngen,
12071206

1207+
[Alias("u")]
12081208
[Parameter(Mandatory=$false)]
12091209
[switch]$Unstable,
12101210

1211+
[Alias("g")]
12111212
[Parameter(Mandatory=$false)]
12121213
[switch]$Global)
12131214

@@ -1259,21 +1260,20 @@ function dnvm-install {
12591260
[Parameter(Mandatory=$false, Position=0)]
12601261
[string]$VersionNuPkgOrAlias,
12611262

1262-
[Alias("arch")]
1263+
[Alias("arch", "a")]
12631264
[ValidateSet("", "x86", "x64", "arm")]
12641265
[Parameter(Mandatory=$false)]
12651266
[string]$Architecture = "",
12661267

12671268
[Alias("r")]
1268-
[ValidateSet("", "clr","coreclr","mono")]
1269+
[ValidateSet("", "clr", "coreclr", "mono")]
12691270
[Parameter(Mandatory=$false)]
12701271
[string]$Runtime = "",
12711272

12721273
[ValidateSet("", "win", "osx", "darwin", "linux")]
12731274
[Parameter(Mandatory=$false)]
12741275
[string]$OS = "",
12751276

1276-
[Alias("a")]
12771277
[Parameter(Mandatory=$false)]
12781278
[string]$Alias,
12791279

@@ -1290,12 +1290,15 @@ function dnvm-install {
12901290
[Parameter(Mandatory=$false)]
12911291
[switch]$Ngen,
12921292

1293+
[Alias("p")]
12931294
[Parameter(Mandatory=$false)]
12941295
[switch]$Persistent,
12951296

1297+
[Alias("u")]
12961298
[Parameter(Mandatory=$false)]
12971299
[switch]$Unstable,
12981300

1301+
[Alias("g")]
12991302
[Parameter(Mandatory=$false)]
13001303
[switch]$Global)
13011304

@@ -1543,13 +1546,13 @@ function dnvm-uninstall {
15431546
[Parameter(Mandatory=$true, Position=0)]
15441547
[string]$VersionOrAlias,
15451548

1546-
[Alias("arch")]
1549+
[Alias("arch", "a")]
15471550
[ValidateSet("", "x86", "x64", "arm")]
15481551
[Parameter(Mandatory=$false)]
15491552
[string]$Architecture = "",
15501553

15511554
[Alias("r")]
1552-
[ValidateSet("", "clr","coreclr","mono")]
1555+
[ValidateSet("", "clr", "coreclr", "mono")]
15531556
[Parameter(Mandatory=$false)]
15541557
[string]$Runtime = "",
15551558

@@ -1609,7 +1612,7 @@ function dnvm-use {
16091612
[Parameter(Mandatory=$true, Position=0)]
16101613
[string]$VersionOrAlias,
16111614

1612-
[Alias("arch")]
1615+
[Alias("arch", "a")]
16131616
[ValidateSet("", "x86", "x64", "arm")]
16141617
[Parameter(Mandatory=$false)]
16151618
[string]$Architecture = "",
@@ -1663,6 +1666,10 @@ function dnvm-use {
16631666
Locates the dnx.exe for the specified version or alias and executes it, providing the remaining arguments to dnx.exe
16641667
.PARAMETER VersionOrAlias
16651668
The version of alias of the runtime to execute
1669+
.PARAMETER Architecture
1670+
The processor architecture of the runtime to use (default: x86, or whatever the alias specifies in the case of running an alias)
1671+
.PARAMETER Runtime
1672+
The runtime flavor of the runtime to use (default: clr, or whatever the alias specifies in the case of running an alias)
16661673
.PARAMETER DnxArguments
16671674
The arguments to pass to dnx.exe
16681675
#>
@@ -1671,7 +1678,7 @@ function dnvm-run {
16711678
[Parameter(Mandatory=$true, Position=0)]
16721679
[string]$VersionOrAlias,
16731680

1674-
[Alias("arch")]
1681+
[Alias("arch", "a")]
16751682
[ValidateSet("", "x86", "x64", "arm")]
16761683
[Parameter(Mandatory=$false)]
16771684
[string]$Architecture = "",
@@ -1704,6 +1711,10 @@ function dnvm-run {
17041711
Executes the specified command in a sub-shell where the PATH has been augmented to include the specified DNX
17051712
.PARAMETER VersionOrAlias
17061713
The version of alias of the runtime to make active in the sub-shell
1714+
.PARAMETER Architecture
1715+
The processor architecture of the runtime to use (default: x86, or whatever the alias specifies in the case of exec-ing an alias)
1716+
.PARAMETER Runtime
1717+
The runtime flavor of the runtime to use (default: clr, or whatever the alias specifies in the case of exec-ing an alias)
17071718
.PARAMETER Command
17081719
The command to execute in the sub-shell
17091720
#>
@@ -1714,7 +1725,7 @@ function dnvm-exec {
17141725
[Parameter(Mandatory=$false, Position=1)]
17151726
[string]$Command,
17161727

1717-
[Alias("arch")]
1728+
[Alias("arch", "a")]
17181729
[ValidateSet("", "x86", "x64", "arm")]
17191730
[Parameter(Mandatory=$false)]
17201731
[string]$Architecture = "",

‎dnvm.sh

+31-30
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Source this file from your .bash-profile or script to use
33

44
# "Constants"
5-
_DNVM_BUILDNUMBER="rc1-15522"
5+
_DNVM_BUILDNUMBER="rc1-15523"
66
_DNVM_AUTHORS="Microsoft Open Technologies, Inc."
77
_DNVM_RUNTIME_PACKAGE_NAME="dnx"
88
_DNVM_RUNTIME_FRIENDLY_NAME=".NET Execution Environment"
@@ -419,40 +419,41 @@ __dnvm_help() {
419419
echo " install latest $_DNVM_RUNTIME_SHORT_NAME from feed"
420420
echo " adds $_DNVM_RUNTIME_SHORT_NAME bin to path of current command line"
421421
echo " set installed version as default"
422-
echo " -f|forces force upgrade. Overwrite existing version of $_DNVM_RUNTIME_SHORT_NAME if already installed"
423-
echo " -u|unstable use unstable feed. Installs the $_DNVM_RUNTIME_SHORT_NAME from the unstable feed"
424-
echo " -r|runtime The runtime flavor to install [clr or coreclr] (default: clr)"
425-
echo " -g|global Installs the latest $_DNVM_RUNTIME_SHORT_NAME in the configured global $_DNVM_RUNTIME_SHORT_NAME file location (default: /usr/local/lib/dnx current: $DNX_GLOBAL_HOME)"
426-
echo " -y Assume Yes to all queries and do not prompt"
422+
echo " -f|-force force upgrade. Overwrite existing version of $_DNVM_RUNTIME_SHORT_NAME if already installed"
423+
echo " -u|-unstable use unstable feed. Installs the $_DNVM_RUNTIME_SHORT_NAME from the unstable feed"
424+
echo " -r|-runtime <runtime> runtime flavor to install [mono or coreclr] (default: mono)"
425+
echo " -g|-global Installs the latest $_DNVM_RUNTIME_SHORT_NAME in the configured global $_DNVM_RUNTIME_SHORT_NAME file location (default: /usr/local/lib/dnx current: $DNX_GLOBAL_HOME)"
426+
echo " -y Assume Yes to all queries and do not prompt"
427427
echo ""
428-
printf "%b\n" "${Yel}$_DNVM_COMMAND_NAME install <semver>|<alias>|<nupkg>|latest [-r <runtime>] [-OS <OS>] [-a|-alias <alias>] [-p|-persistent] [-f|-force] [-u|-unstable] [-g|-global] [-y]${RCol}"
429-
echo " <semver>|<alias> install requested $_DNVM_RUNTIME_SHORT_NAME from feed"
430-
echo " <nupkg> install requested $_DNVM_RUNTIME_SHORT_NAME from local package on filesystem"
431-
echo " latest install latest version of $_DNVM_RUNTIME_SHORT_NAME from feed"
432-
echo " -OS the operating system that the runtime targets (default:$(__dnvm_current_os)"
433-
echo " -a|-alias <alias> set alias <alias> for requested $_DNVM_RUNTIME_SHORT_NAME on install"
434-
echo " -p|-persistent set installed version as default"
435-
echo " -f|force force install. Overwrite existing version of $_DNVM_RUNTIME_SHORT_NAME if already installed"
436-
echo " -u|unstable use unstable feed. Installs the $_DNVM_RUNTIME_SHORT_NAME from the unstable feed"
437-
echo " -r|runtime The runtime flavor to install [mono or coreclr] (default: mono)"
438-
echo " -g|global Installs to the configured global $_DNVM_RUNTIME_SHORT_NAME file location (default: /usr/local/lib/dnx current: $DNX_GLOBAL_HOME)"
439-
echo " -y Assume Yes to all queries and do not prompt"
428+
printf "%b\n" "${Yel}$_DNVM_COMMAND_NAME install <semver>|<alias>|<nupkg>|latest [-r <runtime>] [-OS <OS>] [-alias <alias>] [-a|-arch <architecture>] [-p|-persistent] [-f|-force] [-u|-unstable] [-g|-global] [-y]${RCol}"
429+
echo " <semver>|<alias> install requested $_DNVM_RUNTIME_SHORT_NAME from feed"
430+
echo " <nupkg> install requested $_DNVM_RUNTIME_SHORT_NAME from local package on filesystem"
431+
echo " latest install latest version of $_DNVM_RUNTIME_SHORT_NAME from feed"
432+
echo " -OS <operating system> the operating system that the runtime targets (default:$(__dnvm_current_os))"
433+
echo " -alias <alias> set alias <alias> for requested $_DNVM_RUNTIME_SHORT_NAME on install"
434+
echo " -a|-arch <architecture> architecture to use (x64)"
435+
echo " -p|-persistent set installed version as default"
436+
echo " -f|-force force install. Overwrite existing version of $_DNVM_RUNTIME_SHORT_NAME if already installed"
437+
echo " -u|-unstable use unstable feed. Installs the $_DNVM_RUNTIME_SHORT_NAME from the unstable feed"
438+
echo " -r|-runtime <runtime> runtime flavor to install [mono or coreclr] (default: mono)"
439+
echo " -g|-global Installs to the configured global $_DNVM_RUNTIME_SHORT_NAME file location (default: /usr/local/lib/dnx current: $DNX_GLOBAL_HOME)"
440+
echo " -y Assume Yes to all queries and do not prompt"
440441
echo ""
441442
echo " adds $_DNVM_RUNTIME_SHORT_NAME bin to path of current command line"
442443
echo ""
443444
printf "%b\n" "${Yel}$_DNVM_COMMAND_NAME uninstall <semver> [-r|-runtime <runtime>] [-a|-arch <architecture>] [-OS <OS>]${RCol}"
444-
echo " <semver> the version to uninstall"
445-
echo " -r|-runtime runtime to use (mono, coreclr)"
446-
echo " -a|-arch architecture to use (x64)"
447-
echo " -OS the operating system that the runtime targets (default:$(__dnvm_current_os)"
448-
echo " -y Assume Yes to all queries and do not prompt"
445+
echo " <semver> the version to uninstall"
446+
echo " -r|-runtime <runtime> runtime flavor to uninstall [mono or coreclr] (default: mono)"
447+
echo " -a|-arch <architecture> architecture to use (x64)"
448+
echo " -OS <operating system> the operating system that the runtime targets (default:$(__dnvm_current_os))"
449+
echo " -y Assume Yes to all queries and do not prompt"
449450
echo ""
450451
printf "%b\n" "${Yel}$_DNVM_COMMAND_NAME use <semver>|<alias>|<package>|none [-p|-persistent] [-r|-runtime <runtime>] [-a|-arch <architecture>] ${RCol}"
451452
echo " <semver>|<alias>|<package> add $_DNVM_RUNTIME_SHORT_NAME bin to path of current command line "
452453
echo " none remove $_DNVM_RUNTIME_SHORT_NAME bin from path of current command line"
453454
echo " -p|-persistent set selected version as default"
454-
echo " -r|-runtime runtime to use (mono, coreclr)"
455-
echo " -a|-arch architecture to use (x64)"
455+
echo " -r|-runtime <runtime> runtime flavor to use [mono or coreclr] (default: mono)"
456+
echo " -a|-arch <architecture> architecture to use (x64)"
456457
echo ""
457458
printf "%b\n" "${Yel}$_DNVM_COMMAND_NAME run <semver>|<alias> <args...> ${RCol}"
458459
echo " <semver>|<alias> the version or alias to run"
@@ -480,8 +481,8 @@ __dnvm_help() {
480481
echo " display value of the specified alias"
481482
echo ""
482483
printf "%b\n" "${Yel}$_DNVM_COMMAND_NAME alias <alias> <semver>|<alias>|<package> ${RCol}"
483-
echo " <alias> the name of the alias to set"
484-
echo " <semver>|<alias>|<package> the $_DNVM_RUNTIME_SHORT_NAME version to set the alias to. Alternatively use the version of the specified alias"
484+
echo " <alias> the name of the alias to set"
485+
echo " <semver>|<alias>|<package> the $_DNVM_RUNTIME_SHORT_NAME version to set the alias to. Alternatively use the version of the specified alias"
485486
echo ""
486487
printf "%b\n" "${Yel}$_DNVM_COMMAND_NAME alias [-d|-delete] <alias> ${RCol}"
487488
echo " remove the specified alias"
@@ -541,7 +542,7 @@ dnvm()
541542
do
542543
if [[ $1 == "-p" || $1 == "-persistent" ]]; then
543544
local persistent="-p"
544-
elif [[ $1 == "-a" || $1 == "-alias" ]]; then
545+
elif [[ $1 == "-alias" ]]; then
545546
local alias=$2
546547
shift
547548
elif [[ $1 == "-f" || $1 == "-force" ]]; then
@@ -554,9 +555,9 @@ dnvm()
554555
elif [[ $1 == "-OS" ]]; then
555556
local os=$2
556557
shift
557-
elif [[ $1 == "-y" ]]; then
558+
elif [[ $1 == "-y" ]]; then
558559
local acceptSudo=1
559-
elif [[ $1 == "-arch" ]]; then
560+
elif [[ $1 == "-a" || $1 == "-arch" ]]; then
560561
local arch=$2
561562
shift
562563

0 commit comments

Comments
 (0)
Please sign in to comment.