Last active
August 29, 2015 13:58
-
-
Save peterfpeterson/9939905 to your computer and use it in GitHub Desktop.
Bash completion for nanoc. This really is just some of the commands that I use.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # bash completion for nanoc -*- shell-script -*- | |
| _nanoc() | |
| { | |
| local cur prev words cword | |
| _gst_init_completion -n = || return | |
| COMPREPLY=( $( compgen -W "compile create view" -- "$cur") ) | |
| } && | |
| complete -F _nanoc nanoc | |
| _gst_init_completion() { | |
| if type _get_comp_words_by_ref &>/dev/null; then | |
| # Available since bash-completion 1.2 | |
| _get_comp_words_by_ref cur cword prev words | |
| else | |
| # bash-completion not installed or too old. Use bash's raw facilities. | |
| # This won't complete properly if the cursor is in the middle of a | |
| # word. | |
| cur="${COMP_WORDS[COMP_CWORD]}" | |
| prev="${COMP_WORDS[COMP_CWORD-1]}" | |
| cword=$COMP_CWORD | |
| words=("${COMP_WORDS[@]}") | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment