My personal dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_fab 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #compdef fab
  2. # ------------------------------------------------------------------------------
  3. # Copyright (c) 2015 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 Fabric (http://fabfile.org)
  32. #
  33. # Source: https://github.com/vhbit/fabric-zsh-autocomplete
  34. #
  35. # ------------------------------------------------------------------------------
  36. # Authors
  37. # -------
  38. #
  39. # * Valerii Hiora (https://github.com/vhbit)
  40. #
  41. # ------------------------------------------------------------------------------
  42. local curcontext=$curcontext state line
  43. declare -A opt_args
  44. declare target_list
  45. target_list=(`fab --shortlist 2>/dev/null`)
  46. _targets() {
  47. _describe -t commands "fabric targets" target_list
  48. }
  49. output_levels=(
  50. 'status: Status messages, i.e. noting when Fabric is done running, if the user used a keyboard interrupt, or when servers are disconnected from. These messages are almost always relevant and rarely verbose.'
  51. 'aborts: Abort messages. Like status messages, these should really only be turned off when using Fabric as a library, and possibly not even then. Note that even if this output group is turned off, aborts will still occur – there just won’t be any output about why Fabric aborted!'
  52. 'warnings: Warning messages. These are often turned off when one expects a given operation to fail, such as when using grep to test existence of text in a file. If paired with setting env.warn_only to True, this can result in fully silent warnings when remote programs fail. As with aborts, this setting does not control actual warning behavior, only whether warning messages are printed or hidden.'
  53. 'running: Printouts of commands being executed or files transferred, e.g. [myserver] run: ls /var/www. Also controls printing of tasks being run, e.g. [myserver] Executing task ''foo''.'
  54. 'stdout: Local, or remote, stdout, i.e. non-error output from commands.'
  55. 'stderr: Local, or remote, stderr, i.e. error-related output from commands.'
  56. 'user: User-generated output, i.e. local output printed by fabfile code via use of the fastprint or puts functions.'
  57. )
  58. _arguments -w -S -C \
  59. '(-)'{-h,--help}'[show this help message and exit]: :->noargs' \
  60. '(-)'{-V,--version}'[show program''s version number and exit]: :->noargs' \
  61. '(-)--list[print list of possible commands and exit]: :->noargs' \
  62. '(-)--shortlist[print non-verbose list of possible commands and exit]: :->noargs' \
  63. '(--reject-unknown-hosts)--reject-unknown-hosts[reject unknown hosts]' \
  64. '(--no-pty)--no-pty[do not use pseudo-terminal in run/sudo]' \
  65. "(-d+ --display=-)"{-d+,--display=-}"[print detailed info about a given command]: :_targets" \
  66. '(-D --disable-known-hosts)'{-D,--disable-known-hosts}'[do not load user known_hosts file]' \
  67. '(-r --reject-unknown-hosts)'{-r,--reject-unknown-hosts}'[reject unknown hosts]' \
  68. '(-u+ --user=-)'{-u+,--user=-}'[username to use when connecting to remote hosts]: :' \
  69. '(-p+ --password=-)'{-p+,--password=-}'[password for use with authentication and/or sudo]: :' \
  70. '(-H+ --hosts=-)'{-H+,--hosts=-}'[comma separated list of hosts to operate on]: :' \
  71. '(-R+ --roles=-)'{-R+,--roles=-}'[comma separated list of roles to operate on]: :' \
  72. '(-a --no-agent)'{-a,--no-agent}'[don''t use the running SSH agent]' \
  73. '(-k --no-keys)'{-k,--no-keys}'[don''t load private key files from ~/.ssh/]' \
  74. '(-w --warn-only)'{-w,--warn-only}'[warn instead of abort, when commands fail]' \
  75. '-i+[path to SSH private key file. May be repeated]: :_files' \
  76. "(-f+ --fabfile=)"{-f+,--fabfile=}"[Python module file to import]: :_files -g *.py" \
  77. '(-c+ --config=-)'{-c+,--config=-}'[specify location of config file to use]: :_files' \
  78. '(-s+ --shell=-)'{-s+,--shell=-}'[specify a new shell, defaults to ''/bin/bash -l -c'']: :' \
  79. '(--ssh-config-path=)--ssh-config-path=[ssh config path]: :_files' \
  80. '(--hide=-)--hide=-[comma-separated list of output levels to hide]: :->levels' \
  81. '(--show=-)--show=-[comma-separated list of output levels to show]: :->levels' \
  82. '*::: :->subcmds' && return 0
  83. if [[ CURRENT -ge 1 ]]; then
  84. case $state in
  85. noargs)
  86. _message "nothing to complete";;
  87. levels)
  88. _describe -t commands "output levels" output_levels;;
  89. *)
  90. _targets;;
  91. esac
  92. return
  93. fi
  94. # Local Variables:
  95. # mode: Shell-Script
  96. # sh-indentation: 2
  97. # indent-tabs-mode: nil
  98. # sh-basic-offset: 2
  99. # End:
  100. # vim: ft=zsh sw=2 ts=2 et