From 0cccbfcaaa63a3a1082e51aac636a9d232f0d676 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Tue, 27 Sep 2022 13:59:16 -0500 Subject: [PATCH] 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. --- share/functions/__fish_seen_argument.fish | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/share/functions/__fish_seen_argument.fish b/share/functions/__fish_seen_argument.fish index 146e9ce8e..9774774ab 100644 --- a/share/functions/__fish_seen_argument.fish +++ b/share/functions/__fish_seen_argument.fish @@ -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