aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--share/functions/__fish_gnu_complete.fish31
1 files changed, 23 insertions, 8 deletions
diff --git a/share/functions/__fish_gnu_complete.fish b/share/functions/__fish_gnu_complete.fish
index 9aeb0ba8..1252fb88 100644
--- a/share/functions/__fish_gnu_complete.fish
+++ b/share/functions/__fish_gnu_complete.fish
@@ -1,26 +1,41 @@
function __fish_gnu_complete -d "Wrapper for the complete builtin. Skips the long completions on non-GNU systems"
set is_gnu 0
+ set -l argv_out
+
# Check if we are using a gnu system
- for i in (seq (count $argv))
- switch $argv[$i]
+ for i in $argv
+ switch $i
case -g --is-gnu
- set -e argv[$i]
set is_gnu 1
break
+
+ case '*'
+ set argv_out $argv_out $i
end
end
+ set argv $argv_out
+ set argv_out
+ set -l skip_next 0
+
# Remove long option if not on a gnu system
if test $is_gnu = 0
- for i in (seq (count $argv))
- if test $argv[$i] = -l
- set -e argv[$i]
- set -e argv[$i]
- break
+ for i in $argv
+
+ if test $skip_next = 1
+ continue
+ end
+
+ if test $i = -l
+ set skip_next 1
+ continue
end
+
+ set argv_out $argv_out $i
end
+ set argv $argv_out
end
complete $argv