mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 14:23:09 +00:00
Windows options support in __fish_seen_argument
This commit is contained in:
parent
3c943d2836
commit
7f1ea27008
1 changed files with 15 additions and 8 deletions
|
@ -1,23 +1,30 @@
|
||||||
function __fish_seen_argument --description 'Check whether argument used'
|
function __fish_seen_argument --description 'Check whether argument is used'
|
||||||
argparse 's/short=+' 'o/old=+' 'l/long=+' -- $argv
|
argparse 's/short=+' 'o/old=+' 'l/long=+' 'w/windows=+' -- $argv
|
||||||
|
|
||||||
set -l cmd (commandline -poc)
|
set --local tokens (commandline --current-process --tokenize --cut-at-cursor)
|
||||||
set -e cmd[1]
|
set --erase tokens[1]
|
||||||
for t in $cmd
|
|
||||||
|
for t in $tokens
|
||||||
for s in $_flag_s
|
for s in $_flag_s
|
||||||
if string match -qr "^-[A-z0-9]*"$s"[A-z0-9]*\$" -- $t
|
if string match --regex --quiet -- "^-[A-z0-9]*"$s"[A-z0-9]*\$" $t
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for o in $_flag_o
|
for o in $_flag_o
|
||||||
if string match -qr "^-$s\$" -- $t
|
if string match --quiet -- "-$s" $t
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for l in $_flag_l
|
for l in $_flag_l
|
||||||
if string match -q -- "--$l" $t
|
if string match --quiet -- "--$l" $t
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for w in $_flag_w
|
||||||
|
if string match --quiet -- "/$w" $t
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue