Skip to content

Instantly share code, notes, and snippets.

@cizixs
Created September 2, 2013 02:28
Show Gist options
  • Select an option

  • Save cizixs/6408740 to your computer and use it in GitHub Desktop.

Select an option

Save cizixs/6408740 to your computer and use it in GitHub Desktop.
_foo()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="--help --verbose --version"
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}
complete -F _foo foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment