]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/lsmem
fstrim shouldn't run inside a container
[thirdparty/util-linux.git] / bash-completion / lsmem
1 _lsmem_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 '-o'|'--output')
9 local prefix realcur OUTPUT_ALL OUTPUT
10 realcur="${cur##*,}"
11 prefix="${cur%$realcur}"
12 OUTPUT_ALL='RANGE SIZE STATE REMOVABLE BLOCK NODE ZONES'
13 for WORD in $OUTPUT_ALL; do
14 if ! [[ $prefix == *"$WORD"* ]]; then
15 OUTPUT="$WORD ${OUTPUT:-""}"
16 fi
17 done
18 compopt -o nospace
19 COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- "$realcur") )
20 return 0
21 ;;
22 '-s'|'--sysroot')
23 local IFS=$'\n'
24 compopt -o filenames
25 COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) )
26 return 0
27 ;;
28 '--summary')
29 COMPREPLY=( $(compgen -W "never always only" -- $cur) )
30 return 0
31 ;;
32 '-h'|'--help'|'-V'|'--version')
33 return 0
34 ;;
35 esac
36 OPTS="
37 --json
38 --pairs
39 --all
40 --bytes
41 --noheadings
42 --output
43 --output-all
44 --raw
45 --sysroot
46 --summary
47 --help
48 --version
49 "
50 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
51 return 0
52 }
53 complete -F _lsmem_module lsmem