/etc/bash_completion.d/doit is in python-doit 0.24.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | # bash completion for doit
# auto-generate by `doit tabcomplention`
# to activate it you need to 'source' the generate script
# $ source <generated-script>
# reference => http://www.debian-administration.org/articles/317
# patch => http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=711879
_doit()
{
local cur prev words cword basetask sub_cmds tasks i dodof
COMPREPLY=() # contains list of words with suitable completion
# remove colon from word separator list because doit uses colon on task names
_get_comp_words_by_ref -n : cur prev words cword
# list of sub-commands
sub_cmds="dumpdb run help strace auto list ignore clean tabcompletion forget"
# options that take file/dir as values should complete file-system
if [[ "$prev" == "-f" || "$prev" == "-d" || "$prev" == "-o" ]]; then
_filedir
return 0
fi
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/}
cur=${cur/*=/}
if [[ "$prev" == "--file=" || "$prev" == "--dir=" || "$prev" == "--output-file=" ]]; then
_filedir -o nospace
return 0
fi
fi
# get name of the dodo file
for (( i=0; i < ${#words[@]}; i++)); do
case "${words[i]}" in
-f)
dodof=${words[i+1]}
break
;;
--file=*)
dodof=${words[i]/*=/}
break
;;
esac
done
# dodo file not specified, use default
if [ ! $dodof ]
then
dodof="dodo.py"
fi
# get task list
# if it there is colon it is getting a subtask, complete only subtask names
if [[ "$cur" == *:* ]]; then
# extract base task name (remove everything after colon)
basetask=${cur%:*}
# sub-tasks
tasks=$(doit list --file="$dodof" --quiet --all ${basetask} 2>/dev/null)
COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
__ltrim_colon_completions "$cur"
return 0
# without colons get only top tasks
else
tasks=$(doit list --file="$dodof" --quiet 2>/dev/null)
fi
# match for first parameter must be sub-command or task
# FIXME doit accepts options "-" in the first parameter but we ignore this case
if [[ ${cword} == 1 ]] ; then
COMPREPLY=( $(compgen -W "${sub_cmds} ${tasks}" -- ${cur}) )
return 0
fi
# if command is help complete with tasks or sub-commands
if [[ ${words[1]} == "help" ]] ; then
COMPREPLY=( $(compgen -W "${sub_cmds} ${tasks}" -- ${cur}) )
return 0
fi
# if there is already one parameter match only tasks (no commands)
COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
}
complete -F _doit doit
|