|
1
|
# Command name completion for Fossil. |
|
2
|
# Mailing-list contribution by Stuart Rackham. |
|
3
|
function _fossil() { |
|
4
|
local cur commands |
|
5
|
cur=${COMP_WORDS[COMP_CWORD]} |
|
6
|
commands=$(fossil help --all) |
|
7
|
if [ $COMP_CWORD -eq 1 ] || [ ${COMP_WORDS[1]} = help ]; then |
|
8
|
# Command name completion for 1st argument or 2nd if help command. |
|
9
|
COMPREPLY=( $(compgen -W "$commands" $cur) ) |
|
10
|
else |
|
11
|
# File name completion for other arguments. |
|
12
|
COMPREPLY=( $(compgen -f $cur{}) ) |
|
13
|
fi |
|
14
|
} |
|
15
|
complete -o default -F _fossil fossil f |
|
16
|
|