zsh-workers
 help / color / mirror / code / Atom feed
From: Tanaka Akira <akr@m17n.org>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: _xauth
Date: 03 May 2000 20:37:23 +0900	[thread overview]
Message-ID: <hvohfcfrhjg.fsf@serein.m17n.org> (raw)

This is a completion function for xauth.

--- /dev/null	Wed May  6 05:32:27 1998
+++ Completion/X/_xauth	Wed May  3 20:14:49 2000
@@ -0,0 +1,115 @@
+#compdef xauth
+
+local state context line expl
+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'
+
+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:'
+	;;
+
+      generate)
+        if (( CURRENT == 2 )); then
+	  state=displayname
+        elif (( CURRENT == 3 )); then
+	  state=protocolname
+	else
+	  case "$words[CURRENT-1]" in
+	  timeout) _message 'timeout(seconds)';;
+	  group) _message 'group-id';;
+	  data) _message 'hexdata';;
+	  *) 
+	    _wanted options expl 'xauth generate options' \
+	      compadd trusted untrusted timeout group data
+	    ;;
+	  esac
+	fi
+	;;
+
+      extract|nextract)
+	case "$CURRENT" in
+	2) _wanted files expl 'filename to write auth data' _files;;
+	*) state=displayname;;
+	esac
+        ;;
+
+      list|nlist)
+	state=displayname
+        ;;
+
+      merge|nmerge)
+	_wanted files expl 'filename to read auth data' _files
+	;;
+
+      remove)
+        state=displayname
+	;;
+
+      source)
+	_wanted files expl 'filename to source' _files
+	;;
+
+      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 --
+    ;;
+
+  protocolname)
+    _wanted values expl 'authorization protocol' \
+      compadd MIT-MAGIC-COOKIE-1 XDM-AUTHORIZATION-1 SUN-DES-1 MIT-KERBEROS-5
+    ;;
+
+  displayname)
+    _wanted values expl 'display name' \
+      compadd - ${${(f)"$(xauth list)"}%% *} || _x_display
+    ;;
+  esac
+done
-- 
Tanaka Akira


                 reply	other threads:[~2000-05-03 11:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=hvohfcfrhjg.fsf@serein.m17n.org \
    --to=akr@m17n.org \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).