mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-28 05:43:11 +00:00
47b0d0c293
Their names are not perfect, so let's keep them as internal functions,
until we figure out how/if we want to expose this.
This reverts 0445126c2
(Undunder __fish_is_nth_token, 2021-06-29) (but I
did it without "git revert").
Closes #8008
5 lines
285 B
Fish
5 lines
285 B
Fish
function __fish_is_nth_token --description 'Test if current token is the Nth (ignoring command and switches/flags)' --argument-names n
|
|
set -l tokens (commandline -poc)
|
|
set -l tokens (string replace -r --filter '^([^-].*)' '$1' -- $tokens)
|
|
test (count $tokens) -eq "$n"
|
|
end
|