mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 21:03:12 +00:00
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:
parent
461ef2a508
commit
9c9a8f9d0f
1 changed files with 23 additions and 8 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue