~bzr-pqm/bzr/bzr.dev

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
# -*- shell-script -*-

# experimental bzr bash completion

# author: Martin Pool

_bzr_commands() 
{
     bzr help commands | grep -v '^   '
}

_bzr() 
{
    cur=${COMP_WORDS[COMP_CWORD]}
    prev=${COMP_WORDS[COMP_CWORD-1]}
    if [ $COMP_CWORD -eq 1 ]; then
        COMPREPLY=( $( compgen -W "$(_bzr_commands)" $cur ) )
    elif [ $COMP_CWORD -eq 2 ]; then
        case "$prev" in 
        help)
            COMPREPLY=( $( compgen -W "$(_bzr_commands) commands" $cur ) )
            ;;
        esac
    fi 
}

complete -F _bzr -o default bzr