]> rtime.felk.cvut.cz Git - sojka/sterm.git/blob - completion.zsh
Add completions for bash and zsh
[sojka/sterm.git] / completion.zsh
1 #compdef sterm
2 #autoload
3
4 _sterm_defs() {
5         _arguments : \
6                 "--help[Output help message]" \
7                 "-h[Print help text]" \
8                 "-s[Set baudrate]" \
9                 "-c[Enter command mode]" \
10                 "-d[Make pulse on DTR]" \
11                 "-r[Make pulse on RTS]" \
12                 "-e[Ignore '~.' escape sequence]" \
13                 "-n[Do not switch the device to raw mode]" \
14                 "-v[Verbose mode]"
15         _path_files
16 }
17
18 _sterm() {
19         if (( CURRENT > 2)); then
20                 local prev=${words[(( CURRENT - 1))]}
21                 case "${prev}" in
22                         -d|-r)
23                                 # No completion for these
24                                 ;;
25                         -s)
26                                 _values "Baudrate" \
27                                         "0" \
28                                         "50" \
29                                         "75" \
30                                         "110" \
31                                         "134" \
32                                         "150" \
33                                         "200" \
34                                         "300" \
35                                         "600" \
36                                         "1200" \
37                                         "1800" \
38                                         "2400" \
39                                         "4800" \
40                                         "9600" \
41                                         "19200" \
42                                         "38400" \
43                                         "57600" \
44                                         "115200" \
45                                         "230400"
46                                 ;;
47                         *)
48                                 _sterm_defs
49                                 ;;
50                 esac
51         else
52                 _sterm_defs
53         fi
54 }
55
56 _sterm