File: licensing-completion.bash

package info (click to toggle)
licenseutils 0.0.9-8.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,672 kB
  • sloc: ansic: 26,827; sh: 6,889; makefile: 716; cpp: 348; sed: 16
file content (31 lines) | stat: -rw-r--r-- 980 bytes parent folder | download | duplicates (5)
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
# automatically generated by licenseutils 0.0.8pre
_licensing_complete()
{
    local cur prev opts moreopts
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    command=`echo ${COMP_LINE} | cut -f2 -d' '`
    moreopts=""
    if [[ "$command" == choose ]]; then
            lic=`licensing --list-all-licenses`
            sty=`licensing --list-styles`
            moreopts=`echo "$lic no-license $sty no-style" | tr '
' ' '`
    else
      moreopts=`licensing help | grep "^  [a-z]" | cut -f3 -d' ' | tr  '
,' ' '`
    fi

    if [[ "${cur}" == -* ]] ; then
        opts=`licensing help $command | egrep  "(^  -., |^      --)" | cut -c7-29 | sed -e 's/=[A-Z]* //g' | tr  '\n,' ' ' | tr -s " "`
	COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
    elif [[ "${moreopts}" != "" ]] ; then
	COMPREPLY=($(compgen -W "${moreopts}" -- "${cur}"))
    else
        COMPREPLY=()
    fi

    return 0
}
complete -F _licensing_complete licensing pssc