fish-shell/share/functions/__fish_complete_suffix.fish
axel 8b73bac580 Rename __fish_complete_directory to increase consistency
darcs-hash:20061202233433-ac50b-48368a338773ad47807b0032389fd305d86b3275.gz
2006-12-03 09:34:33 +10:00

26 lines
549 B
Fish

#
# 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"
set -- comp $argv[1]
set -- suff $argv[2]
set -- desc $argv[3]
set -- base (echo $comp |sed -e 's/\.[a-zA-Z0-9]*$//')
eval "set -- files $base*$suff"
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
#
__fish_complete_directories $comp
end