2021-11-25 15:30:44 +08:00
|
|
|
function __fish_seen_argument --description 'Check whether argument is used'
|
2022-09-28 02:59:16 +08:00
|
|
|
argparse --ignore-unknown 's/short=+' 'o/old=+' 'l/long=+' 'w/windows=+' -- $argv
|
2018-04-04 03:40:51 +08:00
|
|
|
|
2021-11-25 15:30:44 +08:00
|
|
|
set --local tokens (commandline --current-process --tokenize --cut-at-cursor)
|
|
|
|
set --erase tokens[1]
|
2022-01-27 14:02:23 +08:00
|
|
|
|
2021-11-25 15:30:44 +08:00
|
|
|
for t in $tokens
|
2019-05-05 18:09:25 +08:00
|
|
|
for s in $_flag_s
|
2021-11-25 15:30:44 +08:00
|
|
|
if string match --regex --quiet -- "^-[A-z0-9]*"$s"[A-z0-9]*\$" $t
|
2019-05-05 18:09:25 +08:00
|
|
|
return 0
|
|
|
|
end
|
|
|
|
end
|
2018-04-04 03:40:51 +08:00
|
|
|
|
2019-11-03 03:40:40 +08:00
|
|
|
for o in $_flag_o
|
2021-11-25 20:29:52 +08:00
|
|
|
if string match --quiet -- "-$o" $t
|
2019-11-03 03:40:40 +08:00
|
|
|
return 0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-05-05 18:09:25 +08:00
|
|
|
for l in $_flag_l
|
2021-11-25 15:30:44 +08:00
|
|
|
if string match --quiet -- "--$l" $t
|
|
|
|
return 0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
for w in $_flag_w
|
|
|
|
if string match --quiet -- "/$w" $t
|
2019-05-05 18:09:25 +08:00
|
|
|
return 0
|
|
|
|
end
|
|
|
|
end
|
2022-09-28 02:59:16 +08:00
|
|
|
|
|
|
|
for raw_arg in $argv
|
|
|
|
if string match --quiet -- $t $raw_arg
|
|
|
|
return 0
|
|
|
|
end
|
|
|
|
end
|
2019-05-05 18:09:25 +08:00
|
|
|
end
|
2018-04-04 03:40:51 +08:00
|
|
|
|
2019-05-05 18:09:25 +08:00
|
|
|
return 1
|
2018-04-04 03:40:51 +08:00
|
|
|
end
|