From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17117 invoked from network); 28 Aug 2020 02:23:02 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 28 Aug 2020 02:23:02 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=iLZey2UvpY75Bb3D1Njb03N2gBpj1ALjza4blZ5eyIQ=; b=hCuWO4ZyCrQRKekggqWF++qCnk MxlRylD9kWQGYInwe/0mu0sBtkaLepmHYkLlkY1yaer8q+Kw8wxmyQsR8uSjN2NCaNk6X+DF68lTS 0JdyXe53yeUtkItDFIz1iat7JSi9LgbB6tIZvJkRcjLPVwy00VMFAoEt6Nv/sfI7+J4pySXpB31JA EI0FuQDMoCiDz2eAnK95zhulI0TbdfjXC2Ue7xg7Gj+b8xuNfGDHpa4zywYQkmJ5imsU7by8MN6hr v6cM8f85KWmxnkTsL/rHEVSX6rMYZeq52mN4QvlVMzTdCwnuhh/9VmVOYpw68Afc25ZGUK76LhUgi 20P2niag==; Received: from authenticated user by zero.zsh.org with local id 1kBU2b-000101-MC; Fri, 28 Aug 2020 02:22:57 +0000 Authentication-Results: zsh.org; iprev=pass (out3-smtp.messagingengine.com) smtp.remote-ip=66.111.4.27; dkim=pass header.d=daniel.shahaf.name header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm3 header.a=rsa-sha256; dmarc=skipped; arc=none Received: from out3-smtp.messagingengine.com ([66.111.4.27]:48493) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1kBU2I-0000qE-Dt; Fri, 28 Aug 2020 02:22:40 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 08D7D5C01D7; Thu, 27 Aug 2020 22:22:37 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 27 Aug 2020 22:22:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:cc:subject:message-id :in-reply-to:references:mime-version:content-type :content-transfer-encoding; s=fm1; bh=iLZey2UvpY75Bb3D1Njb03N2gB pj1ALjza4blZ5eyIQ=; b=yMkY1hYgslIUiUqI1rDG+tA6Jhmajs5IXufOQY2QqG dH+S9jbjtTAgKqU4+uRvqUlu2yJUopPBoCMJTEwVacE/FrAMwxH7Aqn5kmcpjv43 reQldr3FxM9p3b00OHLyau/o57ljcERRM0zzwSSZWUG9ahUNZAVhUQiv0K7NS226 31/QXis6c/zszyxuH0VSEkbOYC4g52hMt6zw714vZvgSQJcty04v/kL7LHiTRPWr str1FGFZhSJfdvP3IkycMahO5AXxh3d/liRnddOazdQJuWCtLsfLBfD0J9kd0KJI FMYOVFrNZsBLKah1t/wo4Y1r8QerbHXGB+AhQM4Hvlug== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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=fm3; bh=iLZey2UvpY75Bb3D1Njb03N2gBpj1ALjza4blZ5ey IQ=; b=n7ZBGnZ9wc60EjYaYEa0nnVUgNVzW+CwlTXjdbybDtjzzvXcZAoa+pN94 Vq1ZPwxSatCpffM675zHh33ZSxs/81CDcyt76fRxUE4AuTpHpBIGIw8LihiJNKJl DVncsXqcLUeZ9HAZt+fcc1PyfdN/jSMauhSxqPMAYGNzTXlGI3fwG5QacVyzu5KT DL0LrLpQAWKUgwNMj5prLY6CNZNv+clqpYx74hvLn1cb7PJS0iGmthNhwvh2aEkn d+KtLgOyC9ZAI01zax48h5/Nr2dxENlsFsa1moWNHLiuV/Z9Pujz1CRgW+PTACGI fHPDtf+H87eodLFhE+Ses70XDSU4Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedruddviedgheelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfgjfhfogggtgfesthhqtddtredtjeenucfhrhhomhepffgrnhhi vghlucfuhhgrhhgrfhcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvgeqne cuggftrfgrthhtvghrnhepledvvedvvdeltdfhleehgfdtudetjeeujeelueelgfdvheeh heehgeevleegledvnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkphepjeelrd dujeekrddvfedrvdefkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvg X-ME-Proxy: Received: from tarpaulin.shahaf.local2 (bzq-79-178-23-238.red.bezeqint.net [79.178.23.238]) by mail.messagingengine.com (Postfix) with ESMTPA id 50A913280067; Thu, 27 Aug 2020 22:22:36 -0400 (EDT) Received: from tarpaulin.shahaf.local2 (localhost [IPv6:::1]) by tarpaulin.shahaf.local2 (Postfix) with ESMTP id 4Bd3K65FVHzcf; Fri, 28 Aug 2020 02:22:34 +0000 (UTC) Date: Fri, 28 Aug 2020 02:22:32 +0000 From: Daniel Shahaf To: Peter Stephenson Cc: Zsh hackers list Subject: Re: PATCH: minimal dropbox command line completion Message-ID: <20200828022232.0914170c@tarpaulin.shahaf.local2> In-Reply-To: References: X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Seq: 47342 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: Peter Stephenson wrote on Thu, 27 Aug 2020 21:15 +0100: > +++ b/Completion/Unix/Command/_dropbox Relation to [1]? It uses a different top-of-file directive, but nevertheless seems to be possibly related. [1] https://github.com/zpm-zsh/dropbox/blob/master/functions/_dropbox-cli [2] https://github.com/ivoarch/dropbox-zsh-completion/blob/master/_dropbox > @@ -0,0 +1,16 @@ > +#compdef dropbox > + > +if [[ CURRENT -eq 2 || $words[2] =3D help ]]; then > + local -a line progs > + > + _call_program commands command dropbox help | > + while read -A line; do > + if [[ $line[1] =3D [a-z]## ]]; then > + progs+=3D("$line[1]:$line[2,-1]") Suggest s/$line[1]/${line[1]}/ for forward compatibility with a potential future =C2=AB:$=C2=BB history modifier. (And -r to 'read') > + fi > + done > + > + _describe -t dropbox-commands 'Dropbox command' progs > +elif [[ $words[2] =3D (ls|filestatus|sharelink) ]]; then > + _files else return 1 > +fi >=20 >=20 Aside: I wonder why we don't use a =C2=AB_call_completion_function() { readonly -i n=3D$compstate[nmatches]; "$@" && (( $compstate[nmatches] > $= n)) }=C2=BB wrapper around calls to $_comps[foo]: that'd save every single completion function having to manage $ret explicitly.) Cheers, Daniel