Debian Codegraph @

bash-completion/zramctl

raw
1 _zramctl_module()
2 {
3 local cur prev OPTS
4 COMPREPLY=()
5 cur="${COMP_WORDS[COMP_CWORD]}"
6 prev="${COMP_WORDS[COMP_CWORD-1]}"
7 case $prev in
8 '-a'|'--algorithm')
9 COMPREPLY=( $(compgen -W "lzo lz4 lz4hc deflate 842" -- $cur) )
10 return 0
11 ;;
12 '-o'|'--output')
13 local prefix realcur OUTPUT_ALL OUTPUT
14 realcur="${cur##*,}"
15 prefix="${cur%$realcur}"
16 OUTPUT_ALL="NAME DISKSIZE DATA COMPR ALGORITHM
17 STREAMS ZERO-PAGES TOTAL MEM-LIMIT MEM-USED
18 MIGRATED MOUNTPOINT"
19 for WORD in $OUTPUT_ALL; do
20 if ! [[ $prefix == *"$WORD"* ]]; then
21 OUTPUT="$WORD ${OUTPUT:-""}"
22 fi
23 done
24 compopt -o nospace
25 COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
26 return 0
27 ;;
28 '-s'|'--size')
29 COMPREPLY=( $(compgen -W "size" -- $cur) )
30 return 0
31 ;;
32 '-t'|'--streams')
33 COMPREPLY=( $(compgen -W "number" -- $cur) )
34 return 0
35 ;;
36 esac
37 case $cur in
38 -*)
39 OPTS=" --algorithm
40 --algorithm-params
41 --bytes
42 --find
43 --noheadings
44 --output
45 --output-all
46 --raw
47 --reset
48 --size
49 --streams
50 --help
51 --version"
52 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
53 return 0
54 ;;
55 esac
56 local IFS=$'\n'
57 compopt -o filenames
58 COMPREPLY=( $(compgen -f -- ${cur:-"/dev/zram"}) )
59 return 0
60 }
61 complete -F _zramctl_module zramctl