fish-shell/share/functions/fish_is_nth_token.fish
Aniruddh Agarwal 0445126c2e Undunder __fish_is_nth_token
We keep __fish_is_nth_token for compatibility and edit the
implementations of __fish_is_nth_token, __fish_is_first_token and
__fish_is_token_n to use fish_is_nth_token
2021-07-23 17:25:50 +02:00

5 lines
250 B
Fish

function fish_is_nth_token --description 'Test if current token is on Nth place' --argument-names n
set -l tokens (commandline -poc)
set -l tokens (string replace -r --filter '^([^-].*)' '$1' -- $tokens)
test (count $tokens) -eq "$n"
end