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
This commit is contained in:
axel 2007-01-16 20:26:51 +10:00
parent 461ef2a508
commit 9c9a8f9d0f

View file

@ -1,26 +1,41 @@
function __fish_gnu_complete -d "Wrapper for the complete builtin. Skips the long completions on non-GNU systems" function __fish_gnu_complete -d "Wrapper for the complete builtin. Skips the long completions on non-GNU systems"
set is_gnu 0 set is_gnu 0
set -l argv_out
# Check if we are using a gnu system # Check if we are using a gnu system
for i in (seq (count $argv)) for i in $argv
switch $argv[$i] switch $i
case -g --is-gnu case -g --is-gnu
set -e argv[$i]
set is_gnu 1 set is_gnu 1
break break
case '*'
set argv_out $argv_out $i
end end
end end
set argv $argv_out
set argv_out
set -l skip_next 0
# Remove long option if not on a gnu system # Remove long option if not on a gnu system
if test $is_gnu = 0 if test $is_gnu = 0
for i in (seq (count $argv)) for i in $argv
if test $argv[$i] = -l
set -e argv[$i] if test $skip_next = 1
set -e argv[$i] continue
break
end end
if test $i = -l
set skip_next 1
continue
end end
set argv_out $argv_out $i
end
set argv $argv_out
end end
complete $argv complete $argv