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