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 a461430d for ; Sat, 12 Jan 2019 19:25:13 +0000 (UTC) Received: (qmail 19337 invoked by alias); 12 Jan 2019 19:25:01 -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: 43993 Received: (qmail 3531 invoked by uid 1010); 12 Jan 2019 19:25:01 -0000 X-Qmail-Scanner-Diagnostics: from out1-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.100.2/25112. spamassassin: 3.4.2. Clear:RC:0(66.111.4.25):SA:0(-1.1/5.0):. Processed in 4.979357 secs); 12 Jan 2019 19:25:01 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | 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=fm2; bh=tDY /q4H3irn3t8KtJQ3br22etSguQPZYWyoUcoZ/Yqk=; b=QJ6URATIOX87k6RiEhR 40HFV2gBcAHZrpQw3eqoT/Wl6r/IYlYPbRzs98cgRGs+QMt/ySo2QXFyGDp8+eZt tomkn8MtfaQA7Gfdll3ecn0Rl3U5PPyELLn0+mKcEbY+kBExq8SnjpAyYTM3VGzh ZawWNAMFCzYTN/+WCMy+X6vsWMvs3BICZQECRTX11/COAq3xkUL4DMoC4hjMKw7A Iugj0GVE0LWd1n08y/b1pi/1H8klTyLFHmGzmT0lAxX972pkxurM3j/7YO9KuxqF 9QSpyoVc9IZ4R4L07tRBQZonAIShUXrB7sbkuDkTTjix2JO475SnUC0hd5pnmNsu utA== 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=tDY/q4 H3irn3t8KtJQ3br22etSguQPZYWyoUcoZ/Yqk=; b=DstguMI2kgVsCwJ0qZb4mh rPI2a1PVkZQvyXkgX5/V92SQaJfWfHXiXEl2H1LHu3AmwmGoW/RTm/IxGH39rU1w +aRQ2kkgprpqcSruOok0oWJKl/KsfJLGd4QPifigV9ZcTIHD7OpY3a171/5CiABo FPT3fPuVsXpPN2Ds26KwZhA0dFgjy+MGSL5+W4DF12ZqvBaRJAixB5azSMcNKv6r ZlnW4Z1oOYnAZXCzaaMOMFxChKCp9lQAhRdogBlk/YBJOW5gKFCZpobsaU4gTX5F eF35QrgspsfwTTBW2e+M3TZ0x27BWUrLsuHwqPLOnKdb4Y9b16SUhfiRhe9Gd/ow == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrfeejgdduvdejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpeffhffvuffkfh ggtggujggfsehttddttddtredvnecuhfhrohhmpeffrghnihgvlhcuufhhrghhrghfuceo ugdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgvqeenucfkphepjeelrddukeefrd egkedrudelgeenucfrrghrrghmpehmrghilhhfrhhomhepugdrshesuggrnhhivghlrdhs hhgrhhgrfhdrnhgrmhgvnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Date: Sat, 12 Jan 2019 19:24:50 +0000 From: Daniel Shahaf To: dana Cc: Zsh workers Subject: Re: [PATCH] Completion: _opkg: Support gain-privileges Message-ID: <20190112192450.xzkxvghxc4vit6d4@tarpaulin.shahaf.local2> References: <20190112171028.36htyrmgrxat4jle@tarpaulin.shahaf.local2> <55BD7A82-303D-4C2A-AF6F-350EF34E5E57@dana.is> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55BD7A82-303D-4C2A-AF6F-350EF34E5E57@dana.is> User-Agent: NeoMutt/20170113 (1.7.2) dana wrote on Sat, Jan 12, 2019 at 13:08:30 -0600: > On 12 Jan 2019, at 11:10, Daniel Shahaf wrote: > >I don't think so. Even an "empty" result could be expensive to compute: > >for example, it might require a network round-trip. I think _opkg > >shouldn't call _store_cache when _call_program returns non-zero. > > Well, i think that's effectively the same thing in this case and certain > others i'm imagining. (Or at least i assume so; there's not really any > documentation for opkg that i'm aware of, so who knows what actually causes it > to return non-zero.) Just felt like it might save some boiler-plate, which the > caching logic is extremely heavy in already, to have a standard option handle > it. I can just add the guard to each _store_cache call myself, though, obv Sorry, I thought you meant making that the default behaviour. My bad. I don't think expecting callers to check the exit code of commands they call is an unusual or onerous requirement, not that it adds much boilerplate: diff --git a/Completion/Linux/Command/_opkg b/Completion/Linux/Command/_opkg index d64567681..deeb766d9 100644 --- a/Completion/Linux/Command/_opkg +++ b/Completion/Linux/Command/_opkg @@ -181,12 +181,11 @@ _opkg_pkg_all() { copts=( "$@" ) { (( ! $#_opkg_cache_pkg_all )) || _cache_invalid opkg-pkg-all } && - ! _retrieve_cache opkg-pkg-all && { - _opkg_cache_pkg_all=( ${(f)"$( _call_program pkg-all ${svc:-opkg} list )"} ) + _retrieve_cache opkg-pkg-all || if _opkg_cache_pkg_all=( ${(f)"$( _call_program pkg-all ${svc:-opkg} list )"} ); then _opkg_cache_pkg_all=( ${(@)_opkg_cache_pkg_all##[[:space:]]*} ) _opkg_cache_pkg_all=( ${(@)_opkg_cache_pkg_all%%[[:space:]]*} ) _store_cache opkg-pkg-all _opkg_cache_pkg_all - } + fi (( $#upd )) && return 0 (( $#_opkg_cache_pkg_all )) || { But all that said, if the proposed new --option would be useful to many callers, then of course we could/should add it. Cheers, Daniel