From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id EA4011F454 for ; Sun, 3 Nov 2019 01:08:07 +0000 (UTC) Received: from localhost ([::1]:51482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iR4NC-0003Ld-Nq for e@80x24.org; Sat, 02 Nov 2019 21:08:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45265) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iR4NA-0003JN-2p for dtas-all@nongnu.org; Sat, 02 Nov 2019 21:08:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iR4N8-0001wu-T8 for dtas-all@nongnu.org; Sat, 02 Nov 2019 21:08:03 -0400 Received: from dcvr.yhbt.net ([64.71.152.64]:38774) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iR4N8-0001vZ-NL for dtas-all@nongnu.org; Sat, 02 Nov 2019 21:08:02 -0400 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 731CC1F454; Sun, 3 Nov 2019 01:07:59 +0000 (UTC) Date: Sun, 3 Nov 2019 01:07:59 +0000 From: Eric Wong To: James Rowe Subject: Re: zsh completion for dtas-ctl Message-ID: <20191103010759.GA11361@dcvr> References: <20191103003231.pivotxyv3k6kvqt4@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191103003231.pivotxyv3k6kvqt4@gmail.com> Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.71.152.64 X-BeenThere: dtas-all@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: duct tape audio suite List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dtas-all@nongnu.org Errors-To: dtas-all-bounces+e=80x24.org@nongnu.org Sender: "dtas-all" James Rowe wrote: > Hi, >=20 > Thanks to rb_optparse.zsh=C2=B9 completion is available for many of t= he > dtas commands, however this isn't the case for dtas-ctl as its interfac= e > isn't built on optparse. >=20 > Attached is the first cut of a zsh completion script for dtas-ctl. I= t > doesn't include all the features, and it really isn't as smart as it > should be. It does Work For Me=E2=84=A2. I've pasted the CC0 header o= n to it > should you wish to add it to the examples/ directory. Wow, thank you for your time and effort in doing this! I'm not a zsh user myself, but probably a examples/zsh-completion/ directory in preparation for other commands? > The obvious improvements are that it should be automatically > generated, probably from the player protocol manpage or some such. Yes, that would be nice, but see below. >=20 > 1. https://github.com/ruby/ruby/blob/master/misc/rb_optparse.zsh > #compdef dtas-ctl =20 > # To the extent possible under law, James Rowe has waived all copyright= and > # related or neighboring rights to this example. >=20 > _arguments \ > ':dtas-ctl command:(( > cd\:"Change the current working directory of the player." > clear\:"Clear current queue." > ))' \ > '*::subcmd:->subcmd' && return 0 >=20 > case "$words[1]" in > (cd) > _arguments \ > ':select dir:_path_files -/' > ;; >=20 > (cue) > _arguments \ > '1:dtas-ctl command:(( > next\:"Skip to the next cue sheet offset." > prev\:"Skip to the previous cue sheet offset." > goto\:"Go to the cue index." > seek\:"Seek within the current cue index." > ))' > ;; As a non-zsh user, this seems easy-to-follow, understand, and maybe build a standalone-parser for. So I'm kinda wondering if a manpage could be generated from this, instead; along with completions for bash and maybe other shells. But it could also be a lot of work, so no obligations to do this :)