Skip to content

Instantly share code, notes, and snippets.

@drakeguan
Last active August 29, 2015 14:05
Show Gist options
  • Save drakeguan/9fbcd92aac7164b9daed to your computer and use it in GitHub Desktop.
Save drakeguan/9fbcd92aac7164b9daed to your computer and use it in GitHub Desktop.
#!/bin/bash
_invoke()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts=$(invoke -l | tail -n+3 | awk '{ print $1 }' | tr '\n' ' ')
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
}
complete -F _invoke invoke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment