about summary refs log tree commit homepage
path: root/examples
diff options
context:
space:
mode:
authorJames Rowe <jnrowe@gmail.com>2019-11-06 06:52:26 +0000
committerEric Wong <e@80x24.org>2019-11-09 09:05:24 +0000
commit8645836f09bd7d1060f124a18bab534ee4970dc0 (patch)
treea9577afa9ef99f11547cf6bd8ca40e679cd4027d /examples
parentc9aaee89d02edd195c56b9bc1c2a9644d146f51a (diff)
downloaddtas-8645836f09bd7d1060f124a18bab534ee4970dc0.tar.gz
This adds completion support for all the current commands, including
completion for sink and source names where they are used.
Diffstat (limited to 'examples')
-rw-r--r--examples/zsh-completion/README3
-rw-r--r--examples/zsh-completion/_dtas-archive16
-rw-r--r--examples/zsh-completion/_dtas-ctl114
-rw-r--r--examples/zsh-completion/_dtas-cueedit7
-rw-r--r--examples/zsh-completion/_dtas-enq7
-rw-r--r--examples/zsh-completion/_dtas-mlib29
-rw-r--r--examples/zsh-completion/_dtas-msinkctl8
-rw-r--r--examples/zsh-completion/_dtas-partstats7
-rw-r--r--examples/zsh-completion/_dtas-sinkedit11
-rw-r--r--examples/zsh-completion/_dtas-sourceedit11
-rw-r--r--examples/zsh-completion/_dtas-splitfx17
-rw-r--r--examples/zsh-completion/_dtas-tl52
-rw-r--r--examples/zsh-completion/_dtas-xdelay17
13 files changed, 299 insertions, 0 deletions
diff --git a/examples/zsh-completion/README b/examples/zsh-completion/README
new file mode 100644
index 0000000..89b3afd
--- /dev/null
+++ b/examples/zsh-completion/README
@@ -0,0 +1,3 @@
+To use the completion functions defined in this directory either: add
+the completions you wish to use to a directory in your $fpath, or add
+this directory's path to $fpath *prior* to calling compinit.
diff --git a/examples/zsh-completion/_dtas-archive b/examples/zsh-completion/_dtas-archive
new file mode 100644
index 0000000..2bfdf7e
--- /dev/null
+++ b/examples/zsh-completion/_dtas-archive
@@ -0,0 +1,16 @@
+#compdef dtas-archive
+
+# To the extent possible under law, James Rowe has waived all copyright and
+# related or neighboring rights to this example.
+
+_arguments -S \
+    "--type=[file type]" \
+    "--compression=[compression factor for sox]:select compression:({0..8})" \
+    "--jobs=[number of jobs]: :_guard '[0-9]#' value" \
+    "--stats[save stats on the file]" \
+    "--keep-going[continue after error]" \
+    "--dry-run[only print commands, do not run them]" \
+    "--repeat=[number of times to check]: :_guard '[0-9]#' value" \
+    "--help[display help message]" \
+    ":select source:_files" \
+    ":select destination:_files"
diff --git a/examples/zsh-completion/_dtas-ctl b/examples/zsh-completion/_dtas-ctl
new file mode 100644
index 0000000..d82533b
--- /dev/null
+++ b/examples/zsh-completion/_dtas-ctl
@@ -0,0 +1,114 @@
+#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
+(cd)
+    _arguments \
+        ":select dir:_path_files -/"
+    ;;
+(cue)
+    _arguments \
+        ':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)
+    _arguments \
+        "*:select file:_files"
+    ;;
+(format)
+    _arguments \
+        '*:dtas-ctl format command:((
+            channels\:"number of channels to use internally"
+            endian\:"change endianess"
+            bits\:"sample precision"
+            rate\:"sample rate of audio"
+            type\:"change the raw PCM format"
+        ))'
+    ;;
+(seek)
+    _arguments \
+        ":select track:_guard '[0-9]#' 'track number'"
+    ;;
+(sink)
+    _arguments \
+        ':sink subcommand:((
+            ls\:"list names of current sinks"
+            cat\:"dump SINKNAME config in YAML"
+            rm\:"remove SINKNAME"
+            ed\:"create/edit SINKNAME"
+        ))'
+    ;;
+(source)
+    _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"
+        ))'
+    ;;
+(state dump)
+    _arguments \
+        ":select file:_files"
+    ;;
+(tl)
+    _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"
+        ))'
+    ;;
+(trim)
+    _arguments \
+        ":select beginning" \
+        ":select end"
+    ;;
+(*)
+    ;;
+esac
diff --git a/examples/zsh-completion/_dtas-cueedit b/examples/zsh-completion/_dtas-cueedit
new file mode 100644
index 0000000..ac87822
--- /dev/null
+++ b/examples/zsh-completion/_dtas-cueedit
@@ -0,0 +1,7 @@
+#compdef dtas-cueedit
+
+# To the extent possible under law, James Rowe has waived all copyright and
+# related or neighboring rights to this example.
+
+_arguments \
+    ':select file:_files -g "*.flac"'
diff --git a/examples/zsh-completion/_dtas-enq b/examples/zsh-completion/_dtas-enq
new file mode 100644
index 0000000..a8f9c3f
--- /dev/null
+++ b/examples/zsh-completion/_dtas-enq
@@ -0,0 +1,7 @@
+#compdef dtas-enq
+
+# To the extent possible under law, James Rowe has waived all copyright and
+# related or neighboring rights to this example.
+
+_arguments \
+    "*:select file:_files"
diff --git a/examples/zsh-completion/_dtas-mlib b/examples/zsh-completion/_dtas-mlib
new file mode 100644
index 0000000..24418ea
--- /dev/null
+++ b/examples/zsh-completion/_dtas-mlib
@@ -0,0 +1,29 @@
+#compdef dtas-mlib
+
+# To the extent possible under law, James Rowe has waived all copyright and
+# related or neighboring rights to this example.
+#
+_arguments \
+    "--database=[database]:select file:_files" \
+    "--force[force updates]" \
+    "--help[display help message]" \
+    ':dtas-mlib action:((
+            dump\:"dump database"
+            search\:"search database"
+            stats\:"display statistics"
+            update\:"migrate database"
+        ))' \
+    "*::subcmd:->subcmd" && return 0
+
+case "$words[1]" in
+(dump|update)
+    _arguments -S \
+        ":select directory:_path_files -/"
+    ;;
+(search)
+    _arguments -S \
+        "*:search term:"
+    ;;
+(*)
+    ;;
+esac
diff --git a/examples/zsh-completion/_dtas-msinkctl b/examples/zsh-completion/_dtas-msinkctl
new file mode 100644
index 0000000..941c23b
--- /dev/null
+++ b/examples/zsh-completion/_dtas-msinkctl
@@ -0,0 +1,8 @@
+#compdef dtas-msinkctl
+
+# To the extent possible under law, James Rowe has waived all copyright and
+# related or neighboring rights to this example.
+
+_arguments \
+    "1:select action:(active{,-{set,add,sub}} nonblock)" \
+    "*:select sink:($(dtas-ctl sink ls 2> /dev/null))"
diff --git a/examples/zsh-completion/_dtas-partstats b/examples/zsh-completion/_dtas-partstats
new file mode 100644
index 0000000..9460684
--- /dev/null
+++ b/examples/zsh-completion/_dtas-partstats
@@ -0,0 +1,7 @@
+#compdef dtas-partstats
+
+# To the extent possible under law, James Rowe has waived all copyright and
+# related or neighboring rights to this example.
+
+_arguments \
+    ":select file:_files"
diff --git a/examples/zsh-completion/_dtas-sinkedit b/examples/zsh-completion/_dtas-sinkedit
new file mode 100644
index 0000000..be6de53
--- /dev/null
+++ b/examples/zsh-completion/_dtas-sinkedit
@@ -0,0 +1,11 @@
+#compdef dtas-sinkedit
+
+# To the extent possible under law, James Rowe has waived all copyright and
+# related or neighboring rights to this example.
+
+_arguments \
+    "--no-watch[disable inotify support]" \
+    "--dry-run[only print commands, do not run them]" \
+    "--verbose[print out commands sent to change the sink]" \
+    "--help[display help message]" \
+    ":select sink:($(dtas-ctl sink ls 2> /dev/null))"
diff --git a/examples/zsh-completion/_dtas-sourceedit b/examples/zsh-completion/_dtas-sourceedit
new file mode 100644
index 0000000..56da661
--- /dev/null
+++ b/examples/zsh-completion/_dtas-sourceedit
@@ -0,0 +1,11 @@
+#compdef dtas-sourceedit
+
+# To the extent possible under law, James Rowe has waived all copyright and
+# related or neighboring rights to this example.
+
+_arguments \
+    "--no-watch[disable inotify support]" \
+    "--dry-run[only print commands, do not run them]" \
+    "--verbose[print out commands sent to change the source]" \
+    "--help[display help message]" \
+    ":select source:($(dtas-ctl source ls 2> /dev/null))"
diff --git a/examples/zsh-completion/_dtas-splitfx b/examples/zsh-completion/_dtas-splitfx
new file mode 100644
index 0000000..dfebb64
--- /dev/null
+++ b/examples/zsh-completion/_dtas-splitfx
@@ -0,0 +1,17 @@
+#compdef dtas-splitfx
+
+# To the extent possible under law, James Rowe has waived all copyright and
+# related or neighboring rights to this example.
+
+_arguments -S \
+    "--dry-run[only print commands, do not run them]" \
+    "--jobs=[number of jobs]: :_guard '[0-9]#' value" \
+    "--no-dither[don't apply sox dithering]" \
+    "--outdir=[select output directory]:select directory:_path_files -/" \
+    "--compression=[compression factor for sox]:select compression:({0..8})" \
+    "--rate=[sample rate of audio]:select sample rate:(22050 44100 48000)" \
+    "--bits=[sample precision]:select precision:(8 16 24)" \
+    "--trim=[sections of audio to cut]:select sections:_guard '[0-9,]#' 'value'" \
+    "--sox-pipe[use as pipeline]" \
+    '1:select splitfx file:_files -g "*.yml"' \
+    "*:select file:_files"
diff --git a/examples/zsh-completion/_dtas-tl b/examples/zsh-completion/_dtas-tl
new file mode 100644
index 0000000..8e2b098
--- /dev/null
+++ b/examples/zsh-completion/_dtas-tl
@@ -0,0 +1,52 @@
+#compdef dtas-tl
+
+# To the extent possible under law, James Rowe has waived all copyright and
+# related or neighboring rights to this example.
+
+_arguments \
+    ':dtas-tl command:((
+       aac\:"add tracks after current track in the tracklist"
+       addhead\:"add tracks to the beginning of the tracklist"
+       addtail\:"add tracks to the end of the tracklist"
+       consume\:"enabling \"consume\" mode"
+       current\:"display the current track"
+       current-id\:"display the track of the current track"
+       cat\:"display a tracklist"
+       clear\:"remove all tracks from the tracklist"
+       edit\:"spawn an editor to allow editing the tracklist"
+       goto\:"play track immediately"
+       reto\:"play track matching regular expression"
+       next\:"play the next track in the tracklist"
+       prev\:"play the previous track in the tracklist"
+       repeat\:"control track repeating"
+       shuffle\:"control playback randomization"
+    ))' \
+    "*::subcmd:->subcmd" && return 0
+
+case "$words[1]" in
+(aac|addtail)
+    _arguments \
+        ":select file:_files"
+    ;;
+(addhead)
+    _arguments \
+        "*:select file:_files"
+    ;;
+(consume|repeat|shuffle)
+    _arguments \
+        ":select state:(true false)"
+    ;;
+(goto)
+    _arguments \
+        ":select track:($(dtas-ctl tl tracks 2> /dev/null))"
+    ;;
+(reto)
+    _arguments \
+        "-F[use fixed strings]" \
+        "-i[ignore case]" \
+        ":search term" \
+        ":select beginning"
+    ;;
+(*)
+    ;;
+esac
diff --git a/examples/zsh-completion/_dtas-xdelay b/examples/zsh-completion/_dtas-xdelay
new file mode 100644
index 0000000..356537d
--- /dev/null
+++ b/examples/zsh-completion/_dtas-xdelay
@@ -0,0 +1,17 @@
+#compdef dtas-xdelay
+
+# To the extent possible under law, James Rowe has waived all copyright and
+# related or neighboring rights to this example.
+
+_arguments -S \
+    "--crossover-frequency=[frequency at which to set the crossover]: :_guard '[0-9]#' frequency" \
+    "--lowpass-delay[delay the lowpass frequency instead of the highpass one]" \
+    "--channels=[number of channels]:select channels:(1 2)" \
+    "--rate=[sample rate of audio]:select sample rate:(22050 44100 48000)" \
+    "--type=[file type]:select output type:($(sox --help 2> /dev/null | sed -n '/AUDIO FILE FORMATS/s/.*: //p'))" \
+    "--dry-run[only print commands, do not run them]" \
+    "--lowpass=[Custom format string for lowpass filter]" \
+    "--highpass=[Custom format string for highpass filter]" \
+    ":select input1:_files" \
+    ":select input2:_files" \
+    ":select delay:_guard '[0-9]#' delay"