summaryrefslogtreecommitdiff
path: root/community/fossil/bash.completion
blob: 63bb9f15b21361b46d063c465fe6583893697a1d (plain)
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
_fossil()
{
local cur prev opts

#Var used by BASH
COMPREPLY=()
#word we are trying to complete
cur="${COMP_WORDS[COMP_CWORD]}"
#word before the one we're trying to complete
prev="${COMP_WORDS[COMP_CWORD-1]}"
#list of word that fossil know
opts="add addremove all annotate bisect branch cat changes checkout "
opts="$opts ci clean clone close co commit delete diff export extras "
opts="$opts finfo gdiff help import info init ls merge mv new open "
opts="$opts pull push rebuild remote-url revert rm settings sqlite3 "
opts="$opts stash status sync tag timeline ui undo unset update version"

case "${prev}" in
add) opts="--dotfiles --ignore" ;;
addremove) opts="--dotfiles --ignore --test" ;;
all) opts="list ls pull push rebuild sync" ;;
annotate) opts="--limit --log --filevers" ;;
bisect) opts="bad good next options reset vlist" ;;
branch) opts="list ls -R --repository" ;;
merge) opts="--nochange -n --force -f --detail"
esac

compopt -o filenames
COMPREPLY=($(compgen -fW "${opts}" -- "${cur}") \
$(compgen -d -- "$cur"))
}

complete -F _fossil fossil