[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: zsh completion for dtas-ctl

From: Eric Wong
Subject: Re: zsh completion for dtas-ctl
Date: Sun, 3 Nov 2019 01:07:59 +0000

James Rowe <address@hidden> wrote:
> Hi,
>   Thanks to rb_optparse.zsh¹ completion is available for many of the
> dtas commands, however this isn't the case for dtas-ctl as its interface
> isn't built on optparse.
>   Attached is the first cut of a zsh completion script for dtas-ctl.  It
> doesn't include all the features, and it really isn't as smart as it
> should be.  It does Work For Me™.  I've pasted the CC0 header on 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.

> 1. https://github.com/ruby/ruby/blob/master/misc/rb_optparse.zsh

> #compdef dtas-ctl


> # To the extent possible under law, James Rowe has waived all copyright and
> # related or neighboring rights to this example.
> _arguments \
>     ':dtas-ctl command:((
>         cd\:"Change the current working directory of the player."
>         clear\:"Clear current queue."


>     ))' \
>     '*::subcmd:->subcmd' && return 0
> case "$words[1]" in
> (cd)
>     _arguments \
>         ':select dir:_path_files -/'
>     ;;
> (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 :)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]