file: New completion.

This commit is contained in:
Ville Skyttä 2011-10-03 23:39:20 +03:00
parent 2a7db4d988
commit c3d29e2e0d
4 changed files with 61 additions and 0 deletions

View File

@ -48,6 +48,7 @@ bashcomp_DATA = abook \
e2fsprogs \ e2fsprogs \
evince \ evince \
feh \ feh \
file \
findutils \ findutils \
freeciv \ freeciv \
freerdp \ freerdp \

38
completions/file Normal file
View File

@ -0,0 +1,38 @@
have file || return
_file()
{
local cur prev words cword
_init_completion || return
case $prev in
--help|-v|--version|-F|--separator)
return
;;
-m|--magic-file|-f|--files-from)
_filedir
return
;;
-e|--exclude)
COMPREPLY=( $( compgen -W 'ascii apptype compress elf soft tar
tokens troff' -- "$cur" ) )
return
;;
esac
if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return
fi
_filedir
} &&
complete -F _file file
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh

1
test/completion/file.exp Normal file
View File

@ -0,0 +1 @@
assert_source_completions file

View File

@ -0,0 +1,21 @@
proc setup {} {
save_env
}
proc teardown {} {
assert_env_unmodified
}
setup
assert_complete_any "file "
sync_after_int
assert_complete_any "file -"
sync_after_int
teardown