zsh-workers
 help / color / mirror / code / Atom feed
* Broken fetchmail completion
@ 2008-11-17  9:48 Baptiste Daroussin
  2008-11-17 10:29 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Baptiste Daroussin @ 2008-11-17  9:48 UTC (permalink / raw)
  To: zsh-workers

The fetchmail completion is broken in in 4.3.9 :
_arguments:comparguments:303: invalid option definition: --[fetch]all[retrieve
old and new messages]
_arguments:comparguments:303: invalid option definition: --[fetch]all[retrieve
old and new messages]
_arguments:comparguments:303: invalid option definition: --[fetch]all[retrieve
old and new messages]


The _fetchmail seems to be obsolete.

regards
---
Bapt


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Broken fetchmail completion
  2008-11-17  9:48 Broken fetchmail completion Baptiste Daroussin
@ 2008-11-17 10:29 ` Peter Stephenson
  2008-11-17 22:39   ` Baptiste Daroussin
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2008-11-17 10:29 UTC (permalink / raw)
  To: zsh-workers

On Mon, 17 Nov 2008 10:48:31 +0100
Baptiste Daroussin <baptiste.daroussin@gmail.com> wrote:
> The fetchmail completion is broken in in 4.3.9 :
> _arguments:comparguments:303: invalid option definition: --[fetch]all[retrieve
> old and new messages]
> _arguments:comparguments:303: invalid option definition: --[fetch]all[retrieve
> old and new messages]
> _arguments:comparguments:303: invalid option definition: --[fetch]all[retrieve
> old and new messages]

The problem's not so much with the version of the shell (thought that may
have an effect) as with the version of fetchmail which is generating a help
string

  -a, --[fetch]all  retrieve old and new messages

which is confusing the shell.  This turns it into the options --fetchall
and --all, which seems to be the intention.  I don't know how common this
is; in principle you might get weird and wonderful syntax along those
lines, but I think we'll just have to wait and see.

> The _fetchmail seems to be obsolete.

I'm not sure what the point of having some arguments there but using --help
to get others is, but it might be for older versions of fetchmail.

Index: Completion/Base/Utility/_arguments
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_arguments,v
retrieving revision 1.21
diff -u -r1.21 _arguments
--- Completion/Base/Utility/_arguments	13 Dec 2007 22:05:59 -0000	1.21
+++ Completion/Base/Utility/_arguments	17 Nov 2008 10:25:34 -0000
@@ -5,7 +5,7 @@
 
 local long cmd="$words[1]" descr odescr mesg subopts opt opt2 usecc autod
 local oldcontext="$curcontext" hasopts rawret optarg singopt alwopt
-local setnormarg
+local setnormarg start rest
 local -a match mbegin mend
 
 long=$argv[(I)--]
@@ -97,10 +97,19 @@
        # present.  Maybe the problem was that the intervening code
        # didn't.  If it's buggy without removing them, the problem
        # probably is later, not here.
-       if [[ -z ${tmp[(r)${match[1]%%[^a-zA-Z0-9_-]#}]} ]]; then
-	 tmp+=($match[1])
+       start=${match[1]}
+       rest=${match[2]}
+       if [[ -z ${tmp[(r)${start%%[^a-zA-Z0-9_-]#}]} ]]; then
+	 # variant syntax seen in fetchmail:
+	 # --[fetch]all  means --fetchall or --all.
+	 # maybe needs to be more general
+	 if [[ $start = (#b)(*)\[(*)\](*) ]]; then
+	   tmp+=("${match[1]}${match[2]}${match[3]}" "${match[1]}${match[3]}")
+	 else
+	   tmp+=($start)
+	 fi
        fi
-       opt=$match[2]
+       opt=$rest
      done
      # If there's left over text, assume it's a description; it
      # may be truncated but if it's too long it's no use anyway.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Broken fetchmail completion
  2008-11-17 10:29 ` Peter Stephenson
@ 2008-11-17 22:39   ` Baptiste Daroussin
  0 siblings, 0 replies; 3+ messages in thread
From: Baptiste Daroussin @ 2008-11-17 22:39 UTC (permalink / raw)
  To: zsh-workers

Thanks it works perfectly.

Bapt

On Mon, Nov 17, 2008 at 10:29:06AM +0000, Peter Stephenson wrote:
> On Mon, 17 Nov 2008 10:48:31 +0100
> Baptiste Daroussin <baptiste.daroussin@gmail.com> wrote:
> > The fetchmail completion is broken in in 4.3.9 :
> > _arguments:comparguments:303: invalid option definition: --[fetch]all[retrieve
> > old and new messages]
> > _arguments:comparguments:303: invalid option definition: --[fetch]all[retrieve
> > old and new messages]
> > _arguments:comparguments:303: invalid option definition: --[fetch]all[retrieve
> > old and new messages]
> 
> The problem's not so much with the version of the shell (thought that may
> have an effect) as with the version of fetchmail which is generating a help
> string
> 
>   -a, --[fetch]all  retrieve old and new messages
> 
> which is confusing the shell.  This turns it into the options --fetchall
> and --all, which seems to be the intention.  I don't know how common this
> is; in principle you might get weird and wonderful syntax along those
> lines, but I think we'll just have to wait and see.
> 
> > The _fetchmail seems to be obsolete.
> 
> I'm not sure what the point of having some arguments there but using --help
> to get others is, but it might be for older versions of fetchmail.
> 
> Index: Completion/Base/Utility/_arguments
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_arguments,v
> retrieving revision 1.21
> diff -u -r1.21 _arguments
> --- Completion/Base/Utility/_arguments	13 Dec 2007 22:05:59 -0000	1.21
> +++ Completion/Base/Utility/_arguments	17 Nov 2008 10:25:34 -0000
> @@ -5,7 +5,7 @@
>  
>  local long cmd="$words[1]" descr odescr mesg subopts opt opt2 usecc autod
>  local oldcontext="$curcontext" hasopts rawret optarg singopt alwopt
> -local setnormarg
> +local setnormarg start rest
>  local -a match mbegin mend
>  
>  long=$argv[(I)--]
> @@ -97,10 +97,19 @@
>         # present.  Maybe the problem was that the intervening code
>         # didn't.  If it's buggy without removing them, the problem
>         # probably is later, not here.
> -       if [[ -z ${tmp[(r)${match[1]%%[^a-zA-Z0-9_-]#}]} ]]; then
> -	 tmp+=($match[1])
> +       start=${match[1]}
> +       rest=${match[2]}
> +       if [[ -z ${tmp[(r)${start%%[^a-zA-Z0-9_-]#}]} ]]; then
> +	 # variant syntax seen in fetchmail:
> +	 # --[fetch]all  means --fetchall or --all.
> +	 # maybe needs to be more general
> +	 if [[ $start = (#b)(*)\[(*)\](*) ]]; then
> +	   tmp+=("${match[1]}${match[2]}${match[3]}" "${match[1]}${match[3]}")
> +	 else
> +	   tmp+=($start)
> +	 fi
>         fi
> -       opt=$match[2]
> +       opt=$rest
>       done
>       # If there's left over text, assume it's a description; it
>       # may be truncated but if it's too long it's no use anyway.
> 
> -- 
> Peter Stephenson <pws@csr.com>                  Software Engineer
> CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
> Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-11-17 22:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-17  9:48 Broken fetchmail completion Baptiste Daroussin
2008-11-17 10:29 ` Peter Stephenson
2008-11-17 22:39   ` Baptiste Daroussin

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).