mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +08:00
Extend __fish_seen_argument to support raw arguments
This allows it to just directly match any literals (passed after `--`) without treating them as pre-processed short/long/old arguments.
This commit is contained in:
parent
5ada59996f
commit
0cccbfcaaa
@ -1,5 +1,5 @@
|
|||||||
function __fish_seen_argument --description 'Check whether argument is used'
|
function __fish_seen_argument --description 'Check whether argument is used'
|
||||||
argparse 's/short=+' 'o/old=+' 'l/long=+' 'w/windows=+' -- $argv
|
argparse --ignore-unknown 's/short=+' 'o/old=+' 'l/long=+' 'w/windows=+' -- $argv
|
||||||
|
|
||||||
set --local tokens (commandline --current-process --tokenize --cut-at-cursor)
|
set --local tokens (commandline --current-process --tokenize --cut-at-cursor)
|
||||||
set --erase tokens[1]
|
set --erase tokens[1]
|
||||||
@ -28,6 +28,12 @@ function __fish_seen_argument --description 'Check whether argument is used'
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for raw_arg in $argv
|
||||||
|
if string match --quiet -- $t $raw_arg
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user