]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/lscpu
rev: be careful with close()
[thirdparty/util-linux.git] / bash-completion / lscpu
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 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'|'--help'|'-V'|'--version')
26 return 0
27 ;;
28 esac
29 case $cur in
30 -*)
31 OPTS_ALL="--all
32 --online
33 --bytes
34 --caches
35 --offline
36 --json
37 --extended=
38 --parse=
39 --sysroot
40 --hex
41 --physical
42 --output-all
43 --help
44 --version"
45 COMPREPLY=( $(compgen -W "${OPTS_ALL[*]}" -- $cur) )
46 return 0
47 ;;
48 esac
49 local IFS=$'\n'
50 compopt -o filenames
51 COMPREPLY=( $(compgen -f -- $cur) )
52 return 0
53 }
54 complete -F _lscpu_module lscpu