fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
a53db7256
master
1# localization: skip(private) 2function __fish_contains_opt -d"Checks if a specific option has been given in the current commandline" 3set -l next_short 4set -l short_opt 5set -l long_opt 6 7for iin $argv 8if test -n " $next_short " 9set next_short 10set -a short_opt$i 11else 12switch $i 13case -s 14set next_short1 15case '-*' 16echo __fish_contains_opt: Unknown option$i >&2 17return 1 18case '*' 19set -a long_opt$i 20end 21end 22end 23 24for iin $short_opt 25if test -z " $i " 26continue 27end 28 29if string match -qr --"^- $i |^-[^-]* $i " ( commandline -cpx) 30return 0 31end 32 33if string match -qr --"^- $i |^-[^-]* $i " ( commandline -ct) 34return 0 35end 36end 37 38for iin $long_opt 39if test -z " $i " 40continue 41end 42 43if contains -- --$i ( commandline -cpx) 44return 0 45end 46end 47 48return 1 49end