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"
|
2016-11-28 13:27:22 +08:00
|
|
|
set is_gnu 0
|
2006-02-08 17:20:05 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
set -l argv_out
|
2007-01-16 18:26:51 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
# Check if we are using a gnu system
|
|
|
|
for i in $argv
|
|
|
|
switch $i
|
2010-09-18 10:18:26 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
case -g --is-gnu
|
|
|
|
set is_gnu 1
|
2007-01-16 18:26:51 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
case '*'
|
|
|
|
set argv_out $argv_out $i
|
|
|
|
end
|
|
|
|
end
|
2006-02-08 17:20:05 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
set argv $argv_out
|
|
|
|
set argv_out
|
|
|
|
set -l skip_next 0
|
2007-01-16 18:26:51 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
# Remove long option if not on a gnu system
|
|
|
|
switch $is_gnu
|
|
|
|
case 0
|
|
|
|
for i in $argv
|
2007-01-16 18:26:51 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
switch $skip_next
|
2007-01-19 00:28:53 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
case 1
|
|
|
|
set skip_next 0
|
|
|
|
continue
|
2007-01-19 00:28:53 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
end
|
2010-09-18 10:18:26 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
switch $i
|
2007-01-19 00:28:53 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
case -l --long
|
|
|
|
set skip_next 1
|
|
|
|
continue
|
2007-01-19 00:28:53 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
end
|
2007-01-19 00:28:53 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
set argv_out $argv_out $i
|
|
|
|
end
|
|
|
|
set argv $argv_out
|
2007-01-16 18:26:51 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
end
|
2010-09-18 10:18:26 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
complete $argv
|
2006-02-08 17:20:05 +08:00
|
|
|
|
|
|
|
end
|
|
|
|
|