| cur="${COMP_WORDS[COMP_CWORD]}" |
| prev="${COMP_WORDS[COMP_CWORD-1]}" |
| local prefix realcur CPULIST_ALL CPULIST |
| CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/offline) |
| for WORD in $(eval echo $CPULIST_ALL); do |
| if ! [[ $prefix == *"$WORD"* ]]; then |
| CPULIST="$WORD ${CPULIST:-""}" |
| COMPREPLY=( $(compgen -P "$prefix" -W "$CPULIST" -S ',' -- $realcur) ) |
| local prefix realcur CPULIST_ALL CPULIST |
| CPULIST_ALL=$(sed 's/^/{/; s/-/../g; s/,/} {/g; s/$/}/' /sys/devices/system/cpu/online) |
| for WORD in $(eval echo $CPULIST_ALL); do |
| if ! [[ $prefix == *"$WORD"* ]]; then |
| CPULIST="$WORD ${CPULIST:-""}" |
| COMPREPLY=( $(compgen -P "$prefix" -W "$CPULIST" -S ',' -- $realcur) ) |
| '-c'|'--configure'|'-g'|'--deconfigure') |
| COMPREPLY=( $(compgen -W "cpu-list" -- $cur) ) |
| COMPREPLY=( $(compgen -W "horizontal vertical" -- $cur) ) |
| '-h'|'--help'|'-V'|'--version') |
| COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) |
| complete -F _chcpu_module chcpu |