The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

pwsh: quote completion reply when necessary

Close #249

authored by

Brian Ward and committed by
Daniel Bünzli
f65084d9 45dcc469

+20 -8
+10 -4
vendor/opam/cmdliner/src/tool/cmdliner_data.ml
··· 180 180 if ($otherArgs -ne "") { 181 181 $otherArgs += " " 182 182 } 183 - if ($text -eq $wordToComplete) { 183 + # wordToComplete has had quoting removed, so we need to remove it before comparison 184 + if ($text -replace "[`"']", "" -eq $wordToComplete) { 184 185 $otherArgs += "--__complete=$text" 185 186 $seenWordToComplete = $true 186 187 } ··· 249 250 } 250 251 251 252 $completionItem = $item 252 - # re-add prefix for things like --foo= 253 + 253 254 if ($group -eq "Values") { 254 - $item = $prefix + $item 255 + # quote replies with powershell separators 256 + if ($completionItem -match "[,|;]") { 257 + $completionItem = '"' + $completionItem + '"' 258 + } 259 + # re-add prefix for things like --foo= 260 + $completionItem = $prefix + $completionItem 255 261 } 256 262 257 263 $CompletionResults.Add( 258 264 [System.Management.Automation.CompletionResult]::new( 259 - $item, 260 265 $completionItem, 266 + $item, 261 267 'ParameterValue', 262 268 $itemDoc)) 263 269 }
+10 -4
vendor/opam/cmdliner/src/tool/pwsh-completion.ps1
··· 21 21 if ($otherArgs -ne "") { 22 22 $otherArgs += " " 23 23 } 24 - if ($text -eq $wordToComplete) { 24 + # wordToComplete has had quoting removed, so we need to remove it before comparison 25 + if ($text -replace "[`"']", "" -eq $wordToComplete) { 25 26 $otherArgs += "--__complete=$text" 26 27 $seenWordToComplete = $true 27 28 } ··· 90 91 } 91 92 92 93 $completionItem = $item 93 - # re-add prefix for things like --foo= 94 + 94 95 if ($group -eq "Values") { 95 - $item = $prefix + $item 96 + # quote replies with powershell separators 97 + if ($completionItem -match "[,|;]") { 98 + $completionItem = '"' + $completionItem + '"' 99 + } 100 + # re-add prefix for things like --foo= 101 + $completionItem = $prefix + $completionItem 96 102 } 97 103 98 104 $CompletionResults.Add( 99 105 [System.Management.Automation.CompletionResult]::new( 100 - $item, 101 106 $completionItem, 107 + $item, 102 108 'ParameterValue', 103 109 $itemDoc)) 104 110 }