Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Completion for aplay from alsa-utils



On Fri, 22 Nov 2019 at 04:05, dana <dana@xxxxxxx> wrote:
>
> On 21 Nov 2019, at 17:10, Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
> > > * There are no exclusions for any of the alias options (e.g., -D and --device
> > > should be exclusive)
> >
> > How to add them?
>
> '(-D --device)' (or whatever) at the beginning of the arg spec

Thanks. I attach an updated version of the patch. It has problem with
one thing – the cumulative option spec using *:

'(-v --verbose)*'{-v,--verbose}'[show PCM structure and setup (accumulative)]'

doesn't yield the desired effect – the option still cannot be
repeated. I don't know why?

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
From e890819a3da80b9061aa694959deb7108b78ba6d Mon Sep 17 00:00:00 2001
From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
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..75c3a89dd
--- /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=(
+  + '(operation)'
+  '(-h --help)'{-h,--help}'[print help message]'
+  --version'[print current version]'
+  '(-l --list-devices)'{-l,--list-devices}'[list all soundcards and digital audio devices]'
+  '(-L --list-pcms)'{-L,--list-pcms}'[list device names]'
+  + option
+  '(-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)*'{-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 -sS $opts
+
+# The return value passes through
-- 
2.21.0



Messages sorted by: Reverse Date, Date, Thread, Author