mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-26 10:13:37 +08:00
1d636fe8ab
pod-lib removed. whyever I described it...
220 lines
4.6 KiB
Plaintext
220 lines
4.6 KiB
Plaintext
#compdef pod
|
|
#autoload
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# FILE: pod.plugin.zsh
|
|
# DESCRIPTION: Cocoapods autocomplete plugin for Oh-My-Zsh
|
|
# http://cocoapods.org
|
|
# AUTHOR: Alexandre Joly (alexandre.joly@mekanics.ch)
|
|
# GITHUB: https://github.com/mekanics
|
|
# TWITTER: @jolyAlexandre
|
|
# VERSION: 0.0.1
|
|
# LICENSE: MIT
|
|
# -----------------------------------------------------------------------------
|
|
|
|
#------------------
|
|
# 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'
|
|
)
|
|
|
|
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)
|
|
|
|
_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
|
|
|
|
_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
|
|
}
|
|
|
|
|
|
|
|
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'
|
|
;;
|
|
|
|
(repo)
|
|
__pod-repo
|
|
;;
|
|
|
|
(spec)
|
|
__pod-spec
|
|
;;
|
|
|
|
(ipc)
|
|
__pod-ipc
|
|
;;
|
|
|
|
(list)
|
|
__pod-list
|
|
;;
|
|
|
|
(install|outdated|podfile-info|push|search|setup|update)
|
|
#_arguments ':feature:__repo_list'
|
|
esac
|
|
;;
|
|
esac
|