From 2916ef719444040528ffd1a56d91bdd1fb1b5aa5 Mon Sep 17 00:00:00 2001 From: Michael Nikitochkin Date: Mon, 25 Mar 2013 18:57:55 +0200 Subject: [PATCH 01/23] Use new style of rails command. --- plugins/rails3/rails3.plugin.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/rails3/rails3.plugin.zsh b/plugins/rails3/rails3.plugin.zsh index 237d0594b..5ebaf32e3 100644 --- a/plugins/rails3/rails3.plugin.zsh +++ b/plugins/rails3/rails3.plugin.zsh @@ -4,7 +4,11 @@ function _rails_command () { if [ -e "script/server" ]; then ruby script/$@ else - ruby script/rails $@ + if [ -e "bin/rails" ]; then + bin/rails $@ + else + rails $@ + fi fi } From cf3a03d45e6b4eb642238bbd7b6aeca1fd1bc868 Mon Sep 17 00:00:00 2001 From: simlegate Date: Sun, 5 May 2013 16:35:40 +0800 Subject: [PATCH 02/23] rm alias gcm='git checkout master' and add alias gcm='git commit -m' --- plugins/git/git.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 6c016aa6b..5277abc99 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -22,9 +22,10 @@ alias gca='git commit -v -a' compdef _git gc=git-commit alias gca!='git commit -v -a --amend' compdef _git gca!=git-commit +alias gcm='git commit -m' +compdef _git gcm=git-commit alias gco='git checkout' compdef _git gco=git-checkout -alias gcm='git checkout master' alias gr='git remote' compdef _git gr=git-remote alias grv='git remote -v' From b36c42b76d5bb06e1a19b534177ad4980bc3b025 Mon Sep 17 00:00:00 2001 From: simlegate Date: Wed, 8 May 2013 17:03:07 +0800 Subject: [PATCH 03/23] rename gcm to gcmsg and stand for 'git commit -m' --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 5277abc99..bcbd0897c 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -22,7 +22,7 @@ alias gca='git commit -v -a' compdef _git gc=git-commit alias gca!='git commit -v -a --amend' compdef _git gca!=git-commit -alias gcm='git commit -m' +alias gcmsg='git commit -m' compdef _git gcm=git-commit alias gco='git checkout' compdef _git gco=git-checkout From 29e696d902b4cf665e237969aa333a5e176a59f5 Mon Sep 17 00:00:00 2001 From: simlegate Date: Wed, 8 May 2013 17:03:07 +0800 Subject: [PATCH 04/23] rename gcm to gcmsg and stand for 'git commit -m' #1790 --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 5277abc99..bcbd0897c 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -22,7 +22,7 @@ alias gca='git commit -v -a' compdef _git gc=git-commit alias gca!='git commit -v -a --amend' compdef _git gca!=git-commit -alias gcm='git commit -m' +alias gcmsg='git commit -m' compdef _git gcm=git-commit alias gco='git checkout' compdef _git gco=git-checkout From 22dce9e71594d1cf191cd41cef845a34621826f8 Mon Sep 17 00:00:00 2001 From: simlegate Date: Thu, 9 May 2013 12:57:32 +0800 Subject: [PATCH 05/23] add git alias 'gcmsg' and stand for 'git commit -m' --- plugins/git/git.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index bcbd0897c..b30c4b99a 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -23,9 +23,10 @@ compdef _git gc=git-commit alias gca!='git commit -v -a --amend' compdef _git gca!=git-commit alias gcmsg='git commit -m' -compdef _git gcm=git-commit +compdef _git gcmsg=git-commit alias gco='git checkout' compdef _git gco=git-checkout +alias gcm='git checkout master' alias gr='git remote' compdef _git gr=git-remote alias grv='git remote -v' From c26facb582eed3b63642665864258862aa49392b Mon Sep 17 00:00:00 2001 From: Alexandre Joly Date: Fri, 5 Jul 2013 00:58:05 +0200 Subject: [PATCH 06/23] first few lines for the autocompletion of cocoapods --- plugins/pod/_pod | 82 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 plugins/pod/_pod diff --git a/plugins/pod/_pod b/plugins/pod/_pod new file mode 100644 index 000000000..2c183635d --- /dev/null +++ b/plugins/pod/_pod @@ -0,0 +1,82 @@ +#compdef pod + +# ----------------------------------------------------------------------------- +# FILE: pod.plugin.zsh +# DESCRIPTION: Cocoapods autocomplete plugin for Oh-My-Zsh +# AUTHOR: Alexandre Joly (alexandre.joly@mekanics.ch) +# GITHUB: https://github.com/mekanics +# VERSION: 0.0.1 +# ----------------------------------------------------------------------------- + +_pod_all_repos() { + repos=(`ls ~/.cocoapods`) +} + +local -a _1st_arguments +_1st_arguments=( + 'help:Show help for the given command.' + 'install:Install project dependencies' + 'ipc:Inter-process communication' + 'lib:Develop pods' + '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' +) + +_arguments '*:: :->command' + +if (( CURRENT == 1 )); then + _describe -t commands "pod command" _1st_arguments + return +fi + +local -a _command_args +case "$words[1]" in + install) + _command_args=( + '(--no-clean)--no-clean[Leave SCM dirs like `.git` and `.svn` intact after downloading]' \ + '(--no-integrate)--no-integrate[Skip integration of the Pods libraries in the Xcode project(s)]' \ + '(--no-repo-update)--no-repo-update[Skip running `pod repo update before install]' + ) + ;; + update) + _command_args=( + '(--no-clean)--no-clean[Leave SCM dirs like `.git` and `.svn intact after downloading]' \ + '(--no-integrate)--no-integrate[Skip integration of the Pods libraries in the Xcode project(s)]' \ + '(--no-repo-update)--no-repo-update[Skip running `pod repo update before install]' + ) + ;; + outdated) + _command_args=( + '(--no-repo-update)--no-repo-update[Skip running `pod repo update before install]' + ) + ;; + search) + _command_args=( + '(--full)--full[Search by name, summary, and description]' \ + '(--stats)--stats[Show additional stats (like GitHub watchers and forks)]' \ + '(--ios)--ios[Restricts the search to Pods supported on iOS]' \ + '(--osx)--osx[Restricts the search to Pods supported on OS X]' + ) + ;; + update) + _command_args=( + '(--update)--update[Run `pod repo update before listing]' + ) + ;; +esac + +_arguments \ + $_command_args \ + '(--silent)--silent[Show nothing]' \ + '(--version)--version[Show the version of CocoaPods]' \ + '(--no-color)--no-color[Show output without color]' \ + '(--verbose)--verbose[Show more debugging information]' \ + '(--help)--help[Show help banner of specified command]' \ + && return 0 \ No newline at end of file From cf5ca2f4f3e6d98a4d4d4938be0e421645722fb2 Mon Sep 17 00:00:00 2001 From: Alexandre Joly Date: Fri, 5 Jul 2013 11:07:29 +0200 Subject: [PATCH 07/23] commands and subcommands --- plugins/pod/_pod | 219 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 168 insertions(+), 51 deletions(-) diff --git a/plugins/pod/_pod b/plugins/pod/_pod index 2c183635d..ce8882d42 100644 --- a/plugins/pod/_pod +++ b/plugins/pod/_pod @@ -1,16 +1,29 @@ #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 # ----------------------------------------------------------------------------- -_pod_all_repos() { - repos=(`ls ~/.cocoapods`) -} +#------------------ +# TODO: +# - Parameters for +# - install +# - update +# - outdated +# - search +# - list +# - push +# - podfile-info +# - setup +#------------------ local -a _1st_arguments _1st_arguments=( @@ -29,54 +42,158 @@ _1st_arguments=( 'update:Update outdated project dependencies' ) -_arguments '*:: :->command' +local -a _repo_arguments +_repo_arguments=( + 'add:Add a spec repo' + 'lint:Validates all specs in a repo' + 'update:Update a spec repo' +) -if (( CURRENT == 1 )); then - _describe -t commands "pod command" _1st_arguments - return -fi +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 _command_args -case "$words[1]" in - install) - _command_args=( - '(--no-clean)--no-clean[Leave SCM dirs like `.git` and `.svn` intact after downloading]' \ - '(--no-integrate)--no-integrate[Skip integration of the Pods libraries in the Xcode project(s)]' \ - '(--no-repo-update)--no-repo-update[Skip running `pod repo update before install]' - ) - ;; - update) - _command_args=( - '(--no-clean)--no-clean[Leave SCM dirs like `.git` and `.svn intact after downloading]' \ - '(--no-integrate)--no-integrate[Skip integration of the Pods libraries in the Xcode project(s)]' \ - '(--no-repo-update)--no-repo-update[Skip running `pod repo update before install]' - ) - ;; - outdated) - _command_args=( - '(--no-repo-update)--no-repo-update[Skip running `pod repo update before install]' - ) - ;; - search) - _command_args=( - '(--full)--full[Search by name, summary, and description]' \ - '(--stats)--stats[Show additional stats (like GitHub watchers and forks)]' \ - '(--ios)--ios[Restricts the search to Pods supported on iOS]' \ - '(--osx)--osx[Restricts the search to Pods supported on OS X]' - ) - ;; - update) - _command_args=( - '(--update)--update[Run `pod repo update before listing]' - ) - ;; +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 lib 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 +} + + + +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|lib|outdated|podfile-info|push|search|setup|update) + #_arguments ':feature:__repo_list' + esac + ;; esac - -_arguments \ - $_command_args \ - '(--silent)--silent[Show nothing]' \ - '(--version)--version[Show the version of CocoaPods]' \ - '(--no-color)--no-color[Show output without color]' \ - '(--verbose)--verbose[Show more debugging information]' \ - '(--help)--help[Show help banner of specified command]' \ - && return 0 \ No newline at end of file From 1d636fe8ab4a7258eddbe120d462cdda3d8adbaf Mon Sep 17 00:00:00 2001 From: Alexandre Joly Date: Fri, 5 Jul 2013 11:17:33 +0200 Subject: [PATCH 08/23] pod-list pod-lib removed. whyever I described it... --- plugins/pod/_pod | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/plugins/pod/_pod b/plugins/pod/_pod index ce8882d42..1decb8872 100644 --- a/plugins/pod/_pod +++ b/plugins/pod/_pod @@ -30,7 +30,6 @@ _1st_arguments=( 'help:Show help for the given command.' 'install:Install project dependencies' 'ipc:Inter-process communication' - 'lib:Develop pods' 'list:List pods' 'outdated:Show outdated project dependencies' 'podfile-info:Shows information on installed Pods' @@ -77,7 +76,7 @@ __first_command_list () local expl declare -a tasks - tasks=(install ipc lib list outdated podfile-info push repo search setup spec update) + tasks=(install ipc list outdated podfile-info push repo search setup spec update) _wanted tasks expl 'help' compadd $tasks } @@ -152,6 +151,27 @@ __pod-ipc() { 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 @@ -192,7 +212,7 @@ case $state in __pod-list ;; - (install|lib|outdated|podfile-info|push|search|setup|update) + (install|outdated|podfile-info|push|search|setup|update) #_arguments ':feature:__repo_list' esac ;; From c48822b3a3a3f25922c184d1804fc11aea2b6432 Mon Sep 17 00:00:00 2001 From: Alexandre Joly Date: Fri, 5 Jul 2013 11:28:00 +0200 Subject: [PATCH 09/23] show repos on pod push --- plugins/pod/_pod | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/pod/_pod b/plugins/pod/_pod index 1decb8872..78644745b 100644 --- a/plugins/pod/_pod +++ b/plugins/pod/_pod @@ -196,6 +196,10 @@ case $state in _arguments ':feature:__first_command_list' ;; + (push) + _arguments ':feature:__repo_list' + ;; + (repo) __pod-repo ;; @@ -212,7 +216,7 @@ case $state in __pod-list ;; - (install|outdated|podfile-info|push|search|setup|update) + (install|outdated|podfile-info|search|setup|update) #_arguments ':feature:__repo_list' esac ;; From 0892bce00b73fdf75d70e554b1fd64ae0fd5e61a Mon Sep 17 00:00:00 2001 From: Alexandre Joly Date: Tue, 9 Jul 2013 14:41:41 +0200 Subject: [PATCH 10/23] supplemented with options --- plugins/pod/_pod | 239 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 197 insertions(+), 42 deletions(-) diff --git a/plugins/pod/_pod b/plugins/pod/_pod index 78644745b..bb4f782b3 100644 --- a/plugins/pod/_pod +++ b/plugins/pod/_pod @@ -12,19 +12,6 @@ # 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.' @@ -71,6 +58,92 @@ _list_arguments=( 'new:Lists pods introduced in the master spec-repo since the last check' ) +local -a _inherited_options +_inherited_options=( + '(--silent)--silent[Show nothing]' \ + '(--version)--version[Show the version of CocoaPods]' \ + '(--no-color)--no-color[Show output without color]' \ + '(--verbose)--verbose[Show more debugging information]' \ + '(--help)--help[Show help banner of specified command]' +) + +local -a _install_options +_install_options=( + '(--no-clean)--no-clean[Leave SCM dirs like `.git` and `.svn` intact after downloading]' \ + '(--no-integrate)--no-integrate[Skip integration of the Pods libraries in the Xcode project(s)]' \ + '(--no-repo-update)--no-repo-update[Skip running `pod repo update` before install]' +) + +local -a _update_options +_update_options=( + '(--no-clean)--no-clean[Leave SCM dirs like `.git` and `.svn intact after downloading]' \ + '(--no-integrate)--no-integrate[Skip integration of the Pods libraries in the Xcode project(s)]' \ + '(--no-repo-update)--no-repo-update[Skip running `pod repo update before install]' +) + +local -a _outdated_options +_outdated_options=( + '(--no-repo-update)--no-repo-update[Skip running `pod repo update` before install]' +) + +local -a _search_options +_search_options=( + '(--full)--full[Search by name, summary, and description]' \ + '(--stats)--stats[Show additional stats (like GitHub watchers and forks)]' \ + '(--ios)--ios[Restricts the search to Pods supported on iOS]' \ + '(--osx)--osx[Restricts the search to Pods supported on OS X]' +) + +local -a _list_options +_list_options=( + '(--update)--update[Run `pod repo update` before listing]' +) + +local -a _podfile_info_options +_podfile_info_options=( + '(--all)--all[Show information about all Pods with dependencies that are used in a project]' \ + '(--md)--md[Output information in Markdown format]' +) + +local -a _push_options +_push_options=( + '(--allow-warnings)--allow-warnings[Allows pushing even if there are warnings]' \ + '(--local-only)--local-only[Does not perform the step of pushing REPO to its remote]' +) + +local -a _repo_lint_options +_repo_lint_options=( + '(--only-errors)--only-errors[Lint presents only the errors]' +) + +local -a _setup_options +_setup_options=( + '(--push)--push[Use this option to enable push access once granted]' +) + +local -a _spec_lint_options +_spec_lint_options=( + '(--quick)--quick[Lint skips checks that would require to download and build the spec]' \ + '(--only-errors)--only-errors[Lint validates even if warnings are present]' \ + '(--no-clean)--no-clean[Lint leaves the build directory intact for inspection]' +) + +local -a _spec_cat_options +_spec_cat_options=( + '(--show-all)--show-all[Pick from all versions of the given podspec]' +) + +local -a _spec_which_options +_spec_which_options=( + '(--show-all)--show-all[Print all versions of the given podspec]' +) + +local -a _spec_edit_options +_spec_edit_options=( + '(--show-all)--show-all[Pick which spec to edit from all available versions of the given podspec]' +) + + __first_command_list () { local expl @@ -82,7 +155,7 @@ __first_command_list () } __repo_list() { - _wanted application expl 'command' compadd $(command ls -1 ~/.cocoapods 2>/dev/null | sed -e 's/ /\\ /g') + _wanted application expl 'repo' compadd $(command ls -1 ~/.cocoapods 2>/dev/null | sed -e 's/ /\\ /g') } __pod-repo() { @@ -93,19 +166,32 @@ __pod-repo() { ':command:->command' \ '*::options:->options' - case $state in - (command) - _describe -t commands "gem subcommand" _repo_arguments - return - ;; + case $state in + (command) + _describe -t commands "pod repo" _repo_arguments + return + ;; - (options) - case $line[1] in - (update|lint) - _arguments ':feature:__repo_list' - ;; - esac - ;; + (options) + case $line[1] in + (lint) + _arguments \ + $_inherited_options \ + $_repo_lint_options \ + ':feature:__repo_list' + ;; + + (update) + _arguments \ + $_inherited_options \ + ':feature:__repo_list' + ;; + + (add) + _arguments \ + $_inherited_options + esac + ;; esac } @@ -119,12 +205,41 @@ __pod-spec() { case $state in (command) - _describe -t commands "gem subcommand" _spec_arguments + _describe -t commands "pod spec" _spec_arguments return ;; (options) - #todo + case $line[1] in + (create) + _arguments \ + $_inherited_options + ;; + + (lint) + _arguments \ + $_inherited_options \ + $_spec_lint_options + ;; + + (cat) + _arguments \ + $_inherited_options \ + $_spec_cat_options + ;; + + (which) + _arguments \ + $_inherited_options \ + $_spec_which_options + ;; + + (edit) + _arguments \ + $_inherited_options \ + $_spec_edit_options + ;; + esac return ;; esac @@ -140,12 +255,13 @@ __pod-ipc() { case $state in (command) - _describe -t commands "gem subcommand" _ipc_arguments + _describe -t commands "pod ipc" _ipc_arguments return ;; (options) - #todo + _arguments -C \ + $_inherited_options return ;; esac @@ -156,48 +272,53 @@ __pod-list() { typeset -A opt_args _arguments -C \ + $_inherited_options \ + $_list_options \ ':command:->command' \ '*::options:->options' case $state in (command) - _describe -t commands "gem subcommand" _list_arguments + _describe -t commands "pod list" _list_arguments return ;; (options) - #todo + _arguments -C \ + $_inherited_options \ + $_list_options return ;; esac } - - -local expl -#local -a boxes installed_boxes - local curcontext="$curcontext" state line typeset -A opt_args _arguments -C \ + $_inherited_options \ ':command:->command' \ '*::options:->options' case $state in (command) - _describe -t commands "gem subcommand" _1st_arguments + _describe -t commands "pod" _1st_arguments return ;; (options) case $line[1] in (help) - _arguments ':feature:__first_command_list' + _arguments \ + $_inherited_options \ + ':help:__first_command_list' ;; (push) - _arguments ':feature:__repo_list' + _arguments \ + $_inherited_options \ + $_push_options \ + ':repo:__repo_list' ;; (repo) @@ -216,8 +337,42 @@ case $state in __pod-list ;; - (install|outdated|podfile-info|search|setup|update) - #_arguments ':feature:__repo_list' + (install) + _arguments \ + $_inherited_options \ + $_install_options + ;; + + (update) + _arguments \ + $_inherited_options \ + $_update_options + ;; + + (outdated) + _arguments \ + $_inherited_options \ + $_outdated_options + ;; + + (search) + _arguments \ + $_inherited_options \ + $_search_options + ;; + + (podfile-info) + _arguments \ + $_inherited_options \ + $_podfile_info_options + ;; + + (setup) + _arguments \ + $_inherited_options \ + $_setup_options + ;; + esac ;; esac From 45314ee5b7ad2d7daafe940b801ddacd151d7017 Mon Sep 17 00:00:00 2001 From: mekanics Date: Wed, 10 Jul 2013 00:14:08 +0200 Subject: [PATCH 11/23] correct filename in the comments --- plugins/pod/_pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/pod/_pod b/plugins/pod/_pod index bb4f782b3..c1eb86b5e 100644 --- a/plugins/pod/_pod +++ b/plugins/pod/_pod @@ -2,7 +2,7 @@ #autoload # ----------------------------------------------------------------------------- -# FILE: pod.plugin.zsh +# FILE: _pod # DESCRIPTION: Cocoapods autocomplete plugin for Oh-My-Zsh # http://cocoapods.org # AUTHOR: Alexandre Joly (alexandre.joly@mekanics.ch) From 05d8fdf3d54af3243e5891d13969a766bd9570a1 Mon Sep 17 00:00:00 2001 From: Brent Theisen Date: Tue, 9 Jul 2013 23:15:43 -0500 Subject: [PATCH 12/23] Copy and paste of two functions from Ubuntu 13.04's version of /usr/share/zsh/functions/Completion/Unix/_git that were referenced in 46f0d8d. Fixes #1952. --- plugins/git/_git-branch | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/plugins/git/_git-branch b/plugins/git/_git-branch index 86d03bc30..6b9c1a483 100644 --- a/plugins/git/_git-branch +++ b/plugins/git/_git-branch @@ -60,3 +60,24 @@ _git-branch () "($l $c $m -d)-D[delete a branch]" \ $dependent_deletion_args } + +(( $+functions[__git_ignore_line] )) || +__git_ignore_line () { + declare -a ignored + ignored=() + ((CURRENT > 1)) && + ignored+=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH}) + ((CURRENT < $#line)) && + ignored+=(${line[CURRENT+1,-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH}) + $* -F ignored +} + +(( $+functions[__git_ignore_line_inside_arguments] )) || +__git_ignore_line_inside_arguments () { + declare -a compadd_opts + + zparseopts -D -E -a compadd_opts V: J: 1 2 n f X: M: P: S: r: R: q F: + + __git_ignore_line $* $compadd_opts +} + From ba7fe6df62236dfa03a360a8707ebd0c0b1a645a Mon Sep 17 00:00:00 2001 From: Alexandre Joly Date: Mon, 15 Jul 2013 14:37:31 +0200 Subject: [PATCH 13/23] show file liste on 'pod push [REPO]' and tab, 'pod spec lint' and 'pod podfile-info' --- plugins/pod/_pod | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/pod/_pod b/plugins/pod/_pod index c1eb86b5e..563fa5e66 100644 --- a/plugins/pod/_pod +++ b/plugins/pod/_pod @@ -102,13 +102,15 @@ _list_options=( local -a _podfile_info_options _podfile_info_options=( '(--all)--all[Show information about all Pods with dependencies that are used in a project]' \ - '(--md)--md[Output information in Markdown format]' + '(--md)--md[Output information in Markdown format]' \ + '*:script or directory:_files' ) local -a _push_options _push_options=( '(--allow-warnings)--allow-warnings[Allows pushing even if there are warnings]' \ - '(--local-only)--local-only[Does not perform the step of pushing REPO to its remote]' + '(--local-only)--local-only[Does not perform the step of pushing REPO to its remote]' \ + '*:script or directory:_files' ) local -a _repo_lint_options @@ -125,7 +127,8 @@ local -a _spec_lint_options _spec_lint_options=( '(--quick)--quick[Lint skips checks that would require to download and build the spec]' \ '(--only-errors)--only-errors[Lint validates even if warnings are present]' \ - '(--no-clean)--no-clean[Lint leaves the build directory intact for inspection]' + '(--no-clean)--no-clean[Lint leaves the build directory intact for inspection]' \ + '*:script or directory:_files' ) local -a _spec_cat_options From 5c529b5daac6e22cb8a267dcd7796c8400c63679 Mon Sep 17 00:00:00 2001 From: Armin Widegreen Date: Tue, 16 Jul 2013 17:10:47 +0200 Subject: [PATCH 14/23] Fix ssh-agent plugin identities comment for using multiple identities. --- plugins/ssh-agent/ssh-agent.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh index 7468749f8..3b0042a7d 100644 --- a/plugins/ssh-agent/ssh-agent.plugin.zsh +++ b/plugins/ssh-agent/ssh-agent.plugin.zsh @@ -9,7 +9,7 @@ # To load multiple identities use the identities style, For # example: # -# zstyle :omz:plugins:ssh-agent id_rsa id_rsa2 id_github +# zstyle :omz:plugins:ssh-agent identities id_rsa id_rsa2 id_github # # To set the maximum lifetime of the identities, use the # lifetime style. The lifetime may be specified in seconds From 00ccee1f33c90c8900e8c2efe4dca9bf5db040f9 Mon Sep 17 00:00:00 2001 From: Trae Robrock Date: Tue, 16 Jul 2013 16:57:08 -0700 Subject: [PATCH 15/23] Add knife_ssh command to make connecting to servers managed with chef easier --- plugins/knife_ssh/knife_ssh.plugin.zsh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 plugins/knife_ssh/knife_ssh.plugin.zsh diff --git a/plugins/knife_ssh/knife_ssh.plugin.zsh b/plugins/knife_ssh/knife_ssh.plugin.zsh new file mode 100644 index 000000000..ea3361c49 --- /dev/null +++ b/plugins/knife_ssh/knife_ssh.plugin.zsh @@ -0,0 +1,18 @@ +function knife_ssh() { + grep -q $1 ~/.knife_comp~ || rm -f ~/.knife_comp~; + ssh $(knife node show $1 | awk '/IP:/{print $2}') +} + +_knife_ssh() { + if hash knife 2>/dev/null; then + if [[ ! -f ~/.knife_comp~ ]]; then + echo "\nGenerating ~/.knife_comp~..." >/dev/stderr + knife node list > ~/.knife_comp~ + fi + compadd `cat ~/.knife_comp~` + else + echo "Could not find knife" > /dev/stderr; + fi +} + +compdef _knife_ssh knife_ssh From 9a9e6e929964cbb25c5ce656a995e31ab9636762 Mon Sep 17 00:00:00 2001 From: Trae Robrock Date: Tue, 16 Jul 2013 17:01:58 -0700 Subject: [PATCH 16/23] No cat, and hide errors for missing cache file --- plugins/knife_ssh/knife_ssh.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/knife_ssh/knife_ssh.plugin.zsh b/plugins/knife_ssh/knife_ssh.plugin.zsh index ea3361c49..7fdd42a1e 100644 --- a/plugins/knife_ssh/knife_ssh.plugin.zsh +++ b/plugins/knife_ssh/knife_ssh.plugin.zsh @@ -1,5 +1,5 @@ function knife_ssh() { - grep -q $1 ~/.knife_comp~ || rm -f ~/.knife_comp~; + grep -q $1 ~/.knife_comp~ 2> /dev/null || rm -f ~/.knife_comp~; ssh $(knife node show $1 | awk '/IP:/{print $2}') } @@ -9,7 +9,7 @@ _knife_ssh() { echo "\nGenerating ~/.knife_comp~..." >/dev/stderr knife node list > ~/.knife_comp~ fi - compadd `cat ~/.knife_comp~` + compadd $(<~/.knife_comp~) else echo "Could not find knife" > /dev/stderr; fi From 4b8e10958467899765e0e4fedb80d31f8e0adb8d Mon Sep 17 00:00:00 2001 From: John Warwick Date: Fri, 19 Jul 2013 23:19:11 -0400 Subject: [PATCH 17/23] Added autocompletion support for Elixir mix command --- plugins/mix/_mix | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 plugins/mix/_mix diff --git a/plugins/mix/_mix b/plugins/mix/_mix new file mode 100644 index 000000000..602f5ffa0 --- /dev/null +++ b/plugins/mix/_mix @@ -0,0 +1,63 @@ +#compdef mix +#autoload + +# Elixir mix zsh completion + +local -a _1st_arguments +_1st_arguments=( + 'archive:Archive this project into a .ez file' + 'clean:Clean generated application files' + 'compile:Compile source files' + 'deps:List dependencies and their status' + "deps.clean:Remove dependencies' files" + 'deps.compile:Compile dependencies' + 'deps.get:Get all out of date dependencies' + 'deps.unlock:Unlock the given dependencies' + 'deps.update:Update dependencies' + 'do:Executes the commands separated by comma' + 'escriptize:Generates an escript for the project' + 'help:Print help information for tasks' + 'local:List local tasks' + 'local.install:Install a task or an archive locally' + 'local.rebar:Install rebar locally' + 'local.uninstall:Uninstall local tasks or archives' + 'new:Creates a new Elixir project' + 'run:Run the given file or expression' + "test:Run a project's tests" + '--help:Describe available tasks' + '--version:Prints the Elixir version information' +) + +__task_list () +{ + local expl + declare -a tasks + + tasks=(archive clean compile deps deps.clean deps.compile deps.get deps.unlock deps.update do escriptize help local local.install local.rebar local.uninstall new run test) + + _wanted tasks expl 'help' compadd $tasks +} + +local expl + +local curcontext="$curcontext" state line +typeset -A opt_args + +_arguments -C \ + ':command:->command' \ + '*::options:->options' + +case $state in + (command) + _describe -t commands "mix subcommand" _1st_arguments + return + ;; + + (options) + case $line[1] in + (help) + _arguments ':feature:__task_list' + esac + ;; +esac + From d0e312fc13d8f2a1a6bb9a02ca4acf1bcdc0bbfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Macias?= Date: Mon, 22 Jul 2013 15:51:16 +0200 Subject: [PATCH 18/23] Fix symfony command completion 'permission denied' --- plugins/symfony/symfony.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/symfony/symfony.plugin.zsh b/plugins/symfony/symfony.plugin.zsh index 9de767548..f070e9e47 100644 --- a/plugins/symfony/symfony.plugin.zsh +++ b/plugins/symfony/symfony.plugin.zsh @@ -1,7 +1,7 @@ # symfony basic command completion _symfony_get_command_list () { - ./symfony | sed "1,/Available tasks/d" | awk 'BEGIN { cat=null; } /^[A-Za-z]+$/ { cat = $1; } /^ :[a-z]+/ { print cat $1; }' + php symfony | sed "1,/Available tasks/d" | awk 'BEGIN { cat=null; } /^[A-Za-z]+$/ { cat = $1; } /^ :[a-z]+/ { print cat $1; }' } _symfony () { From b456541cc392e79ce7b8b30f0cba98f2796ed9a4 Mon Sep 17 00:00:00 2001 From: Andrey Janzen Date: Tue, 23 Jul 2013 15:52:44 +0700 Subject: [PATCH 19/23] In capistrano completion show also tasks without description --- plugins/capistrano/_capistrano | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/capistrano/_capistrano b/plugins/capistrano/_capistrano index 1002dad96..3cadf3d54 100644 --- a/plugins/capistrano/_capistrano +++ b/plugins/capistrano/_capistrano @@ -4,7 +4,7 @@ if [[ -f config/deploy.rb || -f Capfile ]]; then if [[ ! -f .cap_tasks~ || config/deploy.rb -nt .cap_tasks~ ]]; then echo "\nGenerating .cap_tasks~..." > /dev/stderr - cap --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~ + cap -v --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~ fi compadd `cat .cap_tasks~` fi From 107d196f94ee800907abcb3c2de8df1f73b2b31e Mon Sep 17 00:00:00 2001 From: Kenneth Geerts Date: Tue, 23 Jul 2013 15:51:35 +0200 Subject: [PATCH 20/23] Updated gem plugin zsh completion (gem 2.0.3). --- plugins/gem/_gem | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/gem/_gem b/plugins/gem/_gem index 83cba40d1..975cec602 100644 --- a/plugins/gem/_gem +++ b/plugins/gem/_gem @@ -9,8 +9,9 @@ _gem_installed() { local -a _1st_arguments _1st_arguments=( + 'build:Build a gem from a gemspec' 'cert:Manage RubyGems certificates and signing settings' - 'check:Check installed gems' + 'check:Check a gem repository for added or missing files' 'cleanup:Clean up old versions of installed gems in the local repository' 'contents:Display the contents of the installed gems' 'dependency:Show the dependencies of an installed gem' @@ -21,7 +22,7 @@ _1st_arguments=( 'install:Install a gem into the local repository' 'list:Display gems whose name starts with STRING' 'lock:Generate a lockdown list of gems' - 'mirror:Mirror a gem repository' + 'mirror:Mirror all gem files (requires rubygems-mirror)' 'outdated:Display all gems that need updates' 'owner:Manage gem owners on RubyGems.org.' 'pristine:Restores installed gems to pristine condition from files located in the gem cache' @@ -35,8 +36,9 @@ _1st_arguments=( 'stale:List gems along with access times' 'uninstall:Uninstall gems from the local repository' 'unpack:Unpack an installed gem to the current directory' - 'update:Update the named gems (or all installed gems) in the local repository' + 'update:Update installed gems to the latest version' 'which:Find the location of a library file you can require' + 'yank:Remove a specific gem version release from RubyGems.org' ) local expl From 619ecb5f4fcec9ceb3769f4697fcbb2cbe3f2a7a Mon Sep 17 00:00:00 2001 From: Ahmed Azaan Date: Wed, 7 Aug 2013 21:19:21 +0530 Subject: [PATCH 21/23] add docker autocomplete plugin --- plugins/docker/README.md | 0 plugins/docker/_docker | 290 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 290 insertions(+) create mode 100644 plugins/docker/README.md create mode 100644 plugins/docker/_docker diff --git a/plugins/docker/README.md b/plugins/docker/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/docker/_docker b/plugins/docker/_docker new file mode 100644 index 000000000..e8d2885c9 --- /dev/null +++ b/plugins/docker/_docker @@ -0,0 +1,290 @@ +#compdef docker + +# Docker autocompletion for oh-my-zsh +# Requires: Docker installed +# Author : Azaan (@aeonazaan) + + +# ----- Helper functions +# Output a selectable list of all running docker containers +__docker_containers() { + declare -a cont_cmd + cont_cmd=($(docker ps | awk 'NR>1{print $1":[CON("$1")"$2"("$3")]"}')) + _describe 'containers' cont_cmd +} + +# output a selectable list of all docker images +__docker_images() { + declare -a img_cmd + img_cmd=($(docker images | awk 'NR>1{print $1}')) + _describe 'images' img_cmd +} + +# ----- Commands +# Seperate function for each command, makes extension easier later +# --------------------------- +__attach() { + __docker_containers +} + +__build() { + _arguments \ + '-q=false[Suppress verbose build output]' \ + '-t="[fuck to be applied to the resulting image in case of success]' \ + ' *:files:_files' +} + +__commit() { + _arguments \ + '-author="[Author]' \ + '-m="[Commit message]' \ + '-run="[Config automatically applied when the image is run.\n]' + __docker_containers +} + +__diff() { + __docker_containers +} + +__export() { + __docker_containers +} + + +__history() { + __docker_images +} + +__images() { + _arguments \ + '-a[show all images]' \ + '-notrunc[dont truncate output]' \ + '-q[only show numeric IDs]' \ + '-viz[output graph in graphviz format' + __docker_images +} + +__import() { + _arguments '*:files:_files' +} + +__info() { + # no arguments +} + +__insert() { + __docker_images + _arguments '*:files:_files' +} + +__inspect() { + __docker_images + __docker_containers +} + +__kill() { + __docker_containers +} + +__login() { + _arguments \ + '-e="[email]' \ + '-p="[password]' \ + '-u="[username]' \ +} + +__logs() { + __docker_containers +} + +__port() { + __docker_containers +} + +__top() { + __docker_containers +} + +__ps() { + _arguments \ + '-a[Show all containers. Only running containers are shown by default.]' \ + '-beforeId="[Show only container created before Id, include non-running ones.]' \ + '-l[Show only the latest created container, include non-running ones.]' \ + '-n=[Show n last created containers, include non-running ones.]' \ + '-notrurrrrnc[Dont truncate output]' \ + '-q[Only display numeric IDs]' \ + '-s[Display sizes]' \ + '-sinceId="[Show only containers created since Id, include non-running ones.]' +} + +__pull() { + _arguments '-t="[Download tagged image in repository]' +} + +__push() { + +} + +__restart() { + _arguments '-t=[number of seconds to try to stop before killing]' + __docker_containers +} + +__rm() { + _arguments '-v[Remove the volumes associated to the container]' + __docker_containers +} + +__rmi() { + __docker_images +} + +__run() { + _arguments \ + '-a=[Attach to stdin, stdout or stderr.]' \ + '-c=[CPU shares (relative weight)]' \ + '-d[Detached mode: leave the container running in the background]' \ + '-dns=[Set custom dns servers]' \ + '-e=[Set environment variables]' \ + '-entrypoint="[Overwrite the default entrypoint of the image]' \ + '-h="[Container host name]' \ + '-i[Keep stdin open even if not attached]' \ + '-m=[Memory limit (in bytes)]' \ + '-p=[Expose a containers port to the host (use docker port to see the actual mapping)]' \ + '-t[Allocate a pseudo-tty]' \ + '-u="[Username or UID]' \ + '-v=[Bind mount a volume (e.g. from the host: -v /host:/container, from docker: -v /container)]' \ + '-volumes-from="[Mount volumes from the specified container]' + __docker_images +} + +__search() { + arguments '-notrunc[Dont truncate output]' +} + +__start() { + __docker_container +} + +__stop() { + __arguments '-t=[number of seconds to try to stop before killing]' + __docker_containers +} + +__tag() { + __arguments '-f[Force]' + __docker_images +} + +__version() { + +} + +__wait() { + __docker_container +} + +# end commands --------- +# ---------------------- + +local -a _1st_arguments +_1st_arguments=( + "attach":"Attach to a running container" + "build":"Build a container from a Dockerfile" + "commit":"Create a new image from a container's changes" + "diff":"Inspect changes on a container's filesystem" + "export":"Stream the contents of a container as a tar archive" + "history":"Show the history of an image" + "images":"List images" + "import":"Create a new filesystem image from the contents of a tarball" + "info":"Display system-wide information" + "insert":"Insert a file in an image" + "inspect":"Return low-level information on a container" + "kill":"Kill a running container" + "login":"Register or Login to the docker registry server" + "logs":"Fetch the logs of a container" + "port":"Lookup the public-facing port which is NAT-ed to PRIVATE_PORT" + "top":"Lookup the running processes of a container" + "ps":"List containers" + "pull":"Pull an image or a repository from the docker registry server" + "push":"Push an image or a repository to the docker registry server" + "restart":"Restart a running container" + "rm":"Remove one or more containers" + "rmi":"Remove one or more images" + "run":"Run a command in a new container" + "search":"Search for an image in the docker index" + "start":"Start a stopped container" + "stop":"Stop a running container" + "tag":"Tag an image into a repository" + "version":"Show the docker version information" + "wait":"Block until a container stops, then print its exit code" +) + +_arguments '*:: :->command' + +if (( CURRENT == 1 )); then + _describe -t commands "docker command" _1st_arguments + return +fi + +local -a _command_args +case "$words[1]" in + attach) + __docker_containers ;; + build) + __build ;; + commit) + __commit ;; + diff) + __diff ;; + export) + __export ;; + history) + __history ;; + images) + __images ;; + import) + __import ;; + info) + __info ;; + insert) + __insert ;; + inspect) + __inspect ;; + kill) + __kill ;; + login) + __login ;; + logs) + __logs ;; + port) + __port ;; + top) + __top ;; + ps) + __ps ;; + pull) + __pull ;; + push) + __push ;; + restart) + __restart ;; + rm) + __rm ;; + rmi) + __rmi ;; + run) + __run ;; + search) + __search ;; + start) + __start ;; + stop) + __stop ;; + tag) + __tag ;; + version) + __version ;; + wait) + __wait ;; +esac From 0a62f6636d6fc749b13a45b3d032f3616f2c828d Mon Sep 17 00:00:00 2001 From: Ahmed Aeon Axan Date: Wed, 7 Aug 2013 21:29:53 +0530 Subject: [PATCH 22/23] Update README.md --- plugins/docker/README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/plugins/docker/README.md b/plugins/docker/README.md index e69de29bb..231a6dcf5 100644 --- a/plugins/docker/README.md +++ b/plugins/docker/README.md @@ -0,0 +1,19 @@ +## Docker autocomplete plugin + +- Adds autocomplete options for all docker commands. +- Will also show containerIDs and Image names where applicable + +####Shows help for all commands +![General Help](http://i.imgur.com/tUBO9jh.png "Help for all commands") + + +####Shows your downloaded images where applicable +![Images](http://i.imgur.com/R8ZsWO1.png "Images") + + +####Shows your running containers where applicable +![Containers](http://i.imgur.com/WQtbheg.png "Containers") + + + +Maintainer : Ahmed Azaan ([@aeonazaan](https://twitter.com/aeonazaan)) From 2d1a07a3f72353a59ed9ecda88969093406699f7 Mon Sep 17 00:00:00 2001 From: Ahmed Azaan Date: Wed, 7 Aug 2013 22:11:49 +0530 Subject: [PATCH 23/23] fixed minor errors --- plugins/docker/_docker | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/docker/_docker b/plugins/docker/_docker index e8d2885c9..f13f876cf 100644 --- a/plugins/docker/_docker +++ b/plugins/docker/_docker @@ -31,7 +31,7 @@ __build() { _arguments \ '-q=false[Suppress verbose build output]' \ '-t="[fuck to be applied to the resulting image in case of success]' \ - ' *:files:_files' + '*:files:_files' } __commit() { @@ -60,7 +60,7 @@ __images() { '-a[show all images]' \ '-notrunc[dont truncate output]' \ '-q[only show numeric IDs]' \ - '-viz[output graph in graphviz format' + '-viz[output graph in graphviz format]' __docker_images } @@ -159,20 +159,20 @@ __run() { } __search() { - arguments '-notrunc[Dont truncate output]' + _arguments '-notrunc[Dont truncate output]' } __start() { - __docker_container + __docker_containers } __stop() { - __arguments '-t=[number of seconds to try to stop before killing]' + _arguments '-t=[number of seconds to try to stop before killing]' __docker_containers } __tag() { - __arguments '-f[Force]' + _arguments '-f[Force]' __docker_images } @@ -181,7 +181,7 @@ __version() { } __wait() { - __docker_container + __docker_containers } # end commands ---------