irqtop: add bash-completion

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2020-02-08 16:28:52 +00:00
parent 050dc9f923
commit e11f242769
No known key found for this signature in database
GPG Key ID: 0D46FEF7E61DBB46
2 changed files with 31 additions and 0 deletions

View File

@ -45,6 +45,9 @@ endif
if BUILD_IPCS
dist_bashcompletion_DATA += bash-completion/ipcs
endif
if BUILD_IRQTOP
dist_bashcompletion_DATA += bash-completion/irqtop
endif
if BUILD_ISOSIZE
dist_bashcompletion_DATA += bash-completion/isosize
endif

28
bash-completion/irqtop Normal file
View File

@ -0,0 +1,28 @@
_irqtop_module()
{
local cur prev OPTS
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-d'|'--delay')
COMPREPLY=( $(compgen -W "secs" -- $cur) )
return 0
;;
'-s'|'--sort')
COMPREPLY=( $(compgen -W "c i n" -- $cur) )
return 0
;;
'-h'|'--help'|'-V'|'--version')
return 0
;;
esac
OPTS=" --delay
--once
--sort
--help
--version"
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
return 0
}
complete -F _irqtop_module irqtop