mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-07 10:01:14 -03: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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user