fish-shell/share/functions/__fish_is_nth_token.fish

6 lines
285 B
Fish
Raw Normal View History

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"
2020-07-01 14:25:36 +00:00
end