file: New completion.
This commit is contained in:
parent
2a7db4d988
commit
c3d29e2e0d
@ -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
38
completions/file
Normal 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
1
test/completion/file.exp
Normal file
@ -0,0 +1 @@
|
|||||||
|
assert_source_completions file
|
21
test/lib/completions/file.exp
Normal file
21
test/lib/completions/file.exp
Normal 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
|
Loading…
x
Reference in New Issue
Block a user