"ignoring return value when directive is ShellComp#directiveFilterFileExt"

This commit is contained in:
Jack Wright 2022-12-16 09:32:22 -08:00
parent d86bac4e34
commit 247e8e6b55

View file

@ -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)" }