Make Schema Message Dynamic (#56599)
This commit is contained in:
1 parent
a1bd6a309d
commit
5c19f679ea
1 file changed
+5
-4
@@ -1123,13 +1123,13 @@ Function Read-InstallerMetadata {
|
||||
else { $FileExtensions = $FileExtensions | ToLower | UniqueItems }
|
||||
$script:FileExtensions = Read-InstallerMetadataValue -Variable $FileExtensions -Key 'FileExtensions' -Prompt "[Optional] Enter any File Extensions the application could support. For example: html, htm, url (Max $($Patterns.MaxItemsFileExtensions))" | ToLower | UniqueItems
|
||||
|
||||
if (($script:FileExtensions -split ',').Count -le $Patterns.MaxItemsFileExtensions -and $($script:FileExtensions.Split(',').Trim() | Where-Object { Test-String -not $_ -MaxLength $Patterns.FileExtensionMaxLength -MatchPattern $Patterns.FileExtension -AllowNull }).Count -eq 0) {
|
||||
if (($script:FileExtensions -split ',').Count -le $Patterns.MaxItemsFileExtensions -and $($script:FileExtensions.Split(',').Trim() | Where-Object { Test-String -Not $_ -MaxLength $Patterns.FileExtensionMaxLength -MatchPattern $Patterns.FileExtension -AllowNull }).Count -eq 0) {
|
||||
$script:_returnValue = [ReturnValue]::Success()
|
||||
} else {
|
||||
if (($script:FileExtensions -split ',').Count -gt $Patterns.MaxItemsFileExtensions ) {
|
||||
$script:_returnValue = [ReturnValue]::MaxItemsError($Patterns.MaxItemsFileExtensions)
|
||||
} else {
|
||||
$script:_returnValue = [ReturnValue]::new(400, 'Invalid Entries', "Some entries do not match the requirements defined in the manifest schema - $($script:FileExtensions.Split(',').Trim() | Where-Object { Test-String -not $_ -MaxLength $Patterns.FileExtensionMaxLength -MatchPattern $Patterns.FileExtension })", 2)
|
||||
$script:_returnValue = [ReturnValue]::new(400, 'Invalid Entries', "Some entries do not match the requirements defined in the manifest schema - $($script:FileExtensions.Split(',').Trim() | Where-Object { Test-String -Not $_ -MaxLength $Patterns.FileExtensionMaxLength -MatchPattern $Patterns.FileExtension })", 2)
|
||||
}
|
||||
}
|
||||
} until ($script:_returnValue.StatusCode -eq [ReturnValue]::Success().StatusCode)
|
||||
@@ -1590,10 +1590,11 @@ Function Read-PRBody {
|
||||
}
|
||||
|
||||
'*schema*' {
|
||||
$_Match = ($_line | Select-String -Pattern 'https://+.+(?=\))').Matches.Value
|
||||
$_menu = @{
|
||||
Prompt = 'Does your manifest conform to the 1.0 schema?'
|
||||
Prompt = $_line.TrimStart('- [ ]') -replace '\[|\]|\(.+\)', ''
|
||||
Entries = @('[Y] Yes'; '*[N] No')
|
||||
HelpText = 'Reference Link: https://github.com/microsoft/winget-cli/blob/master/doc/ManifestSpecv1.0.md'
|
||||
HelpText = "Reference Link: $_Match"
|
||||
HelpTextColor = ''
|
||||
DefaultString = 'N'
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user