fish-shell/share/functions/__fish_is_nth_token.fish

7 lines
201 B
Fish
Raw Normal View History

2020-07-01 14:25:36 +00:00
function __fish_is_nth_token
set -l n $argv[1]
set -l tokens (commandline -poc)
set -l tokens (string replace -r --filter '^([^-].*)' '$1' -- $tokens)
test (count $tokens) -eq "$n"
end