]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/lsclocks
Merge branch 'highsierra' of https://github.com/pali/util-linux
[thirdparty/util-linux.git] / bash-completion / lsclocks
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 ;;
18 '--output-all')
19 return 0
20 ;;
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 '-d'|'--dynamic-clock')
30 clocks="$(echo /dev/ptp*)"
31 COMPREPLY=( $(compgen -o filenames -W "$clocks" -- "$cur") )
32 return 0
33 ;;
34 '-x'|'--rtc')
35 clocks="$(echo /dev/rtc*)"
36 COMPREPLY=( $(compgen -o filenames -W "$clocks" -- "$cur") )
37 return 0
38 ;;
39 '-c'|'--cpu-clock')
40 _pids
41 return 0
42 ;;
43 '-h'|'--help'|'-V'|'--version')
44 return 0
45 ;;
46 esac
47 case $cur in
48 -*)
49 OPTS="--json
50 --noheadings
51 --output
52 --output-all
53 --raw
54 --time
55 --dynamic-clock
56 --rtc
57 --cpu-clock
58 --help
59 --version"
60 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
61 return 0
62 ;;
63 *)
64 return 0
65 ;;
66 esac
67 return 0
68 }
69 complete -F _lsclocks_module lsclocks