2006-02-08 09:20:05 +00:00
|
|
|
#
|
|
|
|
# Find files that complete $argv[1], has the suffix $argv[2], and
|
|
|
|
# output them as completions with description $argv[3]
|
|
|
|
#
|
|
|
|
|
|
|
|
function __fish_complete_suffix -d "Complete using files"
|
|
|
|
|
2006-12-12 20:37:27 +00:00
|
|
|
set comp $argv[1]
|
|
|
|
set suff $argv[2]
|
|
|
|
set desc $argv[3]
|
2006-02-08 09:20:05 +00:00
|
|
|
|
2006-12-12 20:37:27 +00:00
|
|
|
set base (echo $comp |sed -e 's/\.[a-zA-Z0-9]*$//')
|
|
|
|
eval "set files $base*$suff"
|
2006-02-08 09:20:05 +00:00
|
|
|
|
|
|
|
if test $files[1]
|
|
|
|
printf "%s\t$desc\n" $files
|
|
|
|
end
|
|
|
|
|
|
|
|
#
|
|
|
|
# Also do directory completion, since there might be files
|
|
|
|
# with the correct suffix in a subdirectory
|
|
|
|
#
|
|
|
|
|
2006-12-02 23:34:33 +00:00
|
|
|
__fish_complete_directories $comp
|
2006-02-08 09:20:05 +00:00
|
|
|
|
|
|
|
end
|