diff --git a/nushell_completions.go b/nushell_completions.go index 8f7c856..c03ea8d 100644 --- a/nushell_completions.go +++ b/nushell_completions.go @@ -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)" }