mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-15 23:22:53 +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'
|
||||
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 --erase tokens[1]
|
||||
@ -28,6 +28,12 @@ function __fish_seen_argument --description 'Check whether argument is used'
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
for raw_arg in $argv
|
||||
if string match --quiet -- $t $raw_arg
|
||||
return 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user