mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-12-13 09:24:03 +08:00
6dc74d3b6c
For usage in completion scripts. Unlike `__fish_is_first_token` (which is probably not correctly named), `__fish_is_first_arg` returns true regardless of whether existing tokens start with `-` or not, to be used when an arg cannot be used with any other argument. `__fish_prev_arg_in` is similar to `__fish_seen_...` but it explicitly tests the preceding token only, for arguments that take only a single parameter.
6 lines
171 B
Fish
6 lines
171 B
Fish
# determine if this is the very first argument (regardless if switch or not)
|
|
function __fish_is_first_arg
|
|
set -l tokens (commandline -co)
|
|
test (count $tokens) -eq 1
|
|
end
|