Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Completion: Add _log_priorities, _logger
- X-seq: zsh-workers 44884
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: dana <dana@xxxxxxx>
- Subject: Re: [PATCH] Completion: Add _log_priorities, _logger
- Date: Sat, 2 Nov 2019 05:54:23 +0000
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:in-reply-to; s=fm1; bh=H73 HRjUN8qDSVP5Qp2d6E9Peaw7YDQXcS6V0pCm9IGQ=; b=cSjRdiDfu7RM42oWP7Z E0cpRUDZxf62KTXmlJr993ggHHH4216s4HdMAYHGBLcu22A+gezEl2ys91xLHAZ8 Mt3axGAaShusvbaOBvNCcBCFrAsA/+8eq8bNpEZmKJ0COFWS0L+hi1R53+v4yhOS n4SYq05Rt4CFttK10emQm8teoYnl5NLODJR3RZUAffu/DhO4cCu/8/zzKhonOg5I AGOoGI0Y0zVQvPFeV/eTGGT5FSMfJt6YGYXOKM7x/4z5ifirgVCgTi4yJGFHlZLn T0ex3Iy5aIeYduHsvAh/n2qQL3OQE8T+0uS8gOK844S0QZ9v+jBBLkpJ/BbvCBt/ ZGA==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=H73HRj UN8qDSVP5Qp2d6E9Peaw7YDQXcS6V0pCm9IGQ=; b=E6j1q+TdSVA1qQCnQRtu/7 1nHUgUNOLoJPCCytFyvrnJwBUopvMHJ8HGP46Uz3LU7yKOx9j4+CSFT6O0RZopy0 79l29HpT9ANL9FYuVuqOi6fCyBZs8Bpcbc8/Ax3jtgOeMvtHk3zFztmMTzTO0lcT rQVkzkwRVODqQJmpEXpEJrLeOu/7exU+zCn20Qtz9ugz8x/Oltn+uj/pWc2/v+7+ u41XmhFYKN/HuVNGIQflM9I8D6dEyuTaOg9r81MhBN22nscYrr9h3sbfe8FgWPUG DjV+vbJzLjHdKSot3soBPn76G84LFDE1/TCSYS4sbCcNASmz6KUMC3+l5EMmTILw ==
- In-reply-to: <E00A62F9-627E-4C0C-A3FD-3A0C1F00D666@dana.is>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <E00A62F9-627E-4C0C-A3FD-3A0C1F00D666@dana.is>
dana wrote on Fri, Nov 01, 2019 at 21:14:46 -0500:
> (The strange option letters were, as with _bind_addresses, chosen to avoid
> conflicting with compadd. Daniel once suggested that we come up with some
> standard calling convention that resolves this head ache, but i haven't
> personally given it much further thought)
The first idea that comes to mind here is to use one of these conventions:
.
_log_priorities "${compadd_options[@]}" -Y --foo=lorem -Y --foo -Y lorem
.
or
.
_log_priorities "${compadd_options[@]}" -Y '--foo=lorem --foo lorem'
That is: use up _one_ top-level option letter and stuff all the not-compadd
--options and their arguments into the argument(s) of that top-level option
letter.
We can also do:
.
_log_priorities "${compadd_options[@]}" -- "${compadd_positional_arguments[@]}" -- "${log_priorities_argv[@]}"
.
which is similar to what zargs does. Normally there would be a question here
of how to escape a literal "--" in $compadd_positional_arguments, but for
compadd specifically, I think the following is a satisfactory workaround:
.
_log_priorities -a compadd_positional_arguments "${compadd_options[@]}" -- -- "${log_priorities_argv[@]}"
I'll leave it to you to decide whether it's worthwhile to change
_log_priorities from the version you posted.
Which reminds me: Shouldn't we mention _log_priorities in the manual, it being
a new Type/ function?
Cheers,
Daniel
> --- /dev/null
> +++ b/Completion/Unix/Type/_log_priorities
> @@ -0,0 +1,70 @@
> +#autoload
> +
> +# Complete syslog-style priorities/facilities/levels
> +#
> +# Note: 'Priority' according to syslog(3) refers to a severity level optionally
> +# ORed with a facility. We use it here in a somewhat similar manner, as this
> +# seems to cover the most ground, though we also support completing facilities
> +# alone.
> +#
> +# By default, a case-insensitive facility.level pair is completed.
> +#
> +# Some tools that accept symbolic facility/level names also accept numbers
> +# corresponding to their associated values defined in syslog.h. Since these
> +# numbers vary across systems, we don't attempt to complete them.
> +#
> +# Options:
> +# -y Complete only facilities
> +# -Y Complete only severity levels
> +# -z Complete only lower-case names
> +# -Z Complete only upper-case names
Messages sorted by:
Reverse Date,
Date,
Thread,
Author