aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/__fish_gnu_complete.fish
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2007-01-16 20:26:51 +1000
committerGravatar axel <axel@liljencrantz.se>2007-01-16 20:26:51 +1000
commit9c9a8f9d0f9145ba6daaa70d187350c1ec6d1321 (patch)
treee79399a3c5c70c9fcad89a15d06ad10eea3bd8c0 /share/functions/__fish_gnu_complete.fish
parent461ef2a5085388bba2538cde5269338fc9c15d62 (diff)
Improve speed of __fish_gnu_complete on systems with no native seq implementation by avoiding using seq at all
darcs-hash:20070116102651-ac50b-ad7e0acd325f88d1676e4c533bc863caedf91748.gz
Diffstat (limited to 'share/functions/__fish_gnu_complete.fish')
-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