fish-shell/share/functions/__fish_is_nth_token.fish

7 lines
201 B
Fish
Raw Normal View History

2020-07-01 22:25:36 +08: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