From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 16898 invoked from network); 27 Apr 2020 19:36:04 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with UTF8ESMTPZ; 27 Apr 2020 19:36:04 -0000 Received: (qmail 2190 invoked by alias); 27 Apr 2020 19:35:57 -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: 45731 Received: (qmail 6706 invoked by uid 1010); 27 Apr 2020 19:35:57 -0000 X-Qmail-Scanner-Diagnostics: from out4-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25793. spamassassin: 3.4.4. Clear:RC:0(66.111.4.28):SA:0(-2.6/5.0):. Processed in 0.711769 secs); 27 Apr 2020 19:35:57 -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) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrheelgddufeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkjghfofggtgfgsehtqh dttdertdejnecuhfhrohhmpeffrghnihgvlhcuufhhrghhrghfuceougdrshesuggrnhhi vghlrdhshhgrhhgrfhdrnhgrmhgvqeenucfkphepjeelrddukedtrddufedtrddugeejne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepugdrshes uggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Date: Mon, 27 Apr 2020 19:35:18 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: Re: [PATCH] _debsnap: New completion function. Message-ID: <20200427193518.30e381ac@tarpaulin.shahaf.local2> In-Reply-To: <20200427113813.1701-1-danielsh@tarpaulin.shahaf.local2> References: <20200427113813.1701-1-danielsh@tarpaulin.shahaf.local2> 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 Daniel Shahaf wrote on Mon, 27 Apr 2020 11:38 +0000: > --- > Completion/Debian/Command/_debsnap | 52 ++++++++++++++++++++++++++++++ > 1 file changed, 52 insertions(+) > create mode 100644 Completion/Debian/Command/_debsnap Revised version. The version numbers are now sorted =C2=ABdpkg --compare-versions=C2=BB-ly rather than alphabetically, and are limited by --first/--last. No other changes. Cheers, Daniel [[[ #compdef debsnap # Based on debsnap from devscripts-2.20.3 local context state state_descr line ret=3D1 local -a expl typeset -A opt_args _arguments \ '(-d --destdir)'{-d+,--destdir=3D}'[set download directory]:download dire= ctory:_files -/' \ '(-f --force)'{-f,--force}'[allow non-empty destination directory]' \ '(-v --verbose)'{-v,--verbose}'[print configuration and report progress]'= \ --list"[list versions; don't download]" \ --binary'[operate on binary packages (default: source packages)]' \ '*'{-a+,--architecture=3D}'[specify architectures to download]:architectu= re to download:_deb_architectures' \ --first=3D'[download all versions newer than this]:version number (lower = bound):->versions' \ --last=3D'[download all versions older than this]:version number (upper b= ound):->versions' \ '(-)'{-h,--help}'[show usage information]' \ '(-)'--version'[show version number and license]' \ '1: :->package' \ '2:version number to download:->versions' \ && ret=3D0 # -a implies --binary if (( ${+opt_args[-a]} || ${+opt_args[--architecture]} )); then opt_args[--binary]=3D'' fi case $state in (package) if (( ${+opt_args[--binary]} )); then _description binary-packages expl 'binary package to download' _deb_packages "${expl[@]}" avail && ret=3D0 else _description source-packages expl 'source package to download' _deb_packages "${expl[@]}" source && ret=3D0 fi ;; (versions) local package=3D${(Q)line[1]} if [[ -n $package ]]; then # Compute the arguments to --list local -a args () { local i j # repeatable flags with arguments, where the values can't contain c= olons for i in ${(k)opt_args[(I)(-a|--architecture)]}; do for j in ${(@s.:.)opt_args[$i]}; do [[ -n $j ]] || continue args+=3D( $i $j ) done done # non-repeatable flags with arguments, where the values may contain= colons for i in ${(k)opt_args[(I)(--first|--last)]}; do # Avoid spurious "No matches" results in 'debsnap --first 42.1 --= last 42.'. [[ $context !=3D option${i}-* ]] || continue # Un-escape colons (epoch separators in the version number) args+=3D( $i ${(Q)opt_args[$i]} ) done # flags without arguments args+=3D( ${(k)opt_args[(I)(--binary)]} ) } local -a versions=3D( ${(Oaf)"$(_call_program versions debsnap --list= ${args} -- ${line[1]})"} ) _description -V versions expl ${state_descr} compadd "$@" "${expl[@]}" -a versions && ret=3D0 else _message -- $state_descr && ret=3D0 fi ;; esac return ret ]]]