Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Broken fetchmail completion
- X-seq: zsh-workers 26053
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: Broken fetchmail completion
- Date: Mon, 17 Nov 2008 10:29:06 +0000
- In-reply-to: <20081117094831.GB57162@xxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: CSR
- References: <20081117094831.GB57162@xxxxxxxxxxx>
On Mon, 17 Nov 2008 10:48:31 +0100
Baptiste Daroussin <baptiste.daroussin@xxxxxxxxx> 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@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author