2006-02-08 09:20:05 +00:00
|
|
|
function __fish_gnu_complete -d "Wrapper for the complete builtin. Skips the long completions on non-GNU systems"
|
|
|
|
set is_gnu 0
|
|
|
|
|
2007-01-16 10:26:51 +00:00
|
|
|
set -l argv_out
|
|
|
|
|
2006-02-08 09:20:05 +00:00
|
|
|
# Check if we are using a gnu system
|
2007-01-16 10:26:51 +00:00
|
|
|
for i in $argv
|
|
|
|
switch $i
|
2010-09-18 02:18:26 +00:00
|
|
|
|
2006-02-08 09:20:05 +00:00
|
|
|
case -g --is-gnu
|
|
|
|
set is_gnu 1
|
2007-01-16 10:26:51 +00:00
|
|
|
|
|
|
|
case '*'
|
|
|
|
set argv_out $argv_out $i
|
2006-02-08 09:20:05 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2007-01-16 10:26:51 +00:00
|
|
|
set argv $argv_out
|
|
|
|
set argv_out
|
2007-01-18 16:28:53 +00:00
|
|
|
set -l skip_next 0
|
2007-01-16 10:26:51 +00:00
|
|
|
|
2006-02-08 09:20:05 +00:00
|
|
|
# Remove long option if not on a gnu system
|
2007-01-18 16:28:53 +00:00
|
|
|
switch $is_gnu
|
|
|
|
case 0
|
|
|
|
for i in $argv
|
2007-01-16 10:26:51 +00:00
|
|
|
|
2007-01-18 16:28:53 +00:00
|
|
|
switch $skip_next
|
|
|
|
|
|
|
|
case 1
|
|
|
|
set skip_next 0
|
|
|
|
continue
|
|
|
|
|
|
|
|
end
|
2010-09-18 02:18:26 +00:00
|
|
|
|
2007-01-18 16:28:53 +00:00
|
|
|
switch $i
|
|
|
|
|
|
|
|
case -l --long
|
|
|
|
set skip_next 1
|
|
|
|
continue
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
set argv_out $argv_out $i
|
2006-02-08 09:20:05 +00:00
|
|
|
end
|
2007-01-18 16:28:53 +00:00
|
|
|
set argv $argv_out
|
2007-01-16 10:26:51 +00:00
|
|
|
|
2006-02-08 09:20:05 +00:00
|
|
|
end
|
2010-09-18 02:18:26 +00:00
|
|
|
|
2006-02-08 09:20:05 +00:00
|
|
|
complete $argv
|
|
|
|
|
|
|
|
end
|
|
|
|
|