]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/lsirq
Merge branch 'setpriv/completion' of https://github.com/t-8ch/util-linux
[thirdparty/util-linux.git] / bash-completion / lsirq
1 _lsirq_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
10 realcur="${cur##*,}"
11 prefix="${cur%$realcur}"
12 for WORD in "IRQ TOTAL NAME"; do
13 if ! [[ $prefix == *"$WORD"* ]]; then
14 OUTPUT="$WORD ${OUTPUT:-""}"
15 fi
16 done
17 compopt -o nospace
18 COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
19 return 0
20 ;;
21 '-s'|'--sort')
22 COMPREPLY=( $(compgen -W "irq total name" -- $cur) )
23 return 0
24 ;;
25 '-h'|'--help'|'-V'|'--version')
26 return 0
27 ;;
28 esac
29 OPTS=" --json
30 --pairs
31 --noheadings
32 --output
33 --softirq
34 --sort
35 --help
36 --version"
37 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
38 return 0
39 }
40 complete -F _lsirq_module lsirq