Use PowerShell parameter validation
This commit is contained in:
Родитель
a0722c4b7e
Коммит
4032dd9fa5
|
@ -1,7 +1,7 @@
|
|||
if ($args.Length -eq 0 -or ![bool]$args[0]) {
|
||||
Write-Error "Please supply one or more arguments. Valid values are all, wasm, uwp, winappsdk, wpf, gtk, macos, ios, and droid.";
|
||||
exit(-1);
|
||||
}
|
||||
Param (
|
||||
[ValidateSet('all', 'wasm', 'uwp', 'winappsdk', 'wpf', 'gtk', 'macos', 'ios', 'droid')]
|
||||
[string[]]$targets
|
||||
)
|
||||
|
||||
if ($args.Contains("--allow-git-changes")) {
|
||||
Write-Warning "Changes to the default TargetFrameworks in Labs can now be committed. Run this command again without the --allow-git-changes flag to disable committing further changes.";
|
||||
|
@ -35,39 +35,39 @@ $allTargetFrameworks = @(
|
|||
|
||||
$desiredTfmValues = @();
|
||||
|
||||
if ($args.Contains("all")) {
|
||||
if ($targets.Contains("all")) {
|
||||
$desiredTfmValues = $allTargetFrameworks;
|
||||
}
|
||||
|
||||
if ($args.Contains("wasm")) {
|
||||
if ($targets.Contains("wasm")) {
|
||||
$desiredTfmValues += $WasmTfm;
|
||||
}
|
||||
|
||||
if ($args.Contains("uwp")) {
|
||||
if ($targets.Contains("uwp")) {
|
||||
$desiredTfmValues += $UwpTfm;
|
||||
}
|
||||
|
||||
if ($args.Contains("winappsdk")) {
|
||||
if ($targets.Contains("winappsdk")) {
|
||||
$desiredTfmValues += $WinAppSdkTfm;
|
||||
}
|
||||
|
||||
if ($args.Contains("wpf")) {
|
||||
if ($targets.Contains("wpf")) {
|
||||
$desiredTfmValues += $WpfTfm;
|
||||
}
|
||||
|
||||
if ($args.Contains("gtk")) {
|
||||
if ($targets.Contains("gtk")) {
|
||||
$desiredTfmValues += $GtkTfm;
|
||||
}
|
||||
|
||||
if ($args.Contains("macos")) {
|
||||
if ($targets.Contains("macos")) {
|
||||
$desiredTfmValues += $macOSTfm;
|
||||
}
|
||||
|
||||
if ($args.Contains("ios")) {
|
||||
if ($targets.Contains("ios")) {
|
||||
$desiredTfmValues += $iOSTfm;
|
||||
}
|
||||
|
||||
if ($args.Contains("droid")) {
|
||||
if ($targets.Contains("droid")) {
|
||||
$desiredTfmValues += $DroidTfm;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче