~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bashcomp.py

Complete tag names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
                curOpt=${COMP_WORDS[COMP_CWORD - 1]}
83
83
                if [[ $curOpt == = ]]; then
84
84
                        curOpt=${COMP_WORDS[COMP_CWORD - 2]}
 
85
                elif [[ $cur == : ]]; then
 
86
                        cur=
 
87
                        curOpt="$curOpt:"
 
88
                elif [[ $curOpt == : ]]; then
 
89
                        curOpt=${COMP_WORDS[COMP_CWORD - 2]}:
85
90
                fi
86
91
        fi
87
92
%(debug)s
95
100
                ;;
96
101
        esac
97
102
 
98
 
        # if not typing an option, and if we don't know all the
99
 
        # possible non-option arguments for the current command,
100
 
        # then fallback on ordinary filename expansion
101
103
        if [[ -z $fixedWords ]] && [[ -z $optEnums ]] && [[ $cur != -* ]]; then
102
 
                return 0
103
 
        fi
104
 
 
105
 
        if [[ $cur == = ]] && [[ -n $optEnums ]]; then
 
104
                case $curOpt in
 
105
                        tag:*)
 
106
                                fixedWords="$(bzr tags | sed 's/  *[^ ]*$//')"
 
107
                                ;;
 
108
                esac
 
109
        elif [[ $cur == = ]] && [[ -n $optEnums ]]; then
106
110
                # complete directly after "--option=", list all enum values
107
 
                COMPREPLY=( $optEnums )
 
111
                fixedWords=$optEnums
108
112
        else
109
113
                fixedWords="$cmdOpts $globalOpts $optEnums $fixedWords"
 
114
        fi
 
115
 
 
116
        if [[ -n $fixedWords ]]; then
110
117
                COMPREPLY=( $( compgen -W "$fixedWords" -- $cur ) )
111
118
        fi
112
119