5 cur="${COMP_WORDS[COMP_CWORD]}"
6 prev="${COMP_WORDS[COMP_CWORD-1]}"
9 local prefix realcur CPULIST_ALL CPULIST
11 prefix="${cur%$realcur}"
12 CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/offline)
13 for WORD in $(eval echo $CPULIST_ALL); do
14 if ! [[ $prefix == *"$WORD"* ]]; then
15 CPULIST="$WORD $CPULIST"
19 COMPREPLY=( $(compgen -P "$prefix" -W "$CPULIST" -S ',' -- $realcur) )
23 local prefix realcur CPULIST_ALL CPULIST
25 prefix="${cur%$realcur}"
26 CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online)
27 for WORD in $(eval echo $CPULIST_ALL); do
28 if ! [[ $prefix == *"$WORD"* ]]; then
29 CPULIST="$WORD $CPULIST"
33 COMPREPLY=( $(compgen -P "$prefix" -W "$CPULIST" -S ',' -- $realcur) )
36 '-c'|'--configure'|'-g'|'--deconfigure')
37 COMPREPLY=( $(compgen -W "cpu-list" -- $cur) )
41 COMPREPLY=( $(compgen -W "horizontal vertical" -- $cur) )
44 '-h'|'--help'|'-V'|'--version')
56 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
59 complete -F _chcpu_module chcpu