Add silent switches prompt to YamlCreate.ps1 (#1159)

* Add silent switches prompt

Added prompts for optional silent switches

* Added $InstallerType logic for silent switches

Only prompt for silent switches if $InstallerType is "exe"
This commit is contained in:
Richard
2020-06-30 12:38:31 -04:00
committed by GitHub
parent e53f3e8960
commit 4ee595af9d

View File

@@ -91,6 +91,11 @@ do {
$Description = Read-Host -Prompt '[OPTIONAL] Enter a description of the application'
} while ($Description.length -gt 500)
# Only prompt for silent switches if $InstallerType is "exe"
if ($InstallerType.ToLower() -eq "exe") {
$Silent = Read-Host -Prompt '[OPTIONAL] Enter the silent install switch'
$SilentWithProgress = Read-Host -Prompt '[OPTIONAL] Enter the silent (with progress) install switch'
}
##########################################
@@ -132,6 +137,7 @@ write-host "LicenseUrl: " -ForeGroundColor Blue -NoNewLine
write-host $LicenseUrl -ForeGroundColor White
}
if (!($AppMoniker.length -eq 0)) {
$string = "AppMoniker: " + $AppMoniker
@@ -140,6 +146,7 @@ write-host "AppMoniker: " -ForeGroundColor Blue -NoNewLine
write-host $AppMoniker -ForeGroundColor White
}
if (!($Commands.length -eq 0)) {
$string = "Commands: " + $Commands
@@ -148,6 +155,7 @@ write-host "Commands: " -ForeGroundColor Blue -NoNewLine
write-host $Commands -ForeGroundColor White
}
if (!($Tags.length -eq 0)) {
$string = "Tags: " + $Tags
@@ -157,7 +165,6 @@ write-host $Tags -ForeGroundColor White
}
if (!($Description.length -eq 0)) {
$string = "Description: " + $Description
@@ -167,8 +174,6 @@ write-host $Description -ForeGroundColor White
}
if (!($Homepage.Length -eq 0)) {
$string = "Homepage: "+ $Homepage
@@ -178,6 +183,7 @@ write-host $Homepage -ForeGroundColor White
}
write-output "Installers:" | out-file $filename -append
@@ -186,7 +192,6 @@ write-output $string | out-file $filename -append
write-host "Arch: " -ForeGroundColor Blue -NoNewLine
write-host $architecture -ForeGroundColor White
$string = " Url: " + $Url
write-output $string | out-file $filename -append
write-host "Url: " -ForeGroundColor Blue -NoNewLine
@@ -202,6 +207,31 @@ write-output $string | out-file $filename -append
write-host "InstallerType " -ForeGroundColor Blue -NoNewLine
write-host $InstallerType -ForeGroundColor White
if (!($Silent.Length) -eq 0 -Or !($SilentWithProgress.Length -eq 0)) {
$string = " Switches:"
write-output $string | out-file $filename -append
write-host "Switches " -ForeGroundColor Blue -NoNewLine
}
if (!($Silent.Length -eq 0)) {
$string = " Silent: " + $Silent
write-output $string | out-file $filename -append
write-host "Silent " -ForeGroundColor Blue -NoNewLine
write-host $Silent -ForeGroundColor White
}
if (!($SilentWithProgress.Length -eq 0)) {
$string = " SilentWithProgress: " + $SilentWithProgress
write-output $string | out-file $filename -append
write-host "SilentWithProgress " -ForeGroundColor Blue -NoNewLine
write-host $SilentWithProgress -ForeGroundColor White
}
$string = "Yaml file created: " + $filename
write-output $string