2021-11-25 15:30:44 +08:00
|
|
|
function __fish_seen_argument --description 'Check whether argument is used'
|
|
|
|
argparse '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]
|
|
|
|
|
|
|
|
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
|
|
|
|
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
|