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