]>
Commit | Line | Data |
---|---|---|
c6f8c3f5 SK |
1 | _lscpu_module() |
2 | { | |
b5b80e5a | 3 | local cur OPTS_ALL |
c6f8c3f5 SK |
4 | COMPREPLY=() |
5 | cur="${COMP_WORDS[COMP_CWORD]}" | |
6 | prev="${COMP_WORDS[COMP_CWORD-1]}" | |
7 | case $prev in | |
b5b80e5a BE |
8 | '--extended='|'=') |
9 | local prefix realcur OPTS | |
c6f8c3f5 | 10 | cur=${cur#=} |
b5b80e5a BE |
11 | realcur="${cur##*,}" |
12 | prefix="${cur%$realcur}" | |
13 | OPTS_ALL="CPU CORE SOCKET NODE | |
d092911b | 14 | BOOK DRAWER CACHE POLARIZATION ADDRESS |
bcce334d | 15 | CONFIGURED ONLINE MAXMHZ MINMHZ" |
b5b80e5a BE |
16 | for WORD in $OPTS_ALL; do |
17 | if ! [[ $prefix == *"$WORD"* ]]; then | |
c6f0bdfe | 18 | OPTS="$WORD ${OPTS:-""}" |
b5b80e5a BE |
19 | fi |
20 | done | |
c6f8c3f5 | 21 | compopt -o nospace |
b5b80e5a | 22 | COMPREPLY=( $(compgen -P "$prefix" -W "$OPTS" -S ',' -- $realcur) ) |
c6f8c3f5 SK |
23 | return 0 |
24 | ;; | |
d4f9b8d7 VS |
25 | '-h'|'--help'|'-V'|'--version') |
26 | return 0 | |
27 | ;; | |
c6f8c3f5 SK |
28 | esac |
29 | case $cur in | |
30 | -*) | |
b5b80e5a | 31 | OPTS_ALL="--all |
0d5b9b8a | 32 | --online |
ba5e7b7e SK |
33 | --bytes |
34 | --caches | |
0d5b9b8a | 35 | --offline |
d092911b | 36 | --json |
0d5b9b8a VS |
37 | --extended= |
38 | --parse= | |
39 | --sysroot | |
40 | --hex | |
d092911b | 41 | --physical |
fbf0619b | 42 | --output-all |
0d5b9b8a VS |
43 | --help |
44 | --version" | |
b5b80e5a | 45 | COMPREPLY=( $(compgen -W "${OPTS_ALL[*]}" -- $cur) ) |
c6f8c3f5 SK |
46 | return 0 |
47 | ;; | |
48 | esac | |
ce3e6b15 | 49 | local IFS=$'\n' |
c6f8c3f5 SK |
50 | compopt -o filenames |
51 | COMPREPLY=( $(compgen -f -- $cur) ) | |
52 | return 0 | |
53 | } | |
54 | complete -F _lscpu_module lscpu |