Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: _netcat
- X-seq: zsh-workers 16815
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- Subject: Re: PATCH: _netcat
- Date: Tue, 12 Mar 2002 17:38:31 +0000
- Cc: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxxxxx
- In-reply-to: <20020311112606.GA20670@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <1020310222552.ZM26165@xxxxxxxxxxxxxxxxxxxxxxx> <20020311112606.GA20670@xxxxxxxxxx>
- Sender: Oliver Kiddle <kiddleo@xxxxxxxxxx>
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author