mirror of
https://github.com/sharkdp/bat.git
synced 2026-02-08 00:32:08 +00:00
Update PowerShell completions for compatibility with PowerShell v5.1
Modified the PowerShell completion script to replace the null-coalescing operator (`??` - a v7 feature) with a conditional statement compatible with PowerShell v5.1. The script now uses an if-else check for null descriptions in the language completion section.
This commit is contained in:
5
assets/completions/_bat.ps1.in
vendored
5
assets/completions/_bat.ps1.in
vendored
@@ -49,7 +49,10 @@ Register-ArgumentCompleter -Native -CommandName '{{PROJECT_EXECUTABLE}}' -Script
|
||||
}
|
||||
'*;--language' {
|
||||
Get-MyLanguages |
|
||||
ForEach-Object {[CompletionResult]::new(($_.MyParameter -replace "^(.*)$", '''$1'''), $_.MyParameter, [CompletionResultType]::ParameterName, $_.MyDescription ?? '_no value_')}
|
||||
ForEach-Object {
|
||||
$desc = if ($null -eq $_.MyDescription) { '_no value_' } else { $_.MyDescription }
|
||||
[CompletionResult]::new(($_.MyParameter -replace "^(.*)$", '''$1'''), $_.MyParameter, [CompletionResultType]::ParameterName, $desc)
|
||||
}
|
||||
break
|
||||
}
|
||||
'*;--theme' {
|
||||
|
||||
Reference in New Issue
Block a user