Skip to content
This repository
Browse code

zsh completion

  • Loading branch information...
commit 666be3363e350b0b9b4b0d13a2e8b59139425c89 1 parent bddbc1c
authored March 29, 2013

Showing 90 changed files with 19,806 additions and 4 deletions. Show diff stats Hide diff stats

  1. 187  .zsh/completion/_ack
  2. 422  .zsh/completion/_adb
  3. 89  .zsh/completion/_ag
  4. 331  .zsh/completion/_android
  5. 50  .zsh/completion/_attach
  6. 168  .zsh/completion/_baselayout
  7. 52  .zsh/completion/_bpython
  8. 115  .zsh/completion/_brew
  9. 92  .zsh/completion/_bundle
  10. 476  .zsh/completion/_cabal
  11. 56  .zsh/completion/_cap
  12. 60  .zsh/completion/_choc
  13. 71  .zsh/completion/_coffee
  14. 81  .zsh/completion/_cpanm
  15. 65  .zsh/completion/_debuild
  16. 78  .zsh/completion/_dhcpcd
  17. 53  .zsh/completion/_ditz
  18. 58  .zsh/completion/_docpad
  19. 139  .zsh/completion/_emulator
  20. 207  .zsh/completion/_eselect
  21. 83  .zsh/completion/_fab
  22. 48  .zsh/completion/_gas
  23. 78  .zsh/completion/_gcc-config
  24. 73  .zsh/completion/_geany
  25. 471  .zsh/completion/_gem
  26. 155  .zsh/completion/_genlop
  27. 245  .zsh/completion/_gentoo_packages
  28. 410  .zsh/completion/_gentoolkit
  29. 87  .zsh/completion/_git
  30. 424  .zsh/completion/_git-flow
  31. 108  .zsh/completion/_git-pulls
  32. 58  .zsh/completion/_git-wtf
  33. 272  .zsh/completion/_github
  34. 69  .zsh/completion/_google
  35. 135  .zsh/completion/_gradle
  36. 174  .zsh/completion/_heroku
  37. 74  .zsh/completion/_jmeter
  38. 67  .zsh/completion/_jmeter-plugins
  39. 125  .zsh/completion/_jonas
  40. 214  .zsh/completion/_knife
  41. 275  .zsh/completion/_language_codes
  42. 103  .zsh/completion/_layman
  43. 62  .zsh/completion/_lein
  44. 61  .zsh/completion/_logger
  45. 314  .zsh/completion/_lunar
  46. 49  .zsh/completion/_lunchy
  47. 245  .zsh/completion/_manage.py
  48. 35  .zsh/completion/_mosh
  49. 86  .zsh/completion/_mussh
  50. 628  .zsh/completion/_mvn
  51. 66  .zsh/completion/_node
  52. 85  .zsh/completion/_nvm
  53. 72  .zsh/completion/_optirun
  54. 26  .zsh/completion/_pactree
  55. 89  .zsh/completion/_pear
  56. 279  .zsh/completion/_perf
  57. 61  .zsh/completion/_periscope
  58. 404  .zsh/completion/_pgsql_utils
  59. 125  .zsh/completion/_pip
  60. 137  .zsh/completion/_pkcon
  61. 215  .zsh/completion/_play
  62. 102  .zsh/completion/_port
  63. 358  .zsh/completion/_portage
  64. 197  .zsh/completion/_portage_utils
  65. 147  .zsh/completion/_pygmentize
  66. 163  .zsh/completion/_redis-cli
  67. 128  .zsh/completion/_rvm
  68. 93  .zsh/completion/_sbt
  69. 249  .zsh/completion/_scala
  70. 66  .zsh/completion/_sdd
  71. 708  .zsh/completion/_setup.py
  72. 84  .zsh/completion/_showoff
  73. 115  .zsh/completion/_smartmontools
  74. 233  .zsh/completion/_socat
  75. 63  .zsh/completion/_srm
  76. 55  .zsh/completion/_ssh-copy-id
  77. 63  .zsh/completion/_subliminal
  78. 456  .zsh/completion/_symfony
  79. 55  .zsh/completion/_teamocil
  80. 28  .zsh/completion/_thor
  81. 60  .zsh/completion/_tmuxinator
  82. 132  .zsh/completion/_vagrant
  83. 317  .zsh/completion/_virtualbox
  84. 114  .zsh/completion/_vnstat
  85. 207  .zsh/completion/_vpnc
  86. 352  .zsh/completion/_yaourt
  87. 2,766  .zsh/completion/git-completion.bash
  88. 2,766  .zsh/git-completion.bash
  89. 87  .zsh/git-completion.zsh
  90. 9  .zshrc
187  .zsh/completion/_ack
... ...
@@ -0,0 +1,187 @@
  1
+#compdef ack ack-grep
  2
+# ------------------------------------------------------------------------------
  3
+# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
  4
+# All rights reserved.
  5
+#
  6
+# Redistribution and use in source and binary forms, with or without
  7
+# modification, are permitted provided that the following conditions are met:
  8
+#     * Redistributions of source code must retain the above copyright
  9
+#       notice, this list of conditions and the following disclaimer.
  10
+#     * Redistributions in binary form must reproduce the above copyright
  11
+#       notice, this list of conditions and the following disclaimer in the
  12
+#       documentation and/or other materials provided with the distribution.
  13
+#     * Neither the name of the zsh-users nor the
  14
+#       names of its contributors may be used to endorse or promote products
  15
+#       derived from this software without specific prior written permission.
  16
+#
  17
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  18
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20
+# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
  21
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27
+# ------------------------------------------------------------------------------
  28
+# Description
  29
+# -----------
  30
+#
  31
+#  Completion script for ack 1.94 (http://betterthangrep.com).
  32
+#
  33
+# ------------------------------------------------------------------------------
  34
+# Authors
  35
+# -------
  36
+#
  37
+#  * Julien Nicoulaud <julien.nicoulaud@gmail.com>
  38
+#
  39
+# ------------------------------------------------------------------------------
  40
+
  41
+
  42
+_ack() {
  43
+  local context curcontext="$curcontext" state line cmds update_policy ret=1
  44
+  integer NORMARG
  45
+  typeset -A opt_args
  46
+
  47
+  zstyle -s ":completion:${curcontext}:" cache-policy update_policy
  48
+  [[ -z "$update_policy" ]] && zstyle ":completion:${curcontext}:" cache-policy _ack_types_caching_policy
  49
+
  50
+  unset _ack_raw_types
  51
+  if ( [[ ${+_ack_raw_types} -eq 0 ]] || _cache_invalid "ack-grep" ) && ! _retrieve_cache "ack-grep"; then
  52
+    _ack_raw_types=(${(S)${(f)${${"$(_call_program types $words[1] --help=types)"}#*--\[no\]}}#*no\]})
  53
+    [[ $#_ack_raw_types -gt 0 ]] && _store_cache "ack-grep" _ack_raw_types
  54
+  fi
  55
+
  56
+  _arguments -C -s -S -n \
  57
+    '(- 1 *)--version[display version and copyright information]' \
  58
+    '(- 1 *)--help[print a short help statement]' \
  59
+    '(- 1 *)--man[print the manual page]' \
  60
+    '(-a --all -u --unrestricted)'{-a,--all}'[operate on all files, regardless of type (but still skip directories like blib, CVS, etc.)]' \
  61
+    '(-A --after-context -C --context)'{-A+,--after-context=}'[print N lines of trailing context after matching lines]:number' \
  62
+    '(-B --before-context -C --context)'{-B+,--before-context=}'[print N lines of leading context before matching lines]:number' \
  63
+    '(-C --context -A --after-context -B --before-context)'{-C-,--context=}'[print N lines (default 2) of context around matching lines]:number' \
  64
+    '(-c --count)'{-c,--count}'[suppress normal output; instead print a count of matching lines for each input file]' \
  65
+    '(--nocolor)--color[highlight the matching text]' \
  66
+    '(--color --color-filename --color-match --color-lineno)--nocolor[supress the color]' \
  67
+    '(--nocolor --color)--color-filename[sets the color to be used for filenames]:color:->colors' \
  68
+    '(--nocolor --color)--color-match[sets the color to be used for matches]:color:->colors' \
  69
+    '(--nocolor --color)--color-lineno[sets the color to be used for line numbers]:color:->colors' \
  70
+    '--column[show the column number of the first match]' \
  71
+    '(--noenv)--env[enable environment processing]' \
  72
+    '(--env)--noenv[disable all environment processing, no .ackrc is read and all environment variables are ignored]' \
  73
+    '--flush[flush output immediately]' \
  74
+    '-f[only print the files that would be searched, without actually doing any searching]' \
  75
+    '(--nofollow)--follow[follow symlinks]' \
  76
+    '(--follow)--nofollow[don'\''t follow symlinks]' \
  77
+    '-G+[only paths matching the given regex are included in the search]:regex' \
  78
+    '-g+[print files where the relative path + filename matches the given regex]:regex' \
  79
+    '(--nogroup)--group[group matches by file name]' \
  80
+    '(--group)--nogroup[do not group matches by file name]' \
  81
+    '(-H --with-filename -h --no-filename)'{-H,--with-filename}'[print the filename for each match]' \
  82
+    '(-h --no-filename -H --with-filename)'{-h,--no-filename}'[suppress the prefixing of filenames on output when multiple files are searched]' \
  83
+    '(-i --ignore-case)'{-i,--ignore-case}'[ignore case in the search strings]' \
  84
+    '*--ignore-dir[ignore directory]:directory:_files -/' \
  85
+    '*--noignore-dir[don'\''t ignore directory]:directory:_files -/' \
  86
+    '--invert-file-match[print/search handle files that do not match -g/-G]' \
  87
+    '--line=[only print given line of each file]:number' \
  88
+    '(-l --files-with-matches -L --files-without-matches)'{-l,--files-with-matches}'[only print the filenames of matching files, instead of the matching text]' \
  89
+    '(-L --files-without-matches -l --files-with-matches)'{-L,--files-without-matches}'[only print the filenames of files that do NOT match]' \
  90
+    '--match=[specify the regular expression explicitly]:regex' \
  91
+    '(-m --max-count)'{-m+,--max-count=}'[stop reading a file after N matches]:number' \
  92
+    '(-r -R --recurse -n --no-recurse)'{-r,-R,--recurse}'[recurse into sub-directories]' \
  93
+    '(-n --no-recurse -r -R --recurse)'{-n,--no-recurse}'[no descending into subdirectories]' \
  94
+    '-o[show only the part of each line matching PATTERN (turns off text highlighting)]:pattern' \
  95
+    '--output=[output the evaluation of expr for each line (turns off text highlighting)]:expression' \
  96
+    '--pager=[direct ack'\''s output through program]:pager program:_command_names' \
  97
+    '--passthru[prints all lines, whether or not they match the expression]' \
  98
+    '--print0[the filenames are output separated with a null byte instead of the usual newline]' \
  99
+    '(-Q --literal)'{-Q,--literal}'[quote all metacharacters in the pattern, it is treated as a literal]' \
  100
+    '(--no-smart-case)--smart-case[ignore case in the search strings if pattern contains no uppercase characters]' \
  101
+    '(--smart-case)--no-smart-case[disable --smart-case option]' \
  102
+    '--sort-files[sorts the found files lexically]' \
  103
+    '--show-types[outputs the filetypes that ack associates with each file]' \
  104
+    '--thpppt[display the all-important Bill The Cat logo]' \
  105
+    '*--type=[specify the types of files to include or exclude from a search]:type:->types' \
  106
+    '*--type-add[files with the given extensions are recognized as being of the given type]:type-def:->type-defs' \
  107
+    '*--type-set[files with the given extensions are recognized as being of the given type]:type-def:->type-defs' \
  108
+    '(-u --unrestricted -a --all)'{-u,--unrestricted}'[all files and directories (including blib/, core.*, ...) are searched, nothing is skipped]' \
  109
+    '(-v --invert-match)'{-v,--invert-match}'[invert match: select non-matching lines]' \
  110
+    '(-w --word-regexp)'{-w,--word-regexp}'[force the given pattern to match only whole words]' \
  111
+    '-1[stops after reporting first match of any kind]' \
  112
+    {'--','--no'}${_ack_raw_types/ ##/\[}']' \
  113
+    '*: :->args' \
  114
+  && ret=0
  115
+
  116
+  case $state in
  117
+    args)
  118
+      if [[ CURRENT -eq NORMARG && ${+opt_args[--match]} -eq 0 ]]
  119
+      then
  120
+        # If the current argument is the first non-option argument
  121
+        # and --match isn't present then a pattern is expected
  122
+        _message -e patterns 'pattern' && ret=0
  123
+      else
  124
+        _files
  125
+      fi
  126
+    ;;
  127
+    colors)
  128
+      local colors; colors=(
  129
+        'black'      'on_black'
  130
+        'red'        'on_red'
  131
+        'green'      'on_green'
  132
+        'yellow'     'on_yellow'
  133
+        'blue'       'on_blue'
  134
+        'magenta'    'on_magenta'
  135
+        'cyan'       'on_cyan'
  136
+        'white'      'on_white'
  137
+        'clear'
  138
+        'reset'
  139
+        'dark'
  140
+        'bold'
  141
+        'underline'
  142
+        'underscore'
  143
+        'blink'
  144
+        'reverse'
  145
+        'concealed'
  146
+      )
  147
+      _describe -t 'colors' 'color' colors && ret=0
  148
+    ;;
  149
+    type-defs)
  150
+      if compset -P '*='; then
  151
+        local extensions; extensions=(*.*(:e))
  152
+        _values -s ',' 'file extension' '.'$extensions && ret=0
  153
+      else
  154
+        _message -e type-name 'type name' && ret=0
  155
+      fi
  156
+    ;;
  157
+    types)
  158
+      local types; types=({'','no'}${_ack_raw_types/ ##/:})
  159
+      _describe -t 'types' 'type' types
  160
+    ;;
  161
+  esac
  162
+
  163
+  return ret
  164
+}
  165
+
  166
+_ack_types_caching_policy() {
  167
+
  168
+  # Rebuild if ackrc more recent than cache.
  169
+  [[ -f ${ACKRC:-$HOME/.ackrc} && ${ACKRC:-$HOME/.ackrc} -nt "$1" ]] && return 0
  170
+
  171
+  # Rebuild if cache is older than one week.  
  172
+  local -a oldp
  173
+  oldp=( "$1"(Nmw+1) )
  174
+  (( $#oldp )) && return 0
  175
+
  176
+  return 1
  177
+}
  178
+
  179
+_ack "$@"
  180
+
  181
+# Local Variables:
  182
+# mode: Shell-Script
  183
+# sh-indentation: 2
  184
+# indent-tabs-mode: nil
  185
+# sh-basic-offset: 2
  186
+# End:
  187
+# vim: ft=zsh sw=2 ts=2 et
422  .zsh/completion/_adb
... ...
@@ -0,0 +1,422 @@
  1
+#compdef adb
  2
+# ------------------------------------------------------------------------------
  3
+# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
  4
+# All rights reserved.
  5
+#
  6
+# Redistribution and use in source and binary forms, with or without
  7
+# modification, are permitted provided that the following conditions are met:
  8
+#     * Redistributions of source code must retain the above copyright
  9
+#       notice, this list of conditions and the following disclaimer.
  10
+#     * Redistributions in binary form must reproduce the above copyright
  11
+#       notice, this list of conditions and the following disclaimer in the
  12
+#       documentation and/or other materials provided with the distribution.
  13
+#     * Neither the name of the zsh-users nor the
  14
+#       names of its contributors may be used to endorse or promote products
  15
+#       derived from this software without specific prior written permission.
  16
+#
  17
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  18
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20
+# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
  21
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27
+# ------------------------------------------------------------------------------
  28
+# Description
  29
+# -----------
  30
+#
  31
+#  Completion script for adb (Android Debug Bridge) 1.0.26
  32
+#  (http://developer.android.com/guide/developing/tools/adb.html).
  33
+#
  34
+# ------------------------------------------------------------------------------
  35
+# Authors
  36
+# -------
  37
+#
  38
+#  * Julien Nicoulaud <julien.nicoulaud@gmail.com>
  39
+#
  40
+# ------------------------------------------------------------------------------
  41
+
  42
+
  43
+_adb() {
  44
+  typeset -A opt_args
  45
+  local context state line curcontext="$curcontext" adb_args
  46
+
  47
+  local ret=1
  48
+
  49
+  _arguments -C \
  50
+    '(-e -s)-d[directs command to the only connected USB device, returns an error if more than one USB device is present]' \
  51
+    '(-d -s)-e[directs command to the only running emulator, returns an error if more than one emulator is running]' \
  52
+    '(-d -e)-s[directs command to the USB device or emulator with the given serial number]: :_adb_serial_numbers' \
  53
+    '-p[simple product name or a relative/absolute path to a product out directory]: :_adb_products' \
  54
+    '1: :_adb_cmds' \
  55
+    '*::arg:->args' \
  56
+  && ret=0
  57
+
  58
+  adb_args="${(fkv)opt_args[(I)-d|-e|-s|-p]}"
  59
+
  60
+  case "$state" in
  61
+    (args)
  62
+      curcontext="${curcontext%:*:*}:adb-cmd-$words[1]:"
  63
+      case $words[1] in
  64
+        (help|version|devices|jdwp|bugreport|wait-for-device|start-server|kill-server|get-state|get-serialno|status-window|remount|reboot-bootloader|root|usb)
  65
+          _message 'no more arguments' && ret=0
  66
+        ;;
  67
+        (connect|disconnect)
  68
+          _arguments \
  69
+            '1: :_adb_host_colon_ports' \
  70
+          && ret=0
  71
+        ;;
  72
+        (push)
  73
+          _arguments \
  74
+            '1:local directory:_files -/' \
  75
+            '2: :_adb_remote_files -/' \
  76
+          && ret=0
  77
+        ;;
  78
+        (pull)
  79
+          _arguments \
  80
+            '1: :_adb_remote_files -/' \
  81
+            '2:local directory:_files -/' \
  82
+          && ret=0
  83
+        ;;
  84
+        (sideload)
  85
+          _arguments \
  86
+            '1:local directory:_files -/' \
  87
+          && ret=0
  88
+        ;;
  89
+        (sync)
  90
+          _arguments \
  91
+            '-l[list but do not copy]' \
  92
+            '1: :_adb_sync_directories' \
  93
+          && ret=0
  94
+        ;;
  95
+        (shell|emu)
  96
+          _arguments -C \
  97
+            '1: :_adb_remote_commands' \
  98
+            '*::remote-command-arg:->remote-command-args' \
  99
+          && ret=0
  100
+          case "$state" in
  101
+            (remote-command-args)
  102
+              curcontext="${curcontext%:*:*}:adb-remote-cmd-$words[1]:"
  103
+              if (( $+functions[_adb_remote_command_$words[1]_args] )); then
  104
+                _adb_remote_command_$words[1] && ret=0
  105
+                # TODO Write handlers for following commands:
  106
+                #  * am (Activity Manager)
  107
+                #  * pm (Package Manager)
  108
+                # TODO Reuse existing compdefs for standard commands (ls, id, ifconfig, kill, etc) ?
  109
+                #      How do we tell them to use _remote_ files/pids/users/etc ?
  110
+              else
  111
+                _adb_remote_command_default && ret=0
  112
+              fi
  113
+            ;;
  114
+          esac
  115
+        ;;
  116
+        (logcat)
  117
+           local -a rotation_opts
  118
+           [[ -n ${(M)words:#"-f"} ]] && rotation_opts+=('-r[rotates the log file every kbytes of output. The default value is 16]:value (in kb)')
  119
+           [[ -n ${(M)words:#"-r"} ]] && rotation_opts+=('-n[sets the maximum number of rotated logs. The default value is 4]:count')
  120
+          _arguments \
  121
+            '-b[loads an alternate log buffer for viewing, such as event or radio. The main buffer is used by default]: :_adb_logcat_buffers' \
  122
+            '-c[clears (flushes) the entire log and exits]' \
  123
+            '-d[dumps the log to the screen and exits]' \
  124
+            '-f[writes log message output to file. The default is stdout]: :_files' \
  125
+            '-g[prints the size of the specified log buffer and exits]' \
  126
+            '-s[sets the default filter spec to silent]' \
  127
+            '-v[sets the output format for log messages]: :_adb_logcat_output_formats' \
  128
+            "${rotation_opts[@]}" \
  129
+            '*: :_adb_logcat_filter_specs' \
  130
+          && ret=0
  131
+        ;;
  132
+        (forward)
  133
+          _arguments \
  134
+            '1: :_adb_local_forward_specs' \
  135
+            '2: :_adb_remote_forward_specs' \
  136
+          && ret=0
  137
+        ;;
  138
+        (install)
  139
+          _arguments \
  140
+            '-l[forward-lock the app]' \
  141
+            '-r[reinstall the app, keeping its data]' \
  142
+            '-s[install on SD card instead of internal storage]' \
  143
+            '1: :_files' \
  144
+          && ret=0
  145
+        ;;
  146
+        (uninstall)
  147
+          _arguments \
  148
+            '-k[keep the data and cache directories]' \
  149
+            '1: :_adb_packages' \
  150
+          && ret=0
  151
+        ;;
  152
+        (reboot)
  153
+          _arguments \
  154
+            '1:program:((bootloader:reboot\ into\ the\ bootloader\ program recovery:reboot\ into\ the\ recovery\ program))' \
  155
+          && ret=0
  156
+        ;;
  157
+        (tcpip)
  158
+          _arguments \
  159
+            '1::port' \
  160
+          && ret=0
  161
+        ;;
  162
+        (ppp)
  163
+          # TODO Complete tty (See http://developer.android.com/guide/developing/tools/adb.html#commandsummary)
  164
+          # TODO Complete PPP parameters (See http://ppp.samba.org/pppd.html)
  165
+          _arguments \
  166
+            '1::tty' \
  167
+            '*::parameters' \
  168
+          && ret=0
  169
+        ;;
  170
+      esac
  171
+    ;;
  172
+  esac
  173
+
  174
+  return ret
  175
+}
  176
+
  177
+(( $+functions[_adb_cmds] )) ||
  178
+_adb_cmds() {
  179
+  _alternative \
  180
+    'general-commands:general command:_adb_general_cmds' \
  181
+    'device-commands:device command:_adb_device_cmds' \
  182
+    'scripting-commands:scripting command:_adb_scripting_cmds'
  183
+}
  184
+
  185
+(( $+functions[_adb_general_cmds] )) ||
  186
+_adb_general_cmds() {
  187
+  local commands; commands=(
  188
+    'help:show help message'
  189
+    'version:show version number'
  190
+    'devices:list all connected devices'
  191
+    'connect:connect to a device via TCP/IP'
  192
+    'disconnect:disconnect from a TCP/IP device'
  193
+  )
  194
+  _describe -t general-commands 'general command' commands "$@"
  195
+}
  196
+
  197
+(( $+functions[_adb_device_cmds] )) ||
  198
+_adb_device_cmds() {
  199
+  local commands; commands=(
  200
+    'push:copy file/dir to device'
  201
+    'pull:copy file/dir from device'
  202
+    'sync:copy host->device only if changed'
  203
+    'shell:run remote shell interactively or command'
  204
+    'emu:run emulator console command'
  205
+    'logcat:view device log'
  206
+    'forward:forward socket connections'
  207
+    'jdwp:list PIDs of processes hosting a JDWP transport'
  208
+    'install:push this padbage file to the device and install it'
  209
+    'uninstall:remove this app padbage from the device'
  210
+    'bugreport:return all information from the device'
  211
+  )
  212
+  _describe -t device-commands 'device command' commands "$@"
  213
+}
  214
+
  215
+(( $+functions[_adb_scripting_cmds] )) ||
  216
+_adb_scripting_cmds() {
  217
+  local commands; commands=(
  218
+    'wait-for-device:block until device is online'
  219
+    'start-server:ensure that there is a server running'
  220
+    'kill-server:kill the server if it is running'
  221
+    'get-state:prints\: offline | bootloader | device'
  222
+    'get-serialno:prints\: <serial-number>'
  223
+    'status-window:continuously print device status for a specified device'
  224
+    'remount:remounts the /system partition on the device read-write'
  225
+    'reboot:reboots the device, optionally into the bootloader or recovery program'
  226
+    'reboot-bootloader:reboots the device into the bootloader'
  227
+    'root:restarts the adbd daemon with root permissions'
  228
+    'usb:restarts the adbd daemon listening on USB'
  229
+    'tcpip:restarts the adbd daemon listening on TCP on the specified port'
  230
+    'ppp:run PPP over USB'
  231
+  )
  232
+  _describe -t scripting-commands 'scripting command' commands "$@"
  233
+}
  234
+
  235
+(( $+functions[_adb_products] )) ||
  236
+_adb_products() {
  237
+  _alternative \
  238
+    'product-names:product name:_adb_product_names' \
  239
+    'directories:directory:_files -/'
  240
+}
  241
+
  242
+(( $+functions[_adb_product_names] )) ||
  243
+_adb_product_names() {
  244
+  local ret=1
  245
+  if [[ -n "$ANDROID_PRODUCT_OUT" ]]; then
  246
+    local product_names; product_names=("$ANDROID_PRODUCT_OUT:default value set in ANDROID_PRODUCT_OUT environment variable")
  247
+    _describe -t product-names 'product name' product_names && ret=0
  248
+  else
  249
+    _message -e product-names 'product name' && ret=0
  250
+  fi
  251
+  return ret
  252
+}
  253
+
  254
+(( $+functions[_adb_serial_numbers] )) ||
  255
+_adb_serial_numbers() {
  256
+  local serial_numbers; serial_numbers=(${${(M)${(f)"$(_call_program devices $service devices)"}:#*device}%%[[:space:]]*}":connected device")
  257
+  [[ -n "$ANDROID_SERIAL" ]] && serial_numbers+=("$ANDROID_SERIAL:default value set in ANDROID_SERIAL environment variable")
  258
+  _describe -t serial-numbers 'serial number' serial_numbers "$@" && ret=0
  259
+}
  260
+
  261
+(( $+functions[_adb_packages] )) ||
  262
+_adb_packages() {
  263
+  local packages; packages=(${${(ps:\r\n:)"$(_call_program packages $service $adb_args shell 'ls /data/data 2>/dev/null')"}:#\**\*})
  264
+  _multi_parts . packages
  265
+}
  266
+
  267
+(( $+functions[_adb_host_colon_ports] )) ||
  268
+_adb_host_colon_ports() {
  269
+  local ret=1
  270
+  if compset -P '*:'; then
  271
+    _message -e ports 'port' && ret=0
  272
+  else
  273
+    _wanted hosts expl 'host' _hosts -qS: && ret=0
  274
+  fi
  275
+  return ret
  276
+}
  277
+
  278
+(( $+functions[_adb_remote_files] )) ||
  279
+_adb_remote_files() {
  280
+  local dirsonly command="ls -d ${(S)words[CURRENT]/\/*//}*/ 2>/dev/null"
  281
+  zparseopts -D -E '/=dirsonly'
  282
+  (( ! $#dirsonly )) && command+="; ls -d ${words[CURRENT]}* 2>/dev/null"
  283
+  local files; files=(${${(ps:\r\n:)"$(_call_program files $service $adb_args shell "'$command'" 2>/dev/null)"}:#\**\*})
  284
+  _multi_parts "$@" / files
  285
+}
  286
+
  287
+(( $+functions[_adb_remote_commands] )) ||
  288
+_adb_remote_commands() {
  289
+  local commands; commands=(${${(ps:\r\n:)"$(_call_program commands $service $adb_args shell "'IFS=:;for path_dir in \$PATH; do ls \$path_dir 2>/dev/null; done'" 2>/dev/null)"}:#\**\*})
  290
+  _describe -t remote-commands 'remote command' commands && ret=0
  291
+}
  292
+
  293
+(( $+functions[_adb_local_forward_specs] )) ||
  294
+_adb_local_forward_specs() {
  295
+  local ret=1
  296
+  if compset -P '*:'; then
  297
+    case ${IPREFIX%:} in
  298
+      (tcp)
  299
+        _message -e ports 'port' && ret=0
  300
+      ;;
  301
+      (localabstract|localreserved)
  302
+        _wanted sockets expl 'socket' _socket && ret=0
  303
+      ;;
  304
+      (localfilesystem)
  305
+        _wanted socket-files expl 'socket file' _files && ret=0
  306
+      ;;
  307
+      (dev)
  308
+        _wanted devices expl 'device' _files -g "/dev/**" && ret=0
  309
+      ;;
  310
+    esac
  311
+  else
  312
+    local modes; modes=(
  313
+      'tcp:TCP socket'
  314
+      'localabstract:local abstract socket'
  315
+      'localreserved:local reserved socket'
  316
+      'localfilesystem:local filesystem socket'
  317
+      'dev:device'
  318
+    )
  319
+    _describe -t forward-modes 'forward mode' modes -qS: && ret=0
  320
+  fi
  321
+  return ret
  322
+}
  323
+
  324
+(( $+functions[_adb_remote_forward_specs] )) ||
  325
+_adb_remote_forward_specs() {
  326
+  local ret=1
  327
+  if compset -P '*:'; then
  328
+    case ${IPREFIX%:} in
  329
+      (tcp)
  330
+        _message -e ports 'remote port' && ret=0
  331
+      ;;
  332
+      (localabstract|localreserved|localfilesystem)
  333
+        _message -e sockets 'remote socket' && ret=0
  334
+      ;;
  335
+      (dev)
  336
+        _message -e devices 'remote device' && ret=0
  337
+      ;;
  338
+      (jdwp)
  339
+        local pids; pids=(${${(f)"$(_call_program pids $service $adb_args jdwp 2>/dev/null)"}:#\**\*})
  340
+        _describe -t remote-pids 'remote pid' pids && ret=0
  341
+      ;;
  342
+    esac
  343
+  else
  344
+    local modes; modes=(
  345
+      'tcp:TCP socket'
  346
+      'localabstract:local abstract socket'
  347
+      'localreserved:local reserved socket'
  348
+      'localfilesystem:local filesystem socket'
  349
+      'dev:device'
  350
+      'jdwp:Java Debug Wire Protocol'
  351
+    )
  352
+    _describe -t forward-modes 'forward mode' modes -qS: && ret=0
  353
+  fi
  354
+  return ret
  355
+}
  356
+
  357
+(( $+functions[_adb_sync_directories] )) ||
  358
+_adb_sync_directories() {
  359
+  _alternative \
  360
+    'partitions:partition:((system:the\ /system\ partition data:the\ /data\ partition))' \
  361
+    'directories:directory:_adb_remote_files -/'
  362
+}
  363
+
  364
+(( $+functions[_adb_logcat_filter_specs] )) ||
  365
+_adb_logcat_filter_specs() {
  366
+  local ret=1
  367
+  if compset -P '*:'; then
  368
+    local priorities; priorities=(
  369
+      'V:verbose (lowest priority)'
  370
+      'D:debug'
  371
+      'I:info'
  372
+      'W:warning'
  373
+      'E:error'
  374
+      'F:fatal'
  375
+      'S:silent (highest priority, on which nothing is ever printed)'
  376
+    )
  377
+    _describe -t log-priorities 'log priority' priorities "$@" && ret=0
  378
+  else
  379
+    local tags; tags=(${(u)${${${(f)"$(_call_program tags $service $adb_args logcat -d 2>/dev/null)"}%%[[:space:]]#\(*}##*\/}:#\**\*})
  380
+    _describe -t log-tags 'log tag' tags -qS: "$@" && ret=0
  381
+  fi
  382
+  return ret
  383
+}
  384
+
  385
+(( $+functions[_adb_logcat_output_formats] )) ||
  386
+_adb_logcat_output_formats() {
  387
+  local formats; formats=(
  388
+    'brief:display priority/tag and PID of originating process (the default format)'
  389
+    'process:display PID only'
  390
+    'tag:display the priority/tag only'
  391
+    'thread:display process:thread and priority/tag only'
  392
+    'raw:display the raw log message, with no other metadata fields'
  393
+    'time:display the date, invocation time, priority/tag, and PID of the originating process'
  394
+    'long:display all metadata fields and separate messages with a blank lines'
  395
+  )
  396
+  _describe -t log-formats 'log format' formats "$@" && ret=0
  397
+}
  398
+
  399
+(( $+functions[_adb_logcat_buffers] )) ||
  400
+_adb_logcat_buffers() {
  401
+  local buffers; buffers=(
  402
+    'main:view the main log buffer (default)'
  403
+    'radio:view the buffer that contains radio/telephony related messages'
  404
+    'events:view the buffer containing events-related messages'
  405
+  )
  406
+  _describe -t log-buffers 'log buffer' buffers "$@" && ret=0
  407
+}
  408
+
  409
+(( $+functions[_adb_remote_command_default] )) ||
  410
+_adb_remote_command_default() {
  411
+  _wanted remote-files expl 'remote file' _adb_remote_files
  412
+}
  413
+
  414
+_adb "$@"
  415
+
  416
+# Local Variables:
  417
+# mode: Shell-Script
  418
+# sh-indentation: 2
  419
+# indent-tabs-mode: nil
  420
+# sh-basic-offset: 2
  421
+# End:
  422
+# vim: ft=zsh sw=2 ts=2 et
89  .zsh/completion/_ag
... ...
@@ -0,0 +1,89 @@
  1
+#compdef ag
  2
+# ------------------------------------------------------------------------------
  3
+# Description
  4
+# -----------
  5
+#
  6
+#  Completion script for ag (https://github.com/ggreer/the_silver_searcher)
  7
+#
  8
+# ------------------------------------------------------------------------------
  9
+# Authors
  10
+# -------
  11
+#
  12
+#  * Akira Maeda <https://github.com/glidenote>
  13
+#
  14
+# ------------------------------------------------------------------------------
  15
+# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
  16
+# vim: ft=zsh sw=2 ts=2 et
  17
+# ------------------------------------------------------------------------------
  18
+
  19
+_ag() {
  20
+
  21
+  local curcontext="$curcontext" state line cmds update_policy ret=1
  22
+
  23
+  zstyle -s ":completion:${curcontext}:" cache-policy update_policy
  24
+  [[ -z "$update_policy" ]] && zstyle ":completion:${curcontext}:" cache-policy _ag_types_caching_policy
  25
+
  26
+  _arguments -C \
  27
+    '(- 1 *)--version[display version and copyright information]' \
  28
+    '(- 1 *)--help[print a short help statement]' \
  29
+    '(- 1 *)--man[print the manual page]' \
  30
+    '(--ackmate)--ackmate[Output results in a format parseable by AckMate.]' \
  31
+    '(-a --all-types)'{-a,--all-types}"[Search all files. This doesn't include hidden files, and also doesn't respect any ignore files.]" \
  32
+    '(-A --after)'{-A,--after}'[Print lines before match. Defaults to 2.]:LINES' \
  33
+    '(-B --before)'{-B,--before}'[Print lines after match. Defaults to 2.]:LINES' \
  34
+    '(--nobreak --break)'{--nobreak,--break}'[Print a newline between matches in different files. Enabled by default.]' \
  35
+    '(--nocolor --color)'{--nocolor,--color}'[Print color codes in results. Enabled by default.]' \
  36
+    '(--column)--column[Print column numbers in results.]' \
  37
+    '(-C --context)'{-C,--context}'[Print lines before and after matches. Defaults to 2.]:LINES' \
  38
+    '(-D --debug)'{-D,--debug}'[Ridiculous debugging. Probably not useful.]' \
  39
+    '(--depth)--depth[Search up to NUM directories deep. Default is 25.]:NUM' \
  40
+    '(-f --follow)'{-f,--follow}'[Follow symlinks.]' \
  41
+    '(--nogroup --group)'{--nogroup,--group}'[Same as --\[no\]break --\[no\]heading]' \
  42
+    '(-g)-g[Print filenames that match PATTERN]:PATTERN' \
  43
+    '(-G --file-search-regex)'{-G,--file-search-regex}'[Only search file names matching PATTERN]:PATTERN' \
  44
+    '(--noheading --heading)'{--noheading,--heading}'[\[no\]heading]' \
  45
+    '(--hidden)--hidden[Search hidden files. This option obeys ignore files.]' \
  46
+    '(-i --ignore-case)'{-i,--ignore-case}'[Match case insensitively]:PATTERN' \
  47
+    '(--ignore)--ignore[Ignore files/directories matching this pattern. Literal file and directory names are also allowed.]' \
  48
+    '(-l --files-with-matches)'{-l,--files-with-matches}'[Only print filenames containing matches, not matching lines.]' \
  49
+    '(-L --files-without-matches)'{-L,--files-without-matches}"[Only print filenames that don't contain matches.]" \
  50
+    '(-m --max-count)'{-m,--max-count}'[Skip the rest of a file after NUM matches. Default is 10,000.]:NUM' \
  51
+    '(-p --path-to-agignore)'{-p,--path-to-agignore}'[Provide a path to a specific .agignore file]:STRING' \
  52
+    '(--print-long-lines)--print-long-lines[Print matches on very long lines (> 2k characters by default)]' \
  53
+    '(-Q --literal)'{-Q,--literal}'[Do not parse PATTERN as a regular expression. Try to match it literally.]' \
  54
+    '(-s --case-sensitive)'{-s,--case-sensitive}'[Match case sensitively. Enabled by default.]' \
  55
+    '(-S --smart-case)'{-S,--smart-case}'[Match case sensitively if there are any uppercase letters in PATTERN, or case insensitively otherwise.]' \
  56
+    '(--search-binary)--search-binary[Search binary files for matches.]' \
  57
+    '(--stats)--stats[Print stats (files scanned, time taken, etc)]' \
  58
+    '(-t --all-text)'{-t,--all-text}"[Search all text files. This doesn't include hidden files.]" \
  59
+    '(-u --unrestricted)'{-u,--unrestricted}'[Search *all* files. This ignores .agignore, .gitignore, etc. It searches binary and hidden files as well.]' \
  60
+    '(-U --skip-vcs-ignores)'{-U,--skip-vcs-ignores}'[Ignore VCS ignore files (.gitigore, .hgignore, svn:ignore), but still use .agignore.]' \
  61
+    '(-v --invert-match)'{-v,--invert-match}'[invert match]' \
  62
+    '(-w --word-regexp)'{-w,--word-regexp}'[Only match whole words.]' \
  63
+    '1: :->patterns' \
  64
+    '*: :_files' \
  65
+    && ret=0
  66
+
  67
+  case $state in
  68
+    patterns)
  69
+      _message -e patterns 'pattern' && ret=0
  70
+      ;;
  71
+  esac
  72
+
  73
+  return ret
  74
+}
  75
+
  76
+_ag_types_caching_policy() {
  77
+
  78
+  # Rebuild if .agignore more recent than cache.
  79
+  [[ -f $HOME/.agignore && $$HOME/.agignore -nt "$1" ]] && return 0
  80
+
  81
+  # Rebuild if cache is older than one week.  
  82
+  local -a oldp
  83
+  oldp=( "$1"(Nmw+1) )
  84
+  (( $#oldp )) && return 0
  85
+
  86
+  return 1
  87
+}
  88
+
  89
+_ag "$@"
331  .zsh/completion/_android
... ...
@@ -0,0 +1,331 @@
  1
+#compdef android
  2
+# ------------------------------------------------------------------------------
  3
+# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
  4
+# All rights reserved.
  5
+#
  6
+# Redistribution and use in source and binary forms, with or without
  7
+# modification, are permitted provided that the following conditions are met:
  8
+#     * Redistributions of source code must retain the above copyright
  9
+#       notice, this list of conditions and the following disclaimer.
  10
+#     * Redistributions in binary form must reproduce the above copyright
  11
+#       notice, this list of conditions and the following disclaimer in the
  12
+#       documentation and/or other materials provided with the distribution.
  13
+#     * Neither the name of the zsh-users nor the
  14
+#       names of its contributors may be used to endorse or promote products
  15
+#       derived from this software without specific prior written permission.
  16
+#
  17
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  18
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20
+# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
  21
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27
+# ------------------------------------------------------------------------------
  28
+# Description
  29
+# -----------
  30
+#
  31
+#  Completion script for the android command (Revision 12)
  32
+#  (http://developer.android.com/guide/developing/tools/android.html).
  33
+#
  34
+# ------------------------------------------------------------------------------
  35
+# Authors
  36
+# -------
  37
+#
  38
+#  * Julien Nicoulaud <julien.nicoulaud@gmail.com>
  39
+#
  40
+# ------------------------------------------------------------------------------
  41
+
  42
+
  43
+_android() {
  44
+  typeset -A opt_args
  45
+  local context state line curcontext="$curcontext"
  46
+
  47
+  local ret=1
  48
+  
  49
+  _arguments -C -A "-*" \
  50
+    '(- : *)'{-h,--help}'[get help on a specific command]:command:_android_cmds' \
  51
+    '(-s --silent -v --verbose)'{-v,--verbose}'[verbose mode: errors, warnings and informational messages are printed]' \
  52
+    '(-v --verbose -s --silent)'{-s,--silent}'[silent mode: only errors are printed out]' \
  53
+    '1: :_android_cmds' \
  54
+    '*::arg:->args' \
  55
+  && ret=0
  56
+
  57
+  case "$state" in
  58
+    (args)
  59
+      curcontext="${curcontext%:*:*}:android-cmd-$words[1]:"
  60
+      case $words[1] in
  61
+        (list)
  62
+          _arguments -C \
  63
+            '1: :_android_list_entities' \
  64
+            '*::list-arg:->list-args' \
  65
+          && ret=0
  66
+          case "$state" in
  67
+            (list-args)
  68
+              case $words[1] in
  69
+                (avd|target)
  70
+                  _arguments \
  71
+                    '(-0 --null)'{-0,--null}'[terminate lines with \0 instead of \n (e.g. for xargs -0)]' \
  72
+                    '(-c --compact)'{-c,--compact}'[compact output (suitable for scripts)]' \
  73
+                  && ret=0
  74
+                ;;
  75
+                (sdk)
  76
+                  _arguments \
  77
+                    '(-o --obsolete)'{-o,--obsolete}'[install obsolete packages]' \
  78
+                    '--proxy-host[HTTP/HTTPS proxy host (overrides settings if defined)]:proxy host:_hosts' \
  79
+                    '--proxy-port[HTTP/HTTPS proxy port (overrides settings if defined)]:proxy port number' \
  80
+                    '(-s --no-https)'{-s,--no-https}'[use HTTP instead of HTTPS (the default) for downloads]' \
  81
+                    '(-u --no-ui)'{-u,--no-ui}'[display list result on console (no GUI)]' \
  82
+                  && ret=0
  83
+                ;;
  84
+              esac
  85
+            ;;
  86
+          esac
  87
+        ;;
  88
+        (create)
  89
+          _arguments -C \
  90
+            '1: :_android_create_entities' \
  91
+            '*::create-arg:->create-args' \
  92
+          && ret=0
  93
+          case "$state" in
  94
+            (create-args)
  95
+              case $words[1] in
  96
+                (avd)
  97
+                  _arguments \
  98
+                    '(-c --sdcard)'{-c,--sdcard}'[path to a shared SD card image, or size of a new sdcard for the new AVD]:SD card image or size:_files -g "*.img"' \
  99
+                    '(-n --name)'{-n,--name}'[name of the new AVD]:name' \
  100
+                    '(-a --snapshot)'{-a,--snapshot}'[place a snapshots file in the AVD, to enable persistence]' \
  101
+                    '(-p --path)'{-p,--path}'[directory where the new AVD will be created]: :_files -/' \
  102
+                    '(-f --force)'{-f,--force}'[forces creation (overwrites an existing AVD)]' \
  103
+                    '(-s --skin)'{-s,--skin}'[skin for the new AVD]:skin' \
  104
+                    '(-t --target)'{-t,--target}'[target ID of the new AVD]: :_android_targets' \
  105
+                  && ret=0
  106
+                ;;
  107
+                (project)
  108
+                  _arguments \
  109
+                    '(-n --name)'{-n,--name}'[project name]:project name' \
  110
+                    '(-p --path)'{-p,--path}'[the new project'\''s directory]: :_files -/' \
  111
+                    '(-k --package)'{-k,--package}'[Android package name for the application]:package name' \
  112
+                    '(-a --activity)'{-a,--activity}'[name of the default Activity that is created]:activity name' \
  113
+                    '(-t --target)'{-t,--target}'[target ID of the new project]: :_android_targets' \
  114
+                  && ret=0
  115
+                ;;
  116
+                (test-project)
  117
+                  _arguments \
  118
+                    '(-n --name)'{-n,--name}'[project name]:project name' \
  119
+                    '(-p --path)'{-p,--path}'[the new project'\''s directory]: :_files -/' \
  120
+                    '(-m --main)'{-m,--main}'[path to directory of the app under test, relative to the test project directory]:path' \
  121
+                  && ret=0
  122
+                ;;
  123
+                (lib-project)
  124
+                  _arguments \
  125
+                    '(-n --name)'{-n,--name}'[project name]:project name' \
  126
+                    '(-p --path)'{-p,--path}'[the new project'\''s directory]: :_files -/' \
  127
+                    '(-k --package)'{-k,--package}'[Android package name for the application]:package name' \
  128
+                    '(-t --target)'{-t,--target}'[target ID of the new project]: :_android_targets' \
  129
+                  && ret=0
  130
+                ;;
  131
+              esac
  132
+            ;;
  133
+          esac
  134
+        ;;
  135
+        (update)
  136
+          _arguments -C \
  137
+            '1: :_android_update_entities' \
  138
+            '*::update-arg:->update-args' \
  139
+          && ret=0
  140
+          case "$state" in
  141
+            (update-args)
  142
+              case $words[1] in
  143
+                (avd)
  144
+                  _arguments \
  145
+                    '(-n --name)'{-n,--name}'[name of the AVD to update]: :_android_avd_names' \
  146
+                  && ret=0
  147
+                ;;
  148
+                (project)
  149
+                  _arguments \
  150
+                    '(-l --library)'{-l,--library}'[directory of an Android library to add, relative to this project'\''s directory]: :_files -/' \
  151
+                    '(-p --path)'{-p,--path}'[the project'\''s directory]: :_files -/' \
  152
+                    '(-n --name)'{-n,--name}'[project name]:name' \
  153
+                    '(-t --target)'{-t,--target}'[target ID to set for the project]: :_android_targets' \
  154
+                    '(-s --subprojects)'{-s,--subprojects}'[also updates any projects in sub-folders, such as test projects]' \
  155
+                  && ret=0
  156
+                ;;
  157
+                (test-project)
  158
+                  _arguments \
  159
+                    '(-p --path)'{-p,--path}'[the project'\''s directory]: :_files -/' \
  160
+                    '(-m --main)'{-m,--main}'[directory of the app under test, relative to the test project directory]:path' \
  161
+                  && ret=0
  162
+                ;;
  163
+                (lib-project)
  164
+                  _arguments \
  165
+                    '(-p --path)'{-p,--path}'[the project'\''s directory]: :_files -/' \
  166
+                    '(-t --target)'{-t,--target}'[target ID to set for the project]: :_android_targets' \
  167
+                  && ret=0
  168
+                ;;
  169
+                (sdk)
  170
+                  _arguments \
  171
+                    '(-o --obsolete)'{-o,--obsolete}'[install obsolete packages]' \
  172
+                    '--proxy-host[HTTP/HTTPS proxy host (overrides settings if defined)]:proxy host:_hosts' \
  173
+                    '--proxy-port[HTTP/HTTPS proxy port (overrides settings if defined)]:proxy port number' \
  174
+                    '(-s --no-https)'{-s,--no-https}'[use HTTP instead of HTTPS (the default) for downloads]' \
  175
+                    '(-u --no-ui)'{-u,--no-ui}'[update from command-line (no GUI)]' \
  176
+                    '(-f --force)'{-f,--force}'[force replacement of a package or its parts, even if something has been modified]' \
  177
+                    '(-t --filter)'{-t,--filter}'[a filter that limits the update to the specified types of packages]: :_android_sdk_update_filters -s ,' \
  178
+                    '(-n --dry-mode)'{-n,--dry-mode}'[simulate the update but does not download or install anything]' \
  179
+                  && ret=0
  180
+                ;;
  181
+              esac
  182
+            ;;
  183
+          esac
  184
+        ;;
  185
+        (move)
  186
+          _arguments -C \
  187
+            '1: :_android_move_entities' \
  188
+            '*::move-arg:->move-args' \
  189
+          && ret=0
  190
+          case "$state" in
  191
+            (move-args)
  192
+              case $words[1] in
  193
+                (avd)
  194
+                  _arguments \
  195
+                    '(-n --name)'{-n,--name}'[name of the AVD to move or rename]: :_android_avd_names' \
  196
+                    '(-p --path)'{-p,--path}'[path to the AVD'\''s new directory]: :_files -/' \
  197
+                    '(-r --rename)'{-r,--rename}'[new name of the AVD]:name' \
  198
+                  && ret=0
  199
+                ;;
  200
+              esac
  201
+            ;;
  202
+          esac
  203
+        ;;
  204
+        (delete)
  205
+          _arguments -C \
  206
+            '1: :_android_delete_entities' \
  207
+            '*::delete-arg:->delete-args' \
  208
+          && ret=0
  209
+          case "$state" in
  210
+            (delete-args)
  211
+              case $words[1] in
  212
+                (avd)
  213
+                  _arguments \
  214
+                    '(-n --name)'{-n,--name}'[name of the AVD to delete]: :_android_avd_names' \
  215
+                  && ret=0
  216
+                ;;
  217
+              esac
  218
+            ;;
  219
+          esac
  220
+        ;;
  221
+        (display)
  222
+          _arguments \
  223
+            '1: :_android_display_entities' \
  224
+          && ret=0
  225
+        ;;
  226
+      esac
  227
+    ;;
  228
+  esac
  229
+
  230
+  return ret
  231
+}
  232
+
  233
+(( $+functions[_android_cmds] )) ||
  234
+_android_cmds() {
  235
+  local commands; commands=(
  236
+    'list:list existing targets or virtual devices'
  237
+    'create:create new virtual devices or projects'
  238
+    'update:update a virtual device, project, SDK or adb'
  239
+    'move:move a virtual device'
  240
+    'delete:delete a virtual device'
  241
+    'display:display manager windows'
  242
+  )
  243
+  _describe -t commands 'command' commands "$@"
  244
+}
  245
+
  246
+(( $+functions[_android_list_entities] )) ||
  247
+_android_list_entities() {
  248
+  local entities; entities=(
  249
+    'avd:list existing Android Virtual Devices'
  250
+    'target:list existing targets'
  251
+    'sdk:list remote SDK repository'
  252
+  )
  253
+  _describe -t entities 'entity' entities "$@"
  254
+}
  255
+
  256
+(( $+functions[_android_create_entities] )) ||
  257
+_android_create_entities() {
  258
+  local entities; entities=(
  259
+    'avd:create a new Android Virtual Device'
  260
+    'project:create a new Android project'
  261
+    'test-project:create a new Android project for a test package'
  262
+    'lib-project:create a new Android library project'
  263
+  )
  264
+  _describe -t entities 'entity' entities "$@"
  265
+}
  266
+
  267
+(( $+functions[_android_update_entities] )) ||
  268
+_android_update_entities() {
  269
+  local entities; entities=(
  270
+    'avd:update an Android Virtual Device to match the folders of a new SDK'
  271
+    'project:update an Android project'
  272
+    'test-project:update the Android project for a test package'
  273
+    'lib-project:update an Android library project'
  274
+    'adb:update adb to support the USB devices declared in the SDK add-ons'
  275
+    'sdk:update the SDK by suggesting new platforms to install if available'
  276
+  )
  277
+  _describe -t entities 'entity' entities "$@"
  278
+}
  279
+
  280
+(( $+functions[_android_move_entities] )) ||
  281
+_android_move_entities() {
  282
+  local entities; entities=(
  283
+    'avd:move or rename an Android Virtual Device'
  284
+  )
  285
+  _describe -t entities 'entity' commands "$@"
  286
+}
  287
+
  288
+(( $+functions[_android_delete_entities] )) ||
  289
+_android_delete_entities() {
  290
+  local entities; entities=(
  291
+    'avd:delete an Android Virtual Device'
  292
+  )
  293
+  _describe -t entities 'entity' entities "$@"
  294
+}
  295
+
  296
+(( $+functions[_android_display_entities] )) ||
  297
+_android_display_entities() {
  298
+  local entities; entities=(
  299
+    'sdk:display the SDK Manager window'
  300
+    'avd:display the AVD Manager window'
  301
+  )
  302
+  _describe -t entities 'entity' entities "$@"
  303
+}
  304
+
  305
+(( $+functions[_android_targets] )) ||
  306
+_android_targets() {
  307
+  local targets; targets=(${(f)"$(_call_program targets $service list target --compact)"//:/\\:})
  308
+  _describe -t targets 'target' targets "$@"
  309
+}
  310
+
  311
+(( $+functions[_android_avd_names] )) ||
  312
+_android_avd_names() {
  313
+  local avd_names; avd_names=(${(f)"$(_call_program targets $service list avd --compact)"//:/\\:})
  314
+  _describe -t avd-names 'AVD name' avd_names "$@"
  315
+}
  316
+
  317
+(( $+functions[_android_sdk_update_filters] )) ||
  318
+_android_sdk_update_filters() {
  319
+  local filters; filters=(platform tool platform-tool doc sample extra)
  320
+  _values $@ 'filter' "${filters[@]}"
  321
+}
  322
+
  323
+_android "$@"
  324
+
  325
+# Local Variables:
  326
+# mode: Shell-Script
  327
+# sh-indentation: 2
  328
+# indent-tabs-mode: nil
  329
+# sh-basic-offset: 2
  330
+# End:
  331
+# vim: ft=zsh sw=2 ts=2 et
50  .zsh/completion/_attach
... ...
@@ -0,0 +1,50 @@
  1
+#compdef attach
  2
+# ------------------------------------------------------------------------------
  3
+# Description
  4
+# -----------
  5
+#
  6
+#  Completion script for attach (http://github.com/sorin-ionescu/attach).
  7
+#
  8
+# ------------------------------------------------------------------------------
  9
+# Authors
  10
+# -------
  11
+#
  12
+#  * Sorin Ionescu <sorin.ionescu@gmail.com>
  13
+#
  14
+# ------------------------------------------------------------------------------
  15
+
  16
+local state mode_values existing_sessions ret=1
  17
+
  18
+mode_values=(
  19
+  "none:disable redrawing"
  20
+  "ctrl_l:use ctrl + l to redraw"
  21
+  "winch:use sigwinch to redraw"
  22
+)
  23
+
  24
+existing_sessions=($(_call_program session attach))
  25
+
  26
+_arguments -C -s -S \
  27
+  '(--list -l)'{--list,-l}'[list sessions]' \
  28
+  '(--sockets -L)'{--sockets,-L}'[list sockets]' \
  29
+  '(--session -s)'{--session=,-s+}'[set the session name]:session' \
  30
+  '(--char -c)'{--char=,-c+}'[set the detach character (default: ^\\)]:char' \
  31
+  '(--redraw -r)'{--redraw=,-r+}'[set the redraw method (none, ctrl_l, or winch)]:mode:->mode' \
  32
+  '(--detached -d)'{--detached,-d}'[start the session detached]' \
  33
+  '(--no-detach -D)'{--no-detach,-D}'[disable detaching]' \
  34
+  '(--no-suspend -Z)'{--no-suspend,-Z}'[disable suspending]' \
  35
+  '(--version -v)'{--version,-v}'[display version and copyright]' \
  36
+  '(--help -h)'{--help,-h}'[display help]' \
  37
+  '(-)::args:->session-or-command' && ret=0
  38
+
  39
+case "$state" in
  40
+  (mode)
  41
+    _describe -t mode 'redraw mode' mode_values && ret=0
  42
+  ;;
  43
+  (session-or-command)
  44
+    _describe -t 'session' 'sessions' existing_sessions && ret=0
  45
+    _path_commands && ret=0
  46
+  ;;
  47
+esac
  48
+
  49
+return $ret
  50
+
168  .zsh/completion/_baselayout
... ...
@@ -0,0 +1,168 @@
  1
+#compdef rc-update rc-status rc rc-service
  2
+# ------------------------------------------------------------------------------
  3
+# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
  4
+# All rights reserved.
  5
+#
  6
+# Redistribution and use in source and binary forms, with or without
  7
+# modification, are permitted provided that the following conditions are met:
  8
+#     * Redistributions of source code must retain the above copyright
  9
+#       notice, this list of conditions and the following disclaimer.
  10
+#     * Redistributions in binary form must reproduce the above copyright
  11
+#       notice, this list of conditions and the following disclaimer in the
  12
+#       documentation and/or other materials provided with the distribution.
  13
+#     * Neither the name of the zsh-users nor the
  14
+#       names of its contributors may be used to endorse or promote products
  15
+#       derived from this software without specific prior written permission.
  16
+#
  17
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  18
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20
+# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
  21
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  22
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27
+# ------------------------------------------------------------------------------
  28
+# Description
  29
+# -----------
  30
+#
  31
+#  Completion script for Gentoo Baselayout v2 and OpenRC v0.8 (init system).
  32
+#
  33
+# ------------------------------------------------------------------------------
  34
+# Authors
  35
+# -------
  36
+#
  37
+#  * Vadim A. Misbakh-Soloviov <mva@mva.name>
  38
+#  * Bapt <bapt@tuxfamily.org>
  39
+#  * kaworu <kaworu@kaworu.ch>
  40
+#  * David Durrleman <dualmoo@gmail.com>
  41
+#  * oberyno <oberyno@gmail.com>
  42
+#  * Mamoru Komachi <usata@usata.org>
  43
+#
  44
+# ------------------------------------------------------------------------------
  45
+#<sys-apps/baselayout-1.12.11.1>
  46
+#
  47
+# Status:
  48
+#     rc        (fully done)
  49
+#     rc-update (fully done)
  50
+#     rc-status (fully done)