Skip to content

Instantly share code, notes, and snippets.

@peterfpeterson
Last active August 29, 2015 13:58
Show Gist options
  • Select an option

  • Save peterfpeterson/9939905 to your computer and use it in GitHub Desktop.

Select an option

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.
# 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