Skip to content

Commit

Permalink
Move prompt outside of Read-Info for clarity
Browse files Browse the repository at this point in the history
* Move Update Prompt outside of Read-Info for clarity
* Update Messages
  • Loading branch information
Trenly authored Sep 18, 2021
1 parent a5989dd commit 1f614b5
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions Tools/YamlCreate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -296,21 +296,7 @@ Function Request-Installer-Url {
return $NewInstallerUrl
}

Function Read-WinGet-MandatoryInfo {
if ($script:Option -eq 'QuickUpdateVersion') {
$_menu = @{
entries = @('[Y] Continue with Quick Update'; '*[N] Switch to Option 1')
Prompt = 'Quick Updates only allow for changes to the existing Installer URLs, Sha256 Values, and Product Codes. Are you sure you want to continue?'
HelpText = 'This mode should be used with caution. If you are not 100% certain this is correct, please use Option 1 to go through the full update experience'
HelpTextColor = 'Red'
DefaultString = 'N'
}

if ($(KeypressMenu -Prompt $_menu['Prompt'] -Entries $_menu['Entries'] -DefaultString $_menu['DefaultString'] -HelpText $_menu['HelpText'] -HelpTextColor $_menu['HelpTextColor']) -ne 'Y') {
$script:Option = 'New'; Write-Host -ForegroundColor DarkYellow -Object "`n`nSwitched to Option 1" -NoNewline;
}
}

Function Read-WinGet-MandatoryInfo {
Write-Host

do {
Expand Down Expand Up @@ -1768,6 +1754,23 @@ Function Read-PreviousWinGet-Manifest-Yaml {

$script:_returnValue = [ReturnValue]::new(200)
Show-OptionMenu

if ($script:Option -eq 'QuickUpdateVersion'){
$_menu = @{
entries = @('[Y] Continue with Quick Update'; '[N] Use Full Update Experience'; '*[Q] Exit Script')
Prompt = 'Quick Updates only allow for changes to the existing Installer URLs, Sha256 Values, and Product Codes. Are you sure you want to continue?'
HelpText = 'This mode should be used with caution. If you are not 100% certain this is correct, please use Option 1 to go through the full update experience'
HelpTextColor = 'Red'
DefaultString = 'Q'
}

switch ( KeypressMenu -Prompt $_menu['Prompt'] -Entries $_menu['Entries'] -DefaultString $_menu['DefaultString'] -HelpText $_menu['HelpText'] -HelpTextColor $_menu['HelpTextColor']) {
'Y' { Write-Host -ForegroundColor DarkYellow -Object "`n`nContinuing with Quick Update"}
'N' {$script:Option = 'New'; Write-Host -ForegroundColor DarkYellow -Object "`n`nSwitched to Full Update Experience"}
default { Write-Host;exit 1 }
}
}

Read-WinGet-MandatoryInfo
Read-PreviousWinGet-Manifest-Yaml

Expand Down

0 comments on commit 1f614b5

Please sign in to comment.