]>
Commit | Line | Data |
---|---|---|
e9ddea79 TW |
1 | _lsclocks_module() |
2 | { | |
3 | local cur prev OPTS | |
4 | COMPREPLY=() | |
5 | cur="${COMP_WORDS[COMP_CWORD]}" | |
6 | prev="${COMP_WORDS[COMP_CWORD-1]}" | |
7 | ||
8 | case $prev in | |
9 | '-J'|'--json') | |
10 | return 0 | |
11 | ;; | |
12 | '-n'|'--noheadings') | |
13 | return 0 | |
14 | ;; | |
15 | '-o'|'--output') | |
16 | return 0 | |
17 | ;; | |
9f59d21c TW |
18 | '--output-all') |
19 | return 0 | |
20 | ;; | |
e9ddea79 TW |
21 | '-r'|'--raw') |
22 | return 0 | |
23 | ;; | |
24 | '-t'|'--time') | |
25 | clocks="$(command "$1" --noheadings --raw --output NAME)" | |
26 | COMPREPLY=( $(compgen -W "$clocks" -- "$cur") ) | |
27 | return 0 | |
28 | ;; | |
29 | '-h'|'--help'|'-V'|'--version') | |
30 | return 0 | |
31 | ;; | |
32 | esac | |
33 | case $cur in | |
34 | -*) | |
35 | OPTS="--json | |
36 | --noheadings | |
37 | --output | |
9f59d21c | 38 | --output-all |
e9ddea79 TW |
39 | --raw |
40 | --time | |
41 | --help | |
42 | --version" | |
43 | COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) | |
44 | return 0 | |
45 | ;; | |
46 | *) | |
47 | return 0 | |
48 | ;; | |
49 | esac | |
50 | return 0 | |
51 | } | |
52 | complete -F _lsclocks_module lsclocks |