everything related to duct tape audio suite (dtas)
 help / color / mirror / code / Atom feed
From: James Rowe <jnrowe@gmail.com>
To: dtas-all@nongnu.org
Subject: zsh completion for dtas-ctl
Date: Sun, 3 Nov 2019 00:35:51 +0000	[thread overview]
Message-ID: <20191103003231.pivotxyv3k6kvqt4@gmail.com> (raw)

[-- Attachment #1.1: Type: text/plain, Size: 729 bytes --]


  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.

  The obvious improvements are that it should be automatically
generated, probably from the player protocol manpage or some such.



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


☒ Vote to destroy email signatures today!

[-- Attachment #1.2: _dtas-ctl --]
[-- Type: text/plain, Size: 4668 bytes --]

#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."
        cue\:"Display the index/offsets of the embedded CUE sheet."
        current\:"Output information about the current track/command in YAML."
        enq\:"Enqueue the given FILENAME for playback."
        enq-cmd\:"Run the following command for playback."
        env\:"Set/unset environment variables."
        format\:"Configure the format between source and sink."
        pause\:"Pause playback."
        play\:"Restart playback from pause."
        play_pause\:"Toggle the play/pause state."
        queue\ cat\:"Dump the contents of the queue as YAML."
        restart\:"Restarts all processes in the current pipeline."
        rg\:"Configure ReplayGain support."
        seek\:"Seek the current track to a specified time."
        skip\:"Abort current track/command."
        sink\:"Control sinks."
        source\:"Control sources."
        state\ dump\:"Immediately dump the state of the player."
        tl\:"Control tracklist."
        trim\:"Limits playback of all tracks in the tracklist."
        watch\:"Adds the client to the passive watch list for notifications."
    ))' \
    '*::subcmd:->subcmd' && return 0

case "$words[1]" in
    _arguments \
        ':select dir:_path_files -/'
    _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."
(enq|state dump)
    _arguments \
        ':select file:_files'
    _arguments \
        'channels=[Number of channels to use internally.]' \
        'endian=[Change endianess.]:select endianess:(big little swap)' \
        'bits=[Sample precision.]:select precision:(16 bypass)' \
        'rate=[Sample rate of audio.]:select sample rate:(44100 48000 bypass)' \
        'type=[Change the raw PCM format.]:select raw PCM format:(s16 s24 s32 u16 u24 u32 f32 f64)'
    _arguments \
        'fallback_gain=[Adjust the volume by this level for tracks.]:select adjustment:_guard "-?[0-9]#" "dB value"' \
        'fallback_track=[When in album_gain mode, fallback to track_gain.]:select option:(true false)' \
        'mode=[Controls the ReplayGain tag to use.]:(album_gain track_gain track_norm album_norm off)' \
        'preamp=[Adjust the album_gain or track_gain.]:select adjustment:_guard "-?[0-9]#" "dB value"' \
        'norm_level=[Control the level to normalize.]:select level:_guard "-?[0-9]#" "dB value"'
    _arguments \
        '1:select track:_guard "[0-9]#" "track number"'
    _arguments \
        ':sink subcommand:((
            ls\:"List names of current sinks."
            cat\:"Dump SINKNAME config in YAML."
            rm\:"Remove SINKNAME."
            ed\:"create/edit SINKNAME."
    _arguments \
        ':source subcommand:((
            cat\:"Dump the current source command and env in YAML."
            ed\:"Edit the source parameters."
            ls\:"Dump the names of sources sorted by tryorder."
            restart\:"Restart the current source command."
    _arguments \
        ':tl subcommand:((
            add\:"Add files to the tracklist."
            clear\:"Clear current tracklist."
            consume\:"Show/or change consume status of the tracklist."
            current\:"Display the pathname to the currently playing track."
            current-id\:"Display the TRACKID of the currently playing track."
            remove\:"Remove the track with the given TRACKID from the track list."
            get\:"Returns a list of TRACKIDS mapped to shell-escaped filenames."
            goto\:"Plays the given TRACKID."
            max\:"Sets or gets the maximum number of tracks allowed in the tracklist."
            next\:"Jump to the next track in the tracklist."
            prev\:"Jump to the previous track in the tracklist."
            repeat\:"Show/or change repeat status of the tracklist."
            shuffle\:"Show/or change the current shuffle status of the tracklist."
            swap\:"Swaps the positions of two tracks."
            tracks\:"Returns a list of all TRACKIDS in the tracklist."
    _arguments \
        '1:select beginning' \
        '2:select end'

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

             reply	other threads:[~2019-11-03  0:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-03  0:35 James Rowe [this message]
2019-11-03  1:07 ` zsh completion for dtas-ctl Eric Wong
2019-11-04  2:19   ` Eric Wong
2019-11-04  9:36     ` James Rowe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://80x24.org/dtas/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191103003231.pivotxyv3k6kvqt4@gmail.com \
    --to=jnrowe@gmail.com \
    --cc=dtas-all@nongnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).