Skip to content

Instantly share code, notes, and snippets.

@WMeldon
Created July 17, 2014 18:56
Show Gist options
  • Save WMeldon/19e822d30a57f48c36cd to your computer and use it in GitHub Desktop.
Save WMeldon/19e822d30a57f48c36cd to your computer and use it in GitHub Desktop.
Ember command completion for (oh-my) ZSH.
# ------------------------------------------------------------------------------
# FILE: ember.plugin.zsh
# DESCRIPTION: oh-my-zsh ember plugin file.
# AUTHOR: Will Meldon (wdmeldon@gmail.com)
# VERSION: 0.0.1
# ------------------------------------------------------------------------------
# Based (heavily) on composer.plugin.zsh
#
# Ember basic command completion
_ember_get_command_list () {
ember | sed "1,/Available commands/d" | awk '/^ember [a-z]+/ { print $2 }'
}
_ember () {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments \
'1: :->command'\
'*: :->args'
if [ -f .ember-cli ]; then
compadd `_ember_get_command_list`
else
compadd help init new update version
fi
}
compdef _ember ember
alias em='ember'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment