]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/getopt
rev: be careful with close()
[thirdparty/util-linux.git] / bash-completion / getopt
1 _getopt_module()
2 {
3 local cur prev OPTS
4 COMPREPLY=()
5 cur="${COMP_WORDS[COMP_CWORD]}"
6 prev="${COMP_WORDS[COMP_CWORD-1]}"
7 case $prev in
8 '-l'|'--longoptions')
9 COMPREPLY=( $(compgen -W "longopts" -- $cur) )
10 return 0
11 ;;
12 '-n'|'--name')
13 COMPREPLY=( $(compgen -W "name" -- $cur) )
14 return 0
15 ;;
16 '-o'|'--options')
17 COMPREPLY=( $(compgen -W "optstring" -- $cur) )
18 return 0
19 ;;
20 '-s'|'--shell')
21 COMPREPLY=( $(compgen -W "sh bash csh tcsh" -- $cur) )
22 return 0
23 ;;
24 '-h'|'--help'|'-V'|'--version')
25 return 0
26 ;;
27 esac
28 case $cur in
29 -*)
30 OPTS="--alternative --help --longoptions --name --options --quiet --quiet-output --shell --test --unquoted --version"
31 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
32 return 0
33 ;;
34 esac
35 return 0
36 }
37 complete -F _getopt_module getopt