Skip to content

Instantly share code, notes, and snippets.

@wojtuss
Last active February 14, 2017 08:27
Show Gist options
  • Save wojtuss/e5b8a276382c12cad0989ff0d88af88d to your computer and use it in GitHub Desktop.
Save wojtuss/e5b8a276382c12cad0989ff0d88af88d to your computer and use it in GitHub Desktop.
pmempool bash auto-complete
# A script for pmempool command auto-completion in bash.
# Put it into /etc/bash_completion.d directory and load it by running
# . /etc/bash_completion.d/pmempool
_pmempool()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="info create dump check rm convert sync transform"
opts_h="$opts help"
case "${prev}" in
info)
;&
create)
;&
dump)
;&
check)
;&
rm)
;&
convert)
;&
sync)
;&
transform)
_filedir
return 0
;;
help)
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
*)
;;
esac
COMPREPLY=( $(compgen -W "${opts_h}" -- ${cur}) )
return 0
}
complete -F _pmempool pmempool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment