zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@sunsite.dk
Subject: Re: PATCH: _kvno
Date: Tue, 28 Jun 2005 15:45:41 +0200	[thread overview]
Message-ID: <9960.1119966341@trentino.groupinfra.com> (raw)
In-Reply-To: <20050624184620.GA19301@scowler.net>

On 24 Jun, Clint Adams wrote:
> This is for MIT krb5, and is ignorant of Kerberos realms, other service
> types, and pretty much everything else, but all I care about is the host
> completion.

Don't forget that you need to declare various stuff local if you're
going to use states. And pass -C to _arguments if you don't want to
handle $context. It would also be nice if we can maintain consistency on
things like indentation between the completion functions.

Oliver

Index: Completion/Unix/Command/_kvno
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_kvno,v
retrieving revision 1.1
diff -u -w -r1.1 _kvno
--- Completion/Unix/Command/_kvno	24 Jun 2005 18:49:15 -0000	1.1
+++ Completion/Unix/Command/_kvno	28 Jun 2005 13:42:17 -0000
@@ -1,22 +1,24 @@
 #compdef kvno
 
-_arguments \
-	'-c[credentials cache]:cache:_files' \
-	'-e[enctype]:enctype:' \
+local curcontext="$curcontext" state line ret=1
+
+_arguments -C \
+  '(-4)-c[specify credentials cache to use]:cache:_files' \
+  '(-4)-e[specify encryption type]:encryption type' \
 	'-q[suppress printing]' \
 	'-h[help]' \
-	'-4[kerberos 4 tickets]' \
-	':principal:->principal' && return 0
+  '(-c -e)-4[kerberos 4 tickets]' \
+  ':principal:->principal' && ret=0
 
-case "$state" in
-	(principal)
+if [[ $state = principal ]]; then
 	if [[ -prefix host/ ]]; then
 	  compset -P host/
-	  _hosts
+    _hosts && ret=0
 	else
 	  _alternative \
 	    'users:user:_users' \
-	    'services:service:compadd -S/ host'
+      'services:service:compadd -S/ host' && ret=0
+  fi
 	fi
-	;;
-esac
+
+return ret


This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.


      reply	other threads:[~2005-06-28 13:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-24 18:46 Clint Adams
2005-06-28 13:45 ` Oliver Kiddle [this message]

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=9960.1119966341@trentino.groupinfra.com \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@sunsite.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).