diff options
author | 2006-02-17 20:13:39 +1000 | |
---|---|---|
committer | 2006-02-17 20:13:39 +1000 | |
commit | 343cafef346543282b5b6e825bc8f9dd10028a48 (patch) | |
tree | 1bcf221ecb525c7aeadc8325e7b780d3656e544b /share/functions/__fish_complete_suffix.fish | |
parent | 95a01f3c8f15034433ffce368d8f2d13d925139c (diff) |
Redo installation file structure, move lots of things to $PREFIX/share/fish
darcs-hash:20060217101339-ac50b-d93d2c620a4b7f75f05ff461a6edbee001da7613.gz
Diffstat (limited to 'share/functions/__fish_complete_suffix.fish')
-rw-r--r-- | share/functions/__fish_complete_suffix.fish | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/share/functions/__fish_complete_suffix.fish b/share/functions/__fish_complete_suffix.fish new file mode 100644 index 00000000..78c5d2e0 --- /dev/null +++ b/share/functions/__fish_complete_suffix.fish @@ -0,0 +1,26 @@ +# +# 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_directory $comp + +end |