about summary refs log tree commit homepage
path: root/examples/zsh-completion/_dtas-tl
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/zsh-completion/_dtas-tl
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/zsh-completion/_dtas-tl')
-rw-r--r--examples/zsh-completion/_dtas-tl52
1 files changed, 52 insertions, 0 deletions
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