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