mirror of
https://github.com/spf13/cobra
synced 2024-12-29 15:57:10 +00:00
"ignoring return value when directive is ShellComp#directiveFilterFileExt"
This commit is contained in:
parent
d86bac4e34
commit
247e8e6b55
1 changed files with 9 additions and 1 deletions
|
@ -31,7 +31,7 @@ let cobra_apps = ["%[1]s"]
|
|||
|
||||
# An external completer that works with any cobra based
|
||||
# command line application (e.g. kubectl, minikube)
|
||||
let-env cobra_completer = {|spans|
|
||||
let cobra_completer = {|spans|
|
||||
let cmd = $spans.0
|
||||
|
||||
if not ($cobra_apps | where $cmd =~ $it | is-empty) {
|
||||
|
@ -132,6 +132,14 @@ let-env cobra_completer = {|spans|
|
|||
$completions
|
||||
}
|
||||
|
||||
# Cobra returns a list of completions that are supported with this directive
|
||||
# There is no way to currently support this in a nushell external completer
|
||||
let completions = if $directive == $ShellCompDirectiveFilterFileExt {
|
||||
[]
|
||||
} else {
|
||||
$completions
|
||||
}
|
||||
|
||||
let return_val = if $last_span =~ '=' {
|
||||
# if the completion is of the form -n= return flag as part of the completion so that it doesn't get replaced
|
||||
$completions | each {|it| $"($last_span | split row '=' | first)=($it.value)" }
|
||||
|
|
Loading…
Reference in a new issue