Updating the home repo with the latest KVM scripts
This commit is contained in:
parent
fcc3ae5e03
commit
07424caead
|
|
@ -85,7 +85,7 @@ The samples in this repo are basic starting points for you to experiment with.
|
|||
|
||||
By default when running ASP.NET vNext applications on the Windows platform you are running on the full .NET Framework. You can switch to use the new Cloud Optimized runtime, or Core CLR, using the KVM command.
|
||||
|
||||
1. Run ```kvm upgrade -svrc50``` This command gets the latest Core CLR version of the k runtime and sets it as your default. The -svrc50 switch tells it to use Core CLR. You can use -svr50 to target desktop again.
|
||||
1. Run ```kvm upgrade -runtime CoreCLR``` This command gets the latest Core CLR version of the k runtime and sets it as your default. The `-runtime CoreCLR` switch tells it to use Core CLR. You can use `-r CLR` to target desktop again.
|
||||
2. Run ```k web``` to run on WebListener.
|
||||
3. The first line of your output should say "Loaded Module: klr.core45.dll" instead of "Loaded Module: klr.net45.dll"
|
||||
4. The HelloWeb app should work the same as when running on the full desktop .NET Framework but now as a fully self-contained app with true side-by-side versioning support.
|
||||
|
|
|
|||
266
kvm.ps1
266
kvm.ps1
|
|
@ -6,16 +6,26 @@ param(
|
|||
[alias("g")][switch] $global = $false,
|
||||
[alias("p")][switch] $persistent = $false,
|
||||
[alias("f")][switch] $force = $false,
|
||||
[alias("r")][string] $runtime,
|
||||
[switch] $x86 = $false,
|
||||
[switch] $amd64 = $false,
|
||||
#deprecated
|
||||
[switch] $x64 = $false,
|
||||
#deprecated
|
||||
[switch] $svr50 = $false,
|
||||
#deprecated
|
||||
[switch] $svrc50 = $false,
|
||||
[alias("w")][switch] $wait = $false,
|
||||
[alias("a")]
|
||||
[string] $alias = $null,
|
||||
[parameter(Position=1, ValueFromRemainingArguments=$true)]
|
||||
[string[]]$args=@()
|
||||
)
|
||||
|
||||
$selectedArch=$null;
|
||||
$defaultArch="x86"
|
||||
$selectedRuntime=$null
|
||||
$defaultRuntime="CLR"
|
||||
$userKrePath = $env:USERPROFILE + "\.kre"
|
||||
$userKrePackages = $userKrePath + "\packages"
|
||||
$globalKrePath = $env:ProgramFiles + "\KRE"
|
||||
|
|
@ -35,11 +45,11 @@ $scriptPath = $myInvocation.MyCommand.Definition
|
|||
|
||||
function Kvm-Help {
|
||||
@"
|
||||
K Runtime Environment Version Manager - Build 10010
|
||||
K Runtime Environment Version Manager - Build 10015
|
||||
|
||||
USAGE: kvm <command> [options]
|
||||
|
||||
kvm upgrade [-x86][-x64] [-svr50][-svrc50] [-g|-global] [-proxy <ADDRESS>]
|
||||
kvm upgrade [-x86][-amd64] [-r|-runtime CLR|CoreCLR] [-g|-global] [-f|-force] [-proxy <ADDRESS>]
|
||||
install latest KRE from feed
|
||||
set 'default' alias to installed version
|
||||
add KRE bin to user PATH environment variable
|
||||
|
|
@ -47,7 +57,7 @@ kvm upgrade [-x86][-x64] [-svr50][-svrc50] [-g|-global] [-proxy <ADDRESS>]
|
|||
-f|-force upgrade even if latest is already installed
|
||||
-proxy <ADDRESS> use given address as proxy when accessing remote server
|
||||
|
||||
kvm install <semver>|<alias>|<nupkg>|latest [-x86][-x64] [-svr50][-svrc50] [-a|-alias <alias>] [-g|-global] [-f|-force]
|
||||
kvm install <semver>|<alias>|<nupkg>|latest [-x86][-amd64] [-r|-runtime CLR|CoreCLR] [-a|-alias <alias>] [-g|-global] [-f|-force]
|
||||
<semver>|<alias> install requested KRE from feed
|
||||
<nupkg> install requested KRE from package on local filesystem
|
||||
latest install latest KRE from feed
|
||||
|
|
@ -57,7 +67,7 @@ kvm install <semver>|<alias>|<nupkg>|latest [-x86][-x64] [-svr50][-svrc50] [-a|-
|
|||
-g|-global install to machine-wide location
|
||||
-f|-force install even if specified version is already installed
|
||||
|
||||
kvm use <semver>|<alias>|none [-x86][-x64] [-svr50][-svrc50] [-p|-persistent] [-g|-global]
|
||||
kvm use <semver>|<alias>|none [-x86][-amd64] [-r|-runtime CLR|CoreCLR] [-p|-persistent] [-g|-global]
|
||||
<semver>|<alias> add KRE bin to path of current command line
|
||||
none remove KRE bin from path of current command line
|
||||
-p|-persistent add KRE bin to PATH environment variables persistently
|
||||
|
|
@ -72,7 +82,7 @@ kvm alias
|
|||
kvm alias <alias>
|
||||
display value of the specified alias
|
||||
|
||||
kvm alias <alias> <semver>|<alias> [-x86][-x64] [-svr50][-svrc50]
|
||||
kvm alias <alias> <semver>|<alias> [-x86][-amd64] [-r|-runtime CLR|CoreCLR]
|
||||
<alias> The name of the alias to set
|
||||
<semver>|<alias> The KRE version to set the alias to. Alternatively use the version of the specified alias
|
||||
|
||||
|
|
@ -83,19 +93,25 @@ kvm unalias <alias>
|
|||
}
|
||||
|
||||
function Kvm-Global-Setup {
|
||||
$kvmBinPath = "$userKrePath\bin"
|
||||
|
||||
If (Needs-Elevation)
|
||||
{
|
||||
$arguments = "& '$scriptPath' setup $(Requested-Switches) -persistent"
|
||||
$arguments = "-ExecutionPolicy unrestricted & '$scriptPath' setup -global -wait"
|
||||
Start-Process "$psHome\powershell.exe" -Verb runAs -ArgumentList $arguments -Wait
|
||||
Write-Host "Adding $kvmBinPath to process PATH"
|
||||
Set-Path (Change-Path $env:Path $kvmBinPath ($kvmBinPath))
|
||||
Write-Host "Adding $globalKrePath;%USERPROFILE%\.kre to process KRE_HOME"
|
||||
$envKreHome = $env:KRE_HOME
|
||||
$envKreHome = Change-Path $envKreHome "%USERPROFILE%\.kre" ("%USERPROFILE%\.kre")
|
||||
$envKreHome = Change-Path $envKreHome $globalKrePath ($globalKrePath)
|
||||
$env:KRE_HOME = $envKreHome
|
||||
Write-Host "Setup complete"
|
||||
Kvm-Help
|
||||
break
|
||||
}
|
||||
|
||||
$scriptFolder = [System.IO.Path]::GetDirectoryName($scriptPath)
|
||||
|
||||
$kvmBinPath = "$userKrePath\bin"
|
||||
|
||||
Write-Host "Copying file $kvmBinPath\kvm.ps1"
|
||||
md $kvmBinPath -Force | Out-Null
|
||||
copy "$scriptFolder\kvm.ps1" "$kvmBinPath\kvm.ps1"
|
||||
|
|
@ -122,26 +138,25 @@ function Kvm-Global-Setup {
|
|||
$machineKreHome = Change-Path $machineKreHome "%USERPROFILE%\.kre" ("%USERPROFILE%\.kre")
|
||||
$machineKreHome = Change-Path $machineKreHome $globalKrePath ($globalKrePath)
|
||||
[Environment]::SetEnvironmentVariable("KRE_HOME", $machineKreHome, [System.EnvironmentVariableTarget]::Machine)
|
||||
|
||||
Write-Host "Press any key to continue ..."
|
||||
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown,AllowCtrlC")
|
||||
}
|
||||
|
||||
function Kvm-Global-Upgrade {
|
||||
$persistent = $true
|
||||
$alias="default"
|
||||
$versionOrAlias = Kvm-Find-Latest $selectedRuntime $selectedArch
|
||||
If (Needs-Elevation) {
|
||||
$arguments = "& '$scriptPath' upgrade -global $(Requested-Switches)"
|
||||
$arguments = "-ExecutionPolicy unrestricted & '$scriptPath' install '$versionOrAlias' -global $(Requested-Switches) -wait"
|
||||
Start-Process "$psHome\powershell.exe" -Verb runAs -ArgumentList $arguments -Wait
|
||||
Kvm-Set-Global-Process-Path $versionOrAlias
|
||||
break
|
||||
}
|
||||
Kvm-Global-Install "latest"
|
||||
Kvm-Install $versionOrAlias $true
|
||||
}
|
||||
|
||||
function Kvm-Upgrade {
|
||||
$persistent = $true
|
||||
$alias="default"
|
||||
Kvm-Install "latest"
|
||||
Kvm-Install "latest" $false
|
||||
}
|
||||
|
||||
function Add-Proxy-If-Specified {
|
||||
|
|
@ -179,6 +194,10 @@ param(
|
|||
|
||||
$version = Select-Xml "//d:Version" -Namespace @{d='http://schemas.microsoft.com/ado/2007/08/dataservices'} $xml
|
||||
|
||||
if (String-IsEmptyOrWhitespace($version)) {
|
||||
throw "There are no packages for platform '$platform', architecture '$architecture' in the feed '$feed'"
|
||||
}
|
||||
|
||||
return $version
|
||||
}
|
||||
|
||||
|
|
@ -260,49 +279,49 @@ param(
|
|||
}
|
||||
}
|
||||
|
||||
function Kvm-Global-Install {
|
||||
param(
|
||||
[string] $versionOrAlias
|
||||
)
|
||||
If (Needs-Elevation) {
|
||||
$arguments = "& '$scriptPath' install -global $versionOrAlias $(Requested-Switches)"
|
||||
Start-Process "$psHome\powershell.exe" -Verb runAs -ArgumentList $arguments -Wait
|
||||
Kvm-Global-Use $versionOrAlias
|
||||
break
|
||||
}
|
||||
|
||||
if ($versionOrAlias -eq "latest") {
|
||||
$versionOrAlias = Kvm-Find-Latest (Requested-Platform "svr50") (Requested-Architecture "x86")
|
||||
}
|
||||
|
||||
$kreFullName = Requested-VersionOrAlias $versionOrAlias
|
||||
|
||||
Do-Kvm-Download $kreFullName $globalKrePackages
|
||||
Kvm-Use $versionOrAlias
|
||||
if (!$(String-IsEmptyOrWhitespace($alias))) {
|
||||
Kvm-Alias-Set $alias $versionOrAlias
|
||||
}
|
||||
}
|
||||
|
||||
function Kvm-Install {
|
||||
param(
|
||||
[string] $versionOrAlias
|
||||
[string] $versionOrAlias,
|
||||
[boolean] $isGlobal
|
||||
)
|
||||
if ($versionOrAlias.EndsWith(".nupkg"))
|
||||
{
|
||||
if ($versionOrAlias -eq "latest") {
|
||||
$versionOrAlias = Kvm-Find-Latest (Requested-Platform $defaultRuntime) (Requested-Architecture $defaultArch)
|
||||
}
|
||||
|
||||
if ($versionOrAlias.EndsWith(".nupkg")) {
|
||||
$kreFullName = [System.IO.Path]::GetFileNameWithoutExtension($versionOrAlias)
|
||||
$kreFolder = "$userKrePackages\$kreFullName"
|
||||
} else {
|
||||
$kreFullName = Requested-VersionOrAlias $versionOrAlias
|
||||
}
|
||||
|
||||
if ($isGlobal) {
|
||||
if (Needs-Elevation) {
|
||||
$arguments = "-ExecutionPolicy unrestricted & '$scriptPath' install '$versionOrAlias' -global $(Requested-Switches) -wait"
|
||||
Start-Process "$psHome\powershell.exe" -Verb runAs -ArgumentList $arguments -Wait
|
||||
Kvm-Set-Global-Process-Path $versionOrAlias
|
||||
break
|
||||
}
|
||||
$packageFolder = $globalKrePackages
|
||||
} else {
|
||||
$packageFolder = $userKrePackages
|
||||
}
|
||||
|
||||
if ($versionOrAlias.EndsWith(".nupkg")) {
|
||||
Set-Variable -Name "selectedArch" -Value (Package-Arch $kreFullName) -Scope Script
|
||||
Set-Variable -Name "selectedRuntime" -Value (Package-Platform $kreFullName) -Scope Script
|
||||
|
||||
$kreFolder = "$packageFolder\$kreFullName"
|
||||
$folderExists = Test-Path $kreFolder
|
||||
|
||||
if($folderExists -and $force) {
|
||||
if ($folderExists -and $force) {
|
||||
del $kreFolder -Recurse -Force
|
||||
$folderExists = $false;
|
||||
}
|
||||
|
||||
if($folderExists) {
|
||||
if ($folderExists) {
|
||||
Write-Host "Target folder '$kreFolder' already exists"
|
||||
} else {
|
||||
$tempUnpackFolder = Join-Path $userKrePackages "temp"
|
||||
$tempUnpackFolder = Join-Path $packageFolder "temp"
|
||||
$tempKreFile = Join-Path $tempUnpackFolder "$kreFullName.nupkg"
|
||||
|
||||
if(Test-Path $tempUnpackFolder) {
|
||||
|
|
@ -320,6 +339,7 @@ param(
|
|||
}
|
||||
|
||||
$packageVersion = Package-Version $kreFullName
|
||||
|
||||
Kvm-Use $packageVersion
|
||||
if (!$(String-IsEmptyOrWhitespace($alias))) {
|
||||
Kvm-Alias-Set $alias $packageVersion
|
||||
|
|
@ -327,15 +347,10 @@ param(
|
|||
}
|
||||
else
|
||||
{
|
||||
if ($versionOrAlias -eq "latest") {
|
||||
$versionOrAlias = Kvm-Find-Latest (Requested-Platform "svr50") (Requested-Architecture "x86")
|
||||
}
|
||||
$kreFullName = Requested-VersionOrAlias $versionOrAlias
|
||||
|
||||
Do-Kvm-Download $kreFullName $userKrePackages
|
||||
Do-Kvm-Download $kreFullName $packageFolder
|
||||
Kvm-Use $versionOrAlias
|
||||
if (!$(String-IsEmptyOrWhitespace($alias))) {
|
||||
Kvm-Alias-Set $alias $versionOrAlias
|
||||
Kvm-Alias-Set "$alias" $versionOrAlias
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -401,18 +416,15 @@ param(
|
|||
[string] $versionOrAlias
|
||||
)
|
||||
If (Needs-Elevation) {
|
||||
$arguments = "& '$scriptPath' use -global $versionOrAlias $(Requested-Switches)"
|
||||
if ($persistent) {
|
||||
$arguments = $arguments + " -persistent"
|
||||
}
|
||||
$arguments = "-ExecutionPolicy unrestricted & '$scriptPath' use '$versionOrAlias' -global $(Requested-Switches) -wait"
|
||||
Start-Process "$psHome\powershell.exe" -Verb runAs -ArgumentList $arguments -Wait
|
||||
Kvm-Set-Global-Process-Path $versionOrAlias
|
||||
break
|
||||
}
|
||||
|
||||
if ($versionOrAlias -eq "none") {
|
||||
Write-Host "Removing KRE from process PATH"
|
||||
Set-Path (Change-Path $env:Path "" ($globalKrePackages, $userKrePackages))
|
||||
Kvm-Set-Global-Process-Path "$versionOrAlias"
|
||||
|
||||
if ($versionOrAlias -eq "none") {
|
||||
if ($persistent) {
|
||||
Write-Host "Removing KRE from machine PATH"
|
||||
$machinePath = [Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine)
|
||||
|
|
@ -422,8 +434,32 @@ param(
|
|||
return;
|
||||
}
|
||||
|
||||
$kreFullName = Requested-VersionOrAlias $versionOrAlias
|
||||
$kreFullName = Requested-VersionOrAlias "$versionOrAlias"
|
||||
$kreBin = Locate-KreBinFromFullName $kreFullName
|
||||
if ($kreBin -eq $null) {
|
||||
Write-Host "Cannot find $kreFullName, do you need to run 'kvm install $versionOrAlias'?"
|
||||
return
|
||||
}
|
||||
|
||||
if ($persistent) {
|
||||
Write-Host "Adding $kreBin to machine PATH"
|
||||
$machinePath = [Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine)
|
||||
$machinePath = Change-Path $machinePath $kreBin ($globalKrePackages, $userKrePackages)
|
||||
[Environment]::SetEnvironmentVariable("Path", $machinePath, [System.EnvironmentVariableTarget]::Machine)
|
||||
}
|
||||
}
|
||||
|
||||
function Kvm-Set-Global-Process-Path {
|
||||
param(
|
||||
[string] $versionOrAlias
|
||||
)
|
||||
if ($versionOrAlias -eq "none") {
|
||||
Write-Host "Removing KRE from process PATH"
|
||||
Set-Path (Change-Path $env:Path "" ($globalKrePackages, $userKrePackages))
|
||||
return
|
||||
}
|
||||
|
||||
$kreFullName = Requested-VersionOrAlias $versionOrAlias
|
||||
$kreBin = Locate-KreBinFromFullName $kreFullName
|
||||
if ($kreBin -eq $null) {
|
||||
Write-Host "Cannot find $kreFullName, do you need to run 'kvm install $versionOrAlias'?"
|
||||
|
|
@ -432,13 +468,6 @@ param(
|
|||
|
||||
Write-Host "Adding" $kreBin "to process PATH"
|
||||
Set-Path (Change-Path $env:Path $kreBin ($globalKrePackages, $userKrePackages))
|
||||
|
||||
if ($persistent) {
|
||||
Write-Host "Adding $kreBin to machine PATH"
|
||||
$machinePath = [Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine)
|
||||
$machinePath = Change-Path $machinePath $kreBin ($globalKrePackages, $userKrePackages)
|
||||
[Environment]::SetEnvironmentVariable("Path", $machinePath, [System.EnvironmentVariableTarget]::Machine)
|
||||
}
|
||||
}
|
||||
|
||||
function Kvm-Use {
|
||||
|
|
@ -547,6 +576,21 @@ param(
|
|||
return $kreFullName -replace '[^.]*.(.*)', '$1'
|
||||
}
|
||||
|
||||
function Package-Platform() {
|
||||
param(
|
||||
[string] $kreFullName
|
||||
)
|
||||
return $kreFullName -replace 'KRE-([^-]*).*', '$1'
|
||||
}
|
||||
|
||||
function Package-Arch() {
|
||||
param(
|
||||
[string] $kreFullName
|
||||
)
|
||||
return $kreFullName -replace 'KRE-[^-]*-([^.]*).*', '$1'
|
||||
}
|
||||
|
||||
|
||||
function Requested-VersionOrAlias() {
|
||||
param(
|
||||
[string] $versionOrAlias
|
||||
|
|
@ -560,8 +604,8 @@ param(
|
|||
$pkgArchitecture = Requested-Architecture $parts[2]
|
||||
} else {
|
||||
$pkgVersion = $versionOrAlias
|
||||
$pkgPlatform = Requested-Platform "svr50"
|
||||
$pkgArchitecture = Requested-Architecture "x86"
|
||||
$pkgPlatform = Requested-Platform $defaultRuntime
|
||||
$pkgArchitecture = Requested-Architecture $defaultArch
|
||||
}
|
||||
return "KRE-" + $pkgPlatform + "-" + $pkgArchitecture + "." + $pkgVersion
|
||||
}
|
||||
|
|
@ -570,15 +614,7 @@ function Requested-Platform() {
|
|||
param(
|
||||
[string] $default
|
||||
)
|
||||
if ($svr50 -and $svrc50) {
|
||||
Throw "This command cannot accept both -svr50 and -svrc50"
|
||||
}
|
||||
if ($svr50) {
|
||||
return "svr50"
|
||||
}
|
||||
if ($svrc50) {
|
||||
return "svrc50"
|
||||
}
|
||||
if (!(String-IsEmptyOrWhitespace($selectedRuntime))) {return $selectedRuntime}
|
||||
return $default
|
||||
}
|
||||
|
||||
|
|
@ -586,15 +622,7 @@ function Requested-Architecture() {
|
|||
param(
|
||||
[string] $default
|
||||
)
|
||||
if ($x86 -and $x64) {
|
||||
Throw "This command cannot accept both -x86 and -x64"
|
||||
}
|
||||
if ($x86) {
|
||||
return "x86"
|
||||
}
|
||||
if ($x64) {
|
||||
return "x64"
|
||||
}
|
||||
if (!(String-IsEmptyOrWhitespace($selectedArch))) {return $selectedArch}
|
||||
return $default
|
||||
}
|
||||
|
||||
|
|
@ -639,27 +667,62 @@ function Needs-Elevation() {
|
|||
function Requested-Switches() {
|
||||
$arguments = ""
|
||||
if ($x86) {$arguments = "$arguments -x86"}
|
||||
if ($amd64) {$arguments = "$arguments -amd64"}
|
||||
#deprecated
|
||||
if ($x64) {$arguments = "$arguments -x64"}
|
||||
if ($svr50) {$arguments = "$arguments -svr50"}
|
||||
if ($svrc50) {$arguments = "$arguments -svrc50"}
|
||||
if ($selectedRuntime) {$arguments = "$arguments -runtime $selectedRuntime"}
|
||||
if ($persistent) {$arguments = "$arguments -persistent"}
|
||||
if ($force) {$arguments = "$arguments -force"}
|
||||
if (!$(String-IsEmptyOrWhitespace($alias))) {$arguments = "$arguments -alias '$alias'"}
|
||||
return $arguments
|
||||
}
|
||||
|
||||
try {
|
||||
function Validate-And-Santitise-Switches()
|
||||
{
|
||||
if ($svr50 -and $runtime) {throw "You cannot select both the -runtime switch and the -svr50 runtimes"}
|
||||
if ($svrc50 -and $runtime) {throw "You cannot select both the -runtime switch and the -svrc50 runtimes"}
|
||||
if ($x86 -and $amd64) {throw "You cannot select both x86 and amd64 architectures"}
|
||||
if ($x86 -and $x64) {throw "You cannot select both x86 and x64 architectures"}
|
||||
if ($x64 -and $amd64) {throw "You cannot select both x64 and amd64 architectures"}
|
||||
|
||||
if ($runtime) {
|
||||
$validRuntimes = "CoreCLR", "CLR", "svr50", "svrc50"
|
||||
$match = $validRuntimes | ? { $_ -like $runtime } | Select -First 1
|
||||
if (!$match) {throw "'$runtime' is not a valid runtime"}
|
||||
Set-Variable -Name "selectedRuntime" -Value $match -Scope Script
|
||||
} elseif ($svr50) {
|
||||
Write-Host "Warning: -svr50 is deprecated, use -runtime CLR for new packages."
|
||||
Set-Variable -Name "selectedRuntime" -Value "svr50" -Scope Script
|
||||
} elseif ($svrc50) {
|
||||
Write-Host "Warning: -svrc50 is deprecated, use -runtime CoreCLR for new packages."
|
||||
Set-Variable -Name "selectedRuntime" -Value "svrc50" -Scope Script
|
||||
}
|
||||
|
||||
if ($x64) {
|
||||
Write-Host "Warning: -x64 is deprecated, use -amd64 for new packages."
|
||||
Set-Variable -Name "selectedArch" -Value "x64" -Scope Script
|
||||
} elseif ($amd64) {
|
||||
Set-Variable -Name "selectedArch" -Value "amd64" -Scope Script
|
||||
} elseif ($x86) {
|
||||
Set-Variable -Name "selectedArch" -Value "x86" -Scope Script
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Validate-And-Santitise-Switches
|
||||
if ($global) {
|
||||
switch -wildcard ($command + " " + $args.Count) {
|
||||
"setup 0" {Kvm-Global-Setup}
|
||||
"upgrade 0" {Kvm-Global-Upgrade}
|
||||
"install 1" {Kvm-Global-Install $args[0]}
|
||||
# "list 0" {Kvm-Global-List}
|
||||
"install 1" {Kvm-Install $args[0] $true}
|
||||
"use 1" {Kvm-Global-Use $args[0]}
|
||||
default {Write-Host 'Unknown command, or global switch not supported'; Kvm-Help;}
|
||||
default {throw "Unknown command, or global switch not supported"};
|
||||
}
|
||||
} else {
|
||||
switch -wildcard ($command + " " + $args.Count) {
|
||||
"setup 0" {Kvm-Global-Setup}
|
||||
"upgrade 0" {Kvm-Upgrade}
|
||||
"install 1" {Kvm-Install $args[0]}
|
||||
"install 1" {Kvm-Install $args[0] $false}
|
||||
"list 0" {Kvm-List}
|
||||
"use 1" {Kvm-Use $args[0]}
|
||||
"alias 0" {Kvm-Alias-List}
|
||||
|
|
@ -668,10 +731,15 @@ function Requested-Switches() {
|
|||
"unalias 1" {Kvm-Unalias $args[0]}
|
||||
"help 0" {Kvm-Help}
|
||||
" 0" {Kvm-Help}
|
||||
default {Write-Host 'Unknown command'; Kvm-Help;}
|
||||
default {throw "Unknown command"};
|
||||
}
|
||||
}
|
||||
}
|
||||
catch {
|
||||
}
|
||||
catch {
|
||||
Write-Host $_ -ForegroundColor Red ;
|
||||
}
|
||||
Write-Host "Type 'kvm help' for help on how to use kvm."
|
||||
}
|
||||
if ($wait) {
|
||||
Write-Host "Press any key to continue ..."
|
||||
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown,AllowCtrlC")
|
||||
}
|
||||
|
|
|
|||
4
kvm.sh
4
kvm.sh
|
|
@ -18,7 +18,7 @@ KRE_MONO45=
|
|||
KRE_X86=
|
||||
KRE_X64=
|
||||
if [ -z "$KRE_FEED" ]; then
|
||||
KRE_FEED="https://www.myget.org/F/aspnextvnext/api/v2"
|
||||
KRE_FEED="https://www.myget.org/F/aspnetvnext/api/v2"
|
||||
fi
|
||||
|
||||
_kvm_find_latest() {
|
||||
|
|
@ -169,7 +169,7 @@ kvm()
|
|||
case $1 in
|
||||
"help" )
|
||||
echo ""
|
||||
echo "K Runtime Environment Version Manager - Build 10010"
|
||||
echo "K Runtime Environment Version Manager - Build 10015"
|
||||
echo ""
|
||||
echo "USAGE: kvm <command> [options]"
|
||||
echo ""
|
||||
|
|
|
|||
Loading…
Reference in New Issue