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:
Mahmoud Al-Qudsi 2022-09-27 13:59:16 -05:00
parent 5ada59996f
commit 0cccbfcaaa

View File

@ -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