fish-shell/share/functions/fish_is_nth_token.fish
Mahmoud Al-Qudsi 99e0aa3c64 Clarify fish_is_nth_token description
Yes, this does make it longer but it's a very important point.
2022-02-08 14:17:00 -06:00

5 lines
283 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