oh-my-zsh/plugins/pod/_pod

224 lines
4.7 KiB
Plaintext
Raw Normal View History

#compdef pod
2013-07-05 09:07:29 +00:00
#autoload
# -----------------------------------------------------------------------------
# FILE: pod.plugin.zsh
# DESCRIPTION: Cocoapods autocomplete plugin for Oh-My-Zsh
2013-07-05 09:07:29 +00:00
# http://cocoapods.org
# AUTHOR: Alexandre Joly (alexandre.joly@mekanics.ch)
# GITHUB: https://github.com/mekanics
2013-07-05 09:07:29 +00:00
# TWITTER: @jolyAlexandre
# VERSION: 0.0.1
2013-07-05 09:07:29 +00:00
# LICENSE: MIT
# -----------------------------------------------------------------------------
2013-07-05 09:07:29 +00:00
#------------------
# TODO:
# - Parameters for
# - install
# - update
# - outdated
# - search
# - list
# - push
# - podfile-info
# - setup
#------------------
local -a _1st_arguments
_1st_arguments=(
'help:Show help for the given command.'
'install:Install project dependencies'
'ipc:Inter-process communication'
'list:List pods'
'outdated:Show outdated project dependencies'
'podfile-info:Shows information on installed Pods'
'push:Push new specifications to a spec-repo'
'repo:Manage spec-repositories'
'search:Searches for pods'
'setup:Setup the CocoaPods environment'
'spec:Manage pod specs'
'update:Update outdated project dependencies'
)
2013-07-05 09:07:29 +00:00
local -a _repo_arguments
_repo_arguments=(
'add:Add a spec repo'
'lint:Validates all specs in a repo'
'update:Update a spec repo'
)
local -a _spec_arguments
_spec_arguments=(
'cat:Prints a spec file'
'create:Create spec file stub'
'edit:Edit a spec file'
'lint:Validates a spec file'
'which:Prints the path of the given spec'
)
local -a _ipc_arguments
_ipc_arguments=(
'list:Lists the specifications know to CocoaPods'
'podfile:Converts a Podfile to YAML'
'repl:The repl listens to commands on standard input'
'spec:Converts a podspec to YAML'
'update-search-index:Updates the search index'
)
local -a _list_arguments
_list_arguments=(
'new:Lists pods introduced in the master spec-repo since the last check'
)
__first_command_list ()
{
local expl
declare -a tasks
tasks=(install ipc list outdated podfile-info push repo search setup spec update)
2013-07-05 09:07:29 +00:00
_wanted tasks expl 'help' compadd $tasks
}
__repo_list() {
_wanted application expl 'command' compadd $(command ls -1 ~/.cocoapods 2>/dev/null | sed -e 's/ /\\ /g')
}
__pod-repo() {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
_describe -t commands "gem subcommand" _repo_arguments
return
;;
(options)
case $line[1] in
(update|lint)
_arguments ':feature:__repo_list'
;;
esac
;;
esac
}
__pod-spec() {
local curcontext="$curcontext" state line
typeset -A opt_args
2013-07-05 09:07:29 +00:00
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
_describe -t commands "gem subcommand" _spec_arguments
return
;;
(options)
#todo
return
;;
esac
}
__pod-ipc() {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
_describe -t commands "gem subcommand" _ipc_arguments
return
;;
(options)
#todo
return
;;
esac
}
__pod-list() {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
_describe -t commands "gem subcommand" _list_arguments
return
;;
(options)
#todo
return
;;
esac
}
2013-07-05 09:07:29 +00:00
local expl
#local -a boxes installed_boxes
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
'*::options:->options'
case $state in
(command)
_describe -t commands "gem subcommand" _1st_arguments
return
;;
(options)
case $line[1] in
(help)
_arguments ':feature:__first_command_list'
;;
2013-07-05 09:28:00 +00:00
(push)
_arguments ':feature:__repo_list'
;;
2013-07-05 09:07:29 +00:00
(repo)
__pod-repo
;;
(spec)
__pod-spec
;;
(ipc)
__pod-ipc
;;
(list)
__pod-list
;;
2013-07-05 09:28:00 +00:00
(install|outdated|podfile-info|search|setup|update)
2013-07-05 09:07:29 +00:00
#_arguments ':feature:__repo_list'
esac
;;
esac