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.

_atach 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #compdef atach
  2. # ------------------------------------------------------------------------------
  3. # Copyright (c) 2016 Github zsh-users - http://github.com/zsh-users
  4. #
  5. # Permission is hereby granted, free of charge, to any person obtaining
  6. # a copy of this software and associated documentation files (the
  7. # "Software"), to deal in the Software without restriction, including
  8. # without limitation the rights to use, copy, modify, merge, publish,
  9. # distribute, sublicense, and/or sell copies of the Software, and to
  10. # permit persons to whom the Software is furnished to do so, subject to
  11. # the following conditions:
  12. #
  13. # The above copyright notice and this permission notice shall be included
  14. # in all copies or substantial portions of the Software.
  15. #
  16. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  17. # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  20. # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  21. # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  22. # OTHER DEALINGS IN THE SOFTWARE.
  23. # ------------------------------------------------------------------------------
  24. # Description
  25. # -----------
  26. #
  27. # Completion script for atach (https://github.com/sorin-ionescu/atach).
  28. #
  29. # ------------------------------------------------------------------------------
  30. # Authors
  31. # -------
  32. #
  33. # * Sorin Ionescu <sorin.ionescu@gmail.com>
  34. #
  35. # ------------------------------------------------------------------------------
  36. local state mode_values existing_sessions ret=1
  37. mode_values=(
  38. "none:disable redrawing"
  39. "ctrl_l:use ctrl + l to redraw"
  40. "winch:use sigwinch to redraw"
  41. )
  42. existing_sessions=($(_call_program session atach))
  43. _arguments -C -s -S \
  44. '(--list -l)'{--list,-l}'[list sessions]' \
  45. '(--sockets -L)'{--sockets,-L}'[list sockets]' \
  46. '(--session -s)'{--session=,-s+}'[set the session name]:session' \
  47. '(--char -c)'{--char=,-c+}'[set the detach character (default: ^\\)]:char' \
  48. '(--redraw -r)'{--redraw=,-r+}'[set the redraw method (none, ctrl_l, or winch)]:mode:->mode' \
  49. '(--detached -d)'{--detached,-d}'[start the session detached]' \
  50. '(--no-detach -D)'{--no-detach,-D}'[disable detaching]' \
  51. '(--no-suspend -Z)'{--no-suspend,-Z}'[disable suspending]' \
  52. '(--version -v)'{--version,-v}'[display version and copyright]' \
  53. '(--help -h)'{--help,-h}'[display help]' \
  54. '(-)::args:->session-or-command' && ret=0
  55. case "$state" in
  56. (mode)
  57. _describe -t mode 'redraw mode' mode_values && ret=0
  58. ;;
  59. (session-or-command)
  60. _describe -t 'session' 'sessions' existing_sessions && ret=0
  61. _path_commands && ret=0
  62. ;;
  63. esac
  64. return $ret