zsh-workers
 help / color / mirror / code / Atom feed
14dfc840049d5087f2f368f52640fec32e82ec87 blob 2580 bytes (raw)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
 
#compdef xauth

local state context line expl ret=1
typeset -A opt_args
local tmp cmd

_arguments -s \
  '-f[specify authfile]:authfile:_files' \
  '(-q)-v[verbose mode]' \
  '(-v)-q[quiet mode]' \
  '-b[break locks]' \
  '-i[ignore locks]' \
  '*::command:->command' && ret=0

while [[ -n "$state" ]]; do
  tmp="$state"
  state=
  case "$tmp" in
  command)
    if (( CURRENT == 1 )); then
      state=subcommands
    else
      cmd="$words[1]"
      curcontext="${curcontext%:*:*}:xauth-${cmd}:"
      case "$cmd" in
      add)
	_arguments \
	  ':display name:->displayname' \
	  ':protocol name:->protocolname' \
	  ':hexkey:' && ret=0
	;;

      generate)
        if (( CURRENT == 2 )); then
	  state=displayname
        elif (( CURRENT == 3 )); then
	  state=protocolname
	else
	  case "$words[CURRENT-1]" in
	  timeout) _message -e values 'timeout (seconds)';;
	  group) _message -e ids 'group-id';;
	  data) _message -e values 'hexdata';;
	  *) 
	    _wanted options expl 'xauth generate options' \
	      compadd trusted untrusted timeout group data && ret=0
	    ;;
	  esac
	fi
	;;

      extract|nextract)
	case "$CURRENT" in
	2) _wanted files expl 'filename to write auth data' _files && ret=0;;
	*) state=displayname;;
	esac
        ;;

      list|nlist)
	state=displayname
        ;;

      merge|nmerge)
	_wanted files expl 'filename to read auth data' _files && ret=0
	;;

      remove)
        state=displayname
	;;

      source)
	_wanted files expl 'filename to source' _files && ret=0
	;;

      info|exit|quit|\?)
        ;;

      help)
        state=subcommands
	;;
      esac
    fi
    ;;

  subcommands)
    tmp=(
      'add:add entry'
      'generate:use server to generate entry'
      'extract:extract entries into file'
      'nextract:numerically extract entries'
      'list:list entries'
      'nlist:numerically list entries'
      'merge:merge entries from files'
      'nmerge:numerically merge entries'
      'remove:remove entries'
      'source:read commands from file'
      'info:print information about entries'
      'exit:save changes and exit program'
      'quit:abort changes and exit program'
      'help:print help'
      '?:list available commands'
    )
    _describe 'xauth command' tmp -- && ret=0
    ;;

  protocolname)
    _wanted values expl 'authorization protocol' \
      compadd MIT-MAGIC-COOKIE-1 XDM-AUTHORIZATION-1 SUN-DES-1 MIT-KERBEROS-5 && ret=0
    ;;

  displayname)
    { _wanted values expl 'display name' \
        compadd - ${${(f)"$(xauth list)"}%% *} || _x_display } && ret=0
    ;;
  esac
done

return ret
debug log:

solving 14dfc8400 ...
found 14dfc8400 in https://git.vuxu.org/mirror/zsh/

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).