| cur="${COMP_WORDS[COMP_CWORD]}" |
| prev="${COMP_WORDS[COMP_CWORD-1]}" |
| COMPREPLY=( $(compgen -W "lzo lz4 lz4hc deflate 842" -- $cur) ) |
| local prefix realcur OUTPUT_ALL OUTPUT |
| OUTPUT_ALL="NAME DISKSIZE DATA COMPR ALGORITHM |
| STREAMS ZERO-PAGES TOTAL MEM-LIMIT MEM-USED |
| for WORD in $OUTPUT_ALL; do |
| if ! [[ $prefix == *"$WORD"* ]]; then |
| OUTPUT="$WORD ${OUTPUT:-""}" |
| COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) |
| COMPREPLY=( $(compgen -W "size" -- $cur) ) |
| COMPREPLY=( $(compgen -W "number" -- $cur) ) |
| COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) |
| COMPREPLY=( $(compgen -f -- ${cur:-"/dev/zram"}) ) |
| complete -F _zramctl_module zramctl |