mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:39:52 +08:00
7ad779ac00
This was only used in __fish_should_complete_switches, and is a tiny helper function that is better integrated directly. Part of #5279. [ci skip]
15 lines
366 B
Fish
15 lines
366 B
Fish
# Returns whether we *should* complete a -s or --long argument.
|
|
# The preference is NOT to do so, i.e. prefer subcommands over switches.
|
|
function __fish_should_complete_switches
|
|
for arg in (commandline -ct)[-1..1]
|
|
if not string match -qr -- "^-\S*\$" "$arg"
|
|
return 1
|
|
end
|
|
end
|
|
if string match -qr -- "^-" (commandline -ct)[-1]
|
|
return 0
|
|
end
|
|
|
|
return 1
|
|
end
|