zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Oliver Kiddle <okiddle@yahoo.co.uk>
Cc: Bart Schaefer <schaefer@brasslantern.com>, zsh-workers@sunsite.dk
Subject: Re: PATCH: _netcat
Date: Tue, 12 Mar 2002 17:38:31 +0000	[thread overview]
Message-ID: <20020312173831.GA30789@logica.com> (raw)
In-Reply-To: <20020311112606.GA20670@logica.com>

I wrote:
> 
> What I would suggest is that we use something like the is_gnu tests in
> _netcat which runs nc -h and looks for something like *connect*.
> _netcat can then call _nedit if appropriate.
> 
> I also think it would be pertinent to rename _is_gnu to something like
> _cmd_variant and use the value gnu instead of yes. Does that sound
> reasonable?

Below is a suggested patch which I won't commit without a positive
reponse first. Any alternate suggestions to the parameter name
_cmd_variant and the tag name variant particularly welcome. Is it unwise
to change the existing use of the tag `version' - I'd be suprised
if anyone has configured this in a style.

I've changed _iconv for an example of how I think the renaming of
_is_gnu should look like. An alternative to this would be to ditch
_cmd_variant and get _netcat to just do _comps[nc]=_nedit.

Oliver

Index: Completion/Unix/Command/_iconv
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_iconv,v
retrieving revision 1.1
diff -u -r1.1 _iconv
--- Completion/Unix/Command/_iconv	2 Apr 2001 11:53:06 -0000	1.1
+++ Completion/Unix/Command/_iconv	12 Mar 2002 17:27:57 -0000
@@ -2,17 +2,17 @@
 
 local expl curcontext="$curcontext" state line codeset LOCPATH
 
-(( $+_is_gnu )) || typeset -gA _is_gnu
-if (( ! $+_is_gnu[$words[1]] )); then
-  if [[ $(_call_program version $words[1] --version </dev/null 2>/dev/null) = *GNU* ]]; 
+(( $+_cmd_variant )) || typeset -gA _cmd_variant
+if (( ! $+_cmd_variant[$words[1]] )); then
+  if [[ $(_call_program variant $words[1] --version </dev/null 2>/dev/null) = *GNU* ]]; 
   then
-    _is_gnu[$words[1]]=yes
+    _cmd_variant[$words[1]]=gnu
   else
-    _is_gnu[$words[1]]=
+    _cmd_variant[$words[1]]=
   fi
 fi
 
-if [[ -n "$_is_gnu[$words[1]]" ]]; then
+if [[ -n "$_cmd_variant[$words[1]]" ]]; then
 
   _arguments -C \
     {'(--from-code --list)-f','(-f --list)--from-code='}'[specify code set of input file]:code set:->codeset' \
Index: Completion/Unix/Command/_netcat
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_netcat,v
retrieving revision 1.1
diff -u -r1.1 _netcat
--- Completion/Unix/Command/_netcat	10 Mar 2002 04:20:56 -0000	1.1
+++ Completion/Unix/Command/_netcat	12 Mar 2002 17:27:57 -0000
@@ -3,6 +3,20 @@
 local curcontext="$curcontext" state line expl
 typeset -A opt_args
 
+# handle name clash with the nedit client
+if [[ $service = nc ]]; then
+  (( $+_cmd_variant )) || typeset -gA _cmd_variant
+  if (( ! $+_cmd_variant[$words[1]] )); then
+    if [[ $(_call_program variant $words[1] -h </dev/null 2>/dev/null) = *connect* ]]; 
+    then
+      _cmd_variant[$words[1]]=netcat
+    else
+      _cmd_variant[$words[1]]=nedit
+    fi
+  fi
+  [[ $_cmd_variant[$words[1]] = nedit ]] && _nedit
+fi
+
 if (( ! $+_nc_args )); then
   local help="$(_call_program options nc -h < /dev/null 2>&1)"
   local -A optionmap
Index: Completion/X/Command/_nedit
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/Command/_nedit,v
retrieving revision 1.1
diff -u -r1.1 _nedit
--- Completion/X/Command/_nedit	2 Apr 2001 12:14:08 -0000	1.1
+++ Completion/X/Command/_nedit	12 Mar 2002 17:27:58 -0000
@@ -1,4 +1,4 @@
-#compdef nedit nc
+#compdef nedit nedit-nc=nc ncl=nc
 
 local state line expl nedit_common curcontext="$curcontext" ret=1
 typeset -A opt_args

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:[~2002-03-12 17:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-10 22:25 Bart Schaefer
2002-03-11 11:26 ` Oliver Kiddle
2002-03-12 17:38   ` Oliver Kiddle [this message]
2002-03-13  8:32     ` Sven Wischnowsky
2002-03-14 12:22       ` Oliver Kiddle
2002-03-15  8:39         ` Sven Wischnowsky
2002-03-15 16:06           ` Oliver Kiddle
2002-03-15 16:45             ` Bart Schaefer
2002-03-20  9:23             ` Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
2002-03-10  4:17 Clint Adams

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=20020312173831.GA30789@logica.com \
    --to=okiddle@yahoo.co.uk \
    --cc=schaefer@brasslantern.com \
    --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).