added bash completion script

This commit is contained in:
Davide Riccardo Caliendo 2013-10-12 03:06:30 +02:00 committed by Nico Schottelius
parent 4e0edfb3fc
commit cd29a8574f
2 changed files with 23 additions and 0 deletions

20
extras/completion/ctt Normal file
View File

@ -0,0 +1,20 @@
_ctt()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
comms="listproject track report"
opts="-h --help -d --debug -v --verbose"
cmdopts="--sd --start --ed --end -a --all -e --regexp -i --ignorecase -f --format"
case "${prev}" in
track|report)
local projects=$(for p in ~/.ctt/*; do basename "$p"; done )
COMPREPLY=( $(compgen -W "${projects} ${opts} ${cmdopts}" -- ${cur}) )
return 0
;;
esac
COMPREPLY=( $(compgen -W "${comms} ${opts}" -- ${cur}) )
return 0
}
complete -F _ctt ctt

View File

@ -16,6 +16,9 @@ setup(name='ctt',
packages=['lib/ctt',
],
scripts=['scripts/ctt'],
data_files=[
('/etc/bash_completion.d/', ['extras/completion/ctt']),
],
zip_safe=True,
classifiers=[
'Environment :: Console',