/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to contrib/bash/bzr

  • Committer: mernst at mit
  • Date: 2008-10-16 10:57:16 UTC
  • mto: This revision was merged to the branch mainline in revision 3799.
  • Revision ID: mernst@csail.mit.edu-20081016105716-v8x8n5t2pf7f6uds
Improved documentation of stacked and lightweight branches

These patches improve the User Guide's documentation of stacked and
lightweight branches.

Section "1.2.6 Putting the concepts together" should mention stacked
branches and the difference between them and lightweight branches.  It
should also contain links to further details of the common scenarios.

Section "5.3.4 Getting a lightweight checkout" should mention stacked
branches as an option, and should link to all the options, not just some of
them.  It should also clarify that lightweight only applies to checkouts,
not to arbitrary branches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Programmable completion for the Bazaar-NG bzr command under bash. Source
 
2
# this file (or on some systems add it to ~/.bash_completion and start a new
 
3
# shell) and bash's completion mechanism will know all about bzr's options!
 
4
 
 
5
# Known to work with bash 2.05a with programmable completion and extended
 
6
# pattern matching enabled (use 'shopt -s extglob progcomp' to enable
 
7
# these if they are not already enabled).
 
8
 
 
9
# Based originally on the svn bash completition script.
 
10
# Customized by Sven Wilhelm/Icecrash.com
 
11
 
 
12
_bzr ()
 
13
{
 
14
        local cur cmds cmdOpts opt helpCmds optBase i
 
15
 
 
16
        COMPREPLY=()
 
17
        cur=${COMP_WORDS[COMP_CWORD]}
 
18
 
 
19
        cmds='status diff commit ci checkin move remove log info check ignored'
 
20
 
 
21
        if [[ $COMP_CWORD -eq 1 ]] ; then
 
22
                COMPREPLY=( $( compgen -W "$cmds" -- $cur ) )
 
23
                return 0
 
24
        fi
 
25
 
 
26
        # if not typing an option, or if the previous option required a
 
27
        # parameter, then fallback on ordinary filename expansion
 
28
        helpCmds='help|--help|h|\?'
 
29
        if [[ ${COMP_WORDS[1]} != @($helpCmds) ]] && \
 
30
           [[ "$cur" != -* ]] ; then
 
31
                return 0
 
32
        fi
 
33
 
 
34
        cmdOpts=
 
35
        case ${COMP_WORDS[1]} in
 
36
        status)
 
37
                cmdOpts="--all --show-ids"
 
38
                ;;
 
39
        diff)
 
40
                cmdOpts="-r --revision --diff-options"
 
41
                ;;
 
42
        commit|ci|checkin)
 
43
                cmdOpts="-r --message -F --file -v --verbose"
 
44
                ;;
 
45
        move)
 
46
                cmdOpts=""
 
47
                ;;
 
48
        remove)
 
49
                cmdOpts="-v --verbose"
 
50
                ;;
 
51
        log)
 
52
                cmdOpts="--forward --timezone -v --verbose --show-ids -r --revision"
 
53
                ;;
 
54
        info)
 
55
                cmdOpts=""
 
56
                ;;
 
57
        ignored)
 
58
                cmdOpts=""
 
59
                ;;
 
60
        check)
 
61
                cmdOpts=""
 
62
                ;;
 
63
        help|h|\?)
 
64
                cmdOpts="$cmds $qOpts"
 
65
                ;;
 
66
        *)
 
67
                ;;
 
68
        esac
 
69
 
 
70
        cmdOpts="$cmdOpts --help -h"
 
71
 
 
72
        # take out options already given
 
73
        for (( i=2; i<=$COMP_CWORD-1; ++i )) ; do
 
74
                opt=${COMP_WORDS[$i]}
 
75
 
 
76
                case $opt in
 
77
                --*)    optBase=${opt/=*/} ;;
 
78
                -*)     optBase=${opt:0:2} ;;
 
79
                esac
 
80
 
 
81
                cmdOpts=" $cmdOpts "
 
82
                cmdOpts=${cmdOpts/ ${optBase} / }
 
83
 
 
84
                # take out alternatives
 
85
                case $optBase in
 
86
                -v)              cmdOpts=${cmdOpts/ --verbose / } ;;
 
87
                --verbose)       cmdOpts=${cmdOpts/ -v / } ;;
 
88
                -h)              cmdOpts=${cmdOpts/ --help / } ;;
 
89
                --help)          cmdOpts=${cmdOpts/ -h / } ;;
 
90
                -r)              cmdOpts=${cmdOpts/ --revision / } ;;
 
91
                --revision)      cmdOpts=${cmdOpts/ -r / } ;;
 
92
                esac
 
93
 
 
94
                # skip next option if this one requires a parameter
 
95
                if [[ $opt == @($optsParam) ]] ; then
 
96
                        ((++i))
 
97
                fi
 
98
        done
 
99
 
 
100
        COMPREPLY=( $( compgen -W "$cmdOpts" -- $cur ) )
 
101
 
 
102
        return 0
 
103
}
 
104
complete -F _bzr -o default bzr