Created
March 14, 2014 21:24
-
-
Save rummelonp/9557293 to your computer and use it in GitHub Desktop.
Berkshelf の zsh 補完
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
#compdef berks | |
# ------------------------------------------------------------------------------ | |
# Description | |
# ----------- | |
# | |
# Completion script for Berkshelf (http://berkshelf.com/). | |
# | |
# ------------------------------------------------------------------------------ | |
# Authors | |
# ------- | |
# | |
# * Kazuya Takeshima (https://github.com/mitukiii) | |
# | |
# ------------------------------------------------------------------------------ | |
local context state line curcontext="$curcontext" | |
_arguments -C \ | |
': :->command' \ | |
'*: :->options' | |
case "$state" in | |
command) | |
local -a commands | |
commands=( | |
apply'[Apply the cookbook version locks from Berksfile.lock to a Chef environment]' | |
configure'[Create a new Berkshelf configuration file]' | |
contingent'[List all cookbooks that depend on the given cookbook]' | |
cookbook'[Create a skeleton for a new cookbook]' | |
help'[Describe available commands or one specific command]' | |
init'[Initialize Berkshelf in the given directory]' | |
install'[Install the cookbooks specified in the Berksfile]' | |
list'[List all cookbooks (and dependencies) specified in the Berksfile]' | |
outdated'[Show outdated cookbooks (from the community site)]' | |
package'[Package a cookbook (and dependencies) as a tarball]' | |
shelf'[Interact with the cookbook store]' | |
show'[Display name, author, copyright, and dependency information about a cookbook]' | |
update'[Update the cookbooks (and dependencies) specified in the Berksfile]' | |
upload'[Upload the cookbook specified in the Berksfile to the Chef Server]' | |
version'[Display version and copyright information]' | |
) | |
_values 'command' $commands | |
;; | |
options) | |
case "$words[2]" in | |
init) | |
_directories | |
;; | |
help) | |
_message 'COMMAND' | |
;; | |
shelf) | |
_message 'SUBCOMMAND' | |
;; | |
apply) | |
_message 'ENVIRONMENT' | |
;; | |
cookbook) | |
_message 'NAME' | |
;; | |
contingent|package|show) | |
_message 'COOKBOOK' | |
;; | |
outdated|update|upload) | |
_message 'COOKBOOKS' | |
;; | |
*) | |
_nothing | |
;; | |
esac | |
;; | |
esac | |
# Local Variables: | |
# mode: Shell-Script | |
# sh-indentation: 2 | |
# indent-tabs-mode: nil | |
# sh-basic-offset: 2 | |
# End: | |
# vim: ft=zsh sw=2 ts=2 et |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment