Skip to content

Instantly share code, notes, and snippets.

@jaytaph
Created December 6, 2012 14:34
Show Gist options
  • Save jaytaph/4224852 to your computer and use it in GitHub Desktop.
Save jaytaph/4224852 to your computer and use it in GitHub Desktop.
#!/bin/sh
_complete_console() {
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
console="${COMP_WORDS[0]}"
cmds=` ${console} | tail -n +6 | grep '^ ' | awk '{ print $1 }' `
COMPREPLY=( $(compgen -W "${cmds}" -- ${cur}) )
return 0
}
export COMP_WORDBREAKS="\ \"\\'><=;|&("
complete -F _complete_console console
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment