aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/__fish_seen_subcommand_from.fish
diff options
context:
space:
mode:
Diffstat (limited to 'share/functions/__fish_seen_subcommand_from.fish')
-rw-r--r--share/functions/__fish_seen_subcommand_from.fish16
1 files changed, 16 insertions, 0 deletions
diff --git a/share/functions/__fish_seen_subcommand_from.fish b/share/functions/__fish_seen_subcommand_from.fish
new file mode 100644
index 00000000..508b635b
--- /dev/null
+++ b/share/functions/__fish_seen_subcommand_from.fish
@@ -0,0 +1,16 @@
+#
+# Test to see if we've seen a subcommand from a list.
+# This logic may seem backwards, but the commandline will often be much shorter
+# than the list
+#
+
+function __fish_seen_subcommand_from
+ set -l -- cmd (commandline -poc)
+ set -e cmd[1]
+ for i in $cmd
+ if contains -- $i $argv
+ return 0
+ end
+ end
+ return 1
+end