File: glance.bash_completion

package info (click to toggle)
python-glanceclient 1%3A2.5.0-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,228 kB
  • ctags: 1,620
  • sloc: python: 12,742; sh: 151; makefile: 36
file content (25 lines) | stat: -rw-r--r-- 882 bytes parent folder | download | duplicates (6)
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
_glance_opts="" # lazy init
_glance_flags="" # lazy init
_glance_opts_exp="" # lazy init
_glance()
{
    local cur prev nbc cflags
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    if [ "x$_glance_opts" == "x" ] ; then
        nbc="`glance bash-completion | sed -e "s/  *-h  */ /" -e "s/  *-i  */ /"`"
        _glance_opts="`echo "$nbc" | sed -e "s/--[a-z0-9_-]*//g" -e "s/  */ /g"`"
        _glance_flags="`echo " $nbc" | sed -e "s/ [^-][^-][a-z0-9_-]*//g" -e "s/  */ /g"`"
        _glance_opts_exp="`echo "$_glance_opts" | sed 's/^ *//' | tr ' ' '|'`"
    fi

    if [[ " ${COMP_WORDS[@]} " =~ " "($_glance_opts_exp)" " && "$prev" != "help" ]] ; then
        COMPREPLY=($(compgen -W "${_glance_flags}" -- ${cur}))
    else
        COMPREPLY=($(compgen -W "${_glance_opts}" -- ${cur}))
    fi
    return 0
}
complete -F _glance glance