minor formatting tweak

This commit is contained in:
Jack Wright 2024-12-01 18:27:49 -08:00
parent 2f80e0879f
commit 1886f6baad

View file

@ -76,28 +76,28 @@ let cobra_completer = {|spans|
# Add space at the end of each completion # Add space at the end of each completion
let completions = if $directive != $ShellCompDirectiveNoSpace { let completions = if $directive != $ShellCompDirectiveNoSpace {
$completions | each {|it| {value: $"($it.value) ", description: $it.description}} $completions | each {|it| {value: $"($it.value) ", description: $it.description}}
} else { } else {
$completions $completions
} }
# Cobra returns a list of completions that are supported with this directive # 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 # There is no way to currently support this in a nushell external completer
let completions = if $directive == $ShellCompDirectiveFilterFileExt { let completions = if $directive == $ShellCompDirectiveFilterFileExt {
[] []
} else { } else {
$completions $completions
} }
if $directive == $ShellCompDirectiveNoFileComp { if $directive == $ShellCompDirectiveNoFileComp {
# Allow empty results as this will stop file completion # Allow empty results as this will stop file completion
$completions $completions
} else if ($completions | is-empty) or $directive == $ShellCompDirectiveError { } else if ($completions | is-empty) or $directive == $ShellCompDirectiveError {
# Not returning null causes file completions to break # Not returning null causes file completions to break
# Return null if there are no completions or ShellCompDirectiveError # Return null if there are no completions or ShellCompDirectiveError
null null
} else { } else {
$completions $completions
} }
if ($completions | is-empty) { if ($completions | is-empty) {