]> git.sur5r.net Git - tio/blob - src/bash-completion/tio.in
Imported Upstream version 1.18
[tio] / src / bash-completion / tio.in
1 #
2 # Bash completion script for tio.
3 #
4
5 _tio()
6 {
7     local cur prev opts base
8     COMPREPLY=()
9     cur="${COMP_WORDS[COMP_CWORD]}"
10     prev="${COMP_WORDS[COMP_CWORD-1]}"
11
12     #  The options we'll complete.
13     opts="-b --baudrate \
14           -d --databits \
15           -f --flow \
16           -s --stopbits \
17           -p --parity \
18           -o --output-delay \
19           -n --no-autoconnect \
20           -l --log \
21           -v --version \
22           -h --help"
23
24     #  Complete the arguments to the options.
25     case "${prev}" in
26         -b | --baudrate)
27             local baudrates="@BAUDRATES@"
28             COMPREPLY=( $(compgen -W "$baudrates" -- ${cur}) )
29             return 0
30             ;;
31         -d | --databits)
32             COMPREPLY=( $(compgen -W "5 6 7 8" -- ${cur}) )
33             return 0
34             ;;
35         -f | --flow)
36             COMPREPLY=( $(compgen -W "hard soft none" -- ${cur}) )
37             return 0
38             ;;
39         -s | --stopbits)
40             COMPREPLY=( $(compgen -W "1 2" -- ${cur}) )
41             return 0
42             ;;
43         -p | --parity)
44             COMPREPLY=( $(compgen -W "even odd none" -- ${cur}) )
45             return 0
46             ;;
47         -o | --output-delay)
48             COMPREPLY=( $(compgen -W "0 1 10 100" -- ${cur}) )
49             return 0
50             ;;
51         -n | --no-autoconnect)
52             COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
53             return 0
54             ;;
55         -l | --log)
56             COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
57             return 0
58             ;;
59         -v | --version)
60             COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
61             return 0
62             ;;
63         -h | --help)
64             COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
65             return 0
66             ;;
67         *)
68         ;;
69     esac
70
71    COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
72    return 0
73 }
74
75 # Bind completion to tio command
76 complete -o default -F _tio tio