From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 43354e29 for ; Sat, 2 Nov 2019 05:55:16 +0000 (UTC) Received: (qmail 10490 invoked by alias); 2 Nov 2019 05:55:08 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 44884 Received: (qmail 23519 invoked by uid 1010); 2 Nov 2019 05:55:08 -0000 X-Qmail-Scanner-Diagnostics: from wout4-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.0/25615. spamassassin: 3.4.2. Clear:RC:0(64.147.123.20):SA:0(-2.6/5.0):. Processed in 4.867077 secs); 02 Nov 2019 05:55:08 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) 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 == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedruddtkedgkeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkfhggtggujggfsehttd dttddtredvnecuhfhrohhmpeffrghnihgvlhcuufhhrghhrghfuceougdrshesuggrnhhi vghlrdhshhgrhhgrfhdrnhgrmhgvqeenucfkphepjeelrddukedtrdehjedrudduleenuc frrghrrghmpehmrghilhhfrhhomhepugdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgr mhgvnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Date: Sat, 2 Nov 2019 05:54:23 +0000 From: Daniel Shahaf To: dana Cc: Zsh hackers list Subject: Re: [PATCH] Completion: Add _log_priorities, _logger Message-ID: <20191102055423.5gzbipni3vnjo4k3@tarpaulin.shahaf.local2> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) 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