zsh-workers
 help / color / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: dana <dana@dana.is>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Completion for aplay from alsa-utils
Date: Sun, 1 Dec 2019 22:11:13 +0100
Message-ID: <CAKc7PVAKbWzPZkDYZNibEjyST6_MGL7a1YRpBfr9Wc4N7jodXg@mail.gmail.com> (raw)
In-Reply-To: <76A4FE80-C3E6-4038-84E1-FDCC727D34F0@dana.is>

[-- Attachment #1: Type: text/plain, Size: 1228 bytes --]

On Tue, 26 Nov 2019 at 03:16, dana <dana@dana.is> wrote:
>
> On 25 Nov 2019, at 06:10, Sebastian Gniazdowski <sgniazdowski@gmail.com> wrote:
> > Ok, it has been resolved – the exclusion for -v and --verbose was
> > causing the repeat-problem. After removing the exclusion, the options
> > can be repeated.
>
> More things, sry:
>
> > +  '(-h --help)'{-h,--help}'[print help message]'
> > +  --version'[print current version]'
>
> Usually options that can't be used together with any other arguments, like
> these two, are made fully exclusive via `(: * -)` or similar

Ok

> > +  '(-D+ --device=)'{-D+,--device=}'[select PCM by name]'
>
> You can't put the +/= syntax in the exclusion thing, it won't match like that.
> See my earlier example

Ah yes, this resulted from using a substitution with back-references in vim.

> > +_arguments -sS $opts
>
> This needs to be `-s -S`, per the documentation i mentioned before:
>
> > Options to _arguments itself must be in separate words, i.e. -s -w, not -sw.

All done. Attaching the patch.


-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

[-- Attachment #2: 0001-Completion-for-aplay-from-alsa-utils.patch.4.txt --]
[-- Type: text/plain, Size: 3418 bytes --]

From fdd014c6334d8ad256892372d22b748e4dab806d Mon Sep 17 00:00:00 2001
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
Date: Tue, 29 Oct 2019 18:59:46 +0100
Subject: [PATCH] Completion for aplay from alsa-utils

---
 Completion/Linux/Command/_alsa-utils | 54 ++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 Completion/Linux/Command/_alsa-utils

diff --git a/Completion/Linux/Command/_alsa-utils b/Completion/Linux/Command/_alsa-utils
new file mode 100644
index 000000000..15d8fb444
--- /dev/null
+++ b/Completion/Linux/Command/_alsa-utils
@@ -0,0 +1,54 @@
+#compdef aplay arecord
+# Copyright (c) 2019 Sebastian Gniazdowski
+
+setopt localoptions warncreateglobal typesetsilent
+
+local -a opts
+opts=(
+  '(- : *)'{-h,--help}'[print help message]'
+  '(- : *)'--version'[print current version]'
+  # -l/--list-devices doesn't benefit from -v/--verbose
+  '(- : *)'{-l,--list-devices}'[list all soundcards and digital audio devices]'
+
+  '(-L --list-pcms)'{-L,--list-pcms}'[list device names]'
+  '(-D --device)'{-D+,--device=}'[select PCM by name]'
+  '(-q --quiet)'{-q,--quiet}'[quiet mode]'
+  '(-t --file-type)'{-t+,--file-type+}'[file type (voc, wav, raw or au)]'
+  '(-c --channels)'{-c+,--channels=}'[channels]'
+  '(-r --rate)'{-r+,--rate=}'[sample rate]'
+  '(-f --format)'{-f+,--format=}'[sample format (case insensitive)]'
+  '(-d --duration)'{-d+,--duration=}'[interrupt after # seconds]'
+  '(-s --samples)'{-s+,--samples=}'[interrupt after # samples per channel]'
+  '(-M --mmap)'{-M,--mmap}'[mmap stream]'
+  '(-N --nonblock)'{-N,--nonblock}'[nonblocking mode]'
+  '(-F --period-time)'{-F+,--period-time=}'[distance between interrupts is # microseconds]'
+  '(-B --buffer-time)'{-B+,--buffer-time=}'[buffer duration is # microseconds]'
+  --period-size='[distance between interrupts is # frames]'
+  --buffer-size='[buffer duration is # frames]'
+  '(-A --avail-min)'{-A+,--avail-min=}'[min available space for wakeup is # microseconds]'
+  '(-R --start-delay)'{-R+,--start-delay=}'[delay for automatic PCM start is # microseconds]'
+  '(-T --stop-delay)'{-T+,--stop-delay=}'[delay for automatic PCM stop is # microseconds from xrun]'
+  '*'{-v,--verbose}'[show PCM structure and setup (accumulative)]'
+  '(-V --vumeter)'{-V+,--vumeter=}'[enable VU meter (TYPE: mono or stereo)]'
+  '(-I --separate-channels)'{-I,--separate-channels}'[file for each channel]'
+  '(-i --interactive)'{-i,--interactive}'[allow interactive operation from stdin]'
+  '(-m --chmap)'{-m+,--chmap=}'[give the channel map to override or follow]'
+  --disable-resample'[disable automatic rate resample]'
+  --disable-channels'[disable automatic channel conversions]'
+  --disable-format'[disable automatic format conversions]'
+  --disable-softvol'[disable software volume control (softvol)]'
+  --test-position'[test ring buffer position]'
+  --test-coef='[test coefficient for ring buffer position (default 8)]'
+  --test-nowait'[do not wait for ring buffer - eats whole CPU]'
+  --max-file-time='[start another output file when the old file has recorded]'
+  --process-id-file='[write the process ID here]'
+  --use-strftime'[apply the strftime facility to the output file name]'
+  --dump-hw-params'[dump hw_params of the device]'
+  --fatal-errors'[treat all errors as fatal]'
+
+  '*:sound file:_files'
+)
+
+_arguments -s -S $opts
+
+# The return value passes through
-- 
2.21.0


  reply index

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-02 21:13 Sebastian Gniazdowski
2019-11-03 23:17 ` dana
2019-11-04 10:38   ` Oliver Kiddle
2019-11-21 23:10   ` Sebastian Gniazdowski
2019-11-22  3:05     ` dana
2019-11-25 10:16       ` Sebastian Gniazdowski
2019-11-25 12:10         ` Sebastian Gniazdowski
2019-11-26  2:16           ` dana
2019-12-01 21:11             ` Sebastian Gniazdowski [this message]
2019-11-22 15:17     ` Eric Cook
2019-11-25  9:27       ` Sebastian Gniazdowski

Reply instructions:

You may reply publically 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=CAKc7PVAKbWzPZkDYZNibEjyST6_MGL7a1YRpBfr9Wc4N7jodXg@mail.gmail.com \
    --to=sgniazdowski@gmail.com \
    --cc=dana@dana.is \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git