diff options
author | 2006-02-08 19:20:05 +1000 | |
---|---|---|
committer | 2006-02-08 19:20:05 +1000 | |
commit | 73a9c8bcb8d3d8db967fcc5cc9dd5e8db645400f (patch) | |
tree | 13862f394dca16b0c9bae427f86fbbecdfc9ac03 /init/functions/__fish_complete_suffix.fish | |
parent | 47b652c76e240e16875734f7ca251bab97ae6309 (diff) |
Autoloaded functions
darcs-hash:20060208092005-ac50b-8e784f79a4e158c8c15b553fad85002dccc7bd03.gz
Diffstat (limited to 'init/functions/__fish_complete_suffix.fish')
-rw-r--r-- | init/functions/__fish_complete_suffix.fish | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/init/functions/__fish_complete_suffix.fish b/init/functions/__fish_complete_suffix.fish new file mode 100644 index 00000000..78c5d2e0 --- /dev/null +++ b/init/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 |