yt-cli


Logs | Files | README | LICENSE | GitLab


1
commit 104cb232b7a85ab54e733f6022e0b4296e838461
2
Author: Connor Etherington <[email protected]>
3
Date:   Sat May 13 09:26:12 2023 +0200
4
5
    Auto-Commit Update - 20230513
6
---
7
 PKGBUILD                             |  4 +++-
8
 usr/share/zsh/site-functions/_yt-cli | 33 +++++++++++++++++++++++++++++++++
9
 2 files changed, 36 insertions(+), 1 deletion(-)
10
11
diff --git a/PKGBUILD b/PKGBUILD
12
index 5a987a8..3edf6ce 100644
13
--- a/PKGBUILD
14
+++ b/PKGBUILD
15
@@ -35,8 +35,10 @@ package() {
16
 
17
   install -dm0755 "${pkgdir}"/usr/lib/node_modules/${pkgname}
18
   install -Dm0644 usr/share/licenses/${pkgname}/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
19
+  install -Dm0644 usr/share/zsh/site-functions/_${pkgname} "$pkgdir/usr/share/zsh/site-functions/_${pkgname}"
20
 
21
-  [ -z `which ytcli` ] && install -Dm0755 usr/bin/* -t "${pkgdir}/usr/bin/" || install -Dm0755 usr/bin/${pkgname} "${pkgdir}/usr/bin/${pkgname}"
22
+  [ -z `which ytcli` ] && install -Dm0755 usr/bin/* -t "${pkgdir}/usr/bin/" ||
23
+    install -Dm0755 usr/bin/${pkgname} "${pkgdir}/usr/bin/${pkgname}"
24
 
25
   cp -ar usr/lib/node_modules/${pkgname}/* "${pkgdir}"/usr/lib/node_modules/${pkgname}
26
 
27
diff --git a/usr/share/zsh/site-functions/_yt-cli b/usr/share/zsh/site-functions/_yt-cli
28
new file mode 100644
29
index 0000000..91b2019
30
--- /dev/null
31
+++ b/usr/share/zsh/site-functions/_yt-cli
32
@@ -0,0 +1,33 @@
33
+#compdef yt-cli
34
+
35
+_yt-cli() {
36
+  local curcontext="$curcontext" state line
37
+  typeset -a opt_args
38
+
39
+  _arguments -C \
40
+    '1: :->command' \
41
+    '*:: :->args' && return 0
42
+
43
+  case $state in
44
+    command)
45
+      local commands; commands=(
46
+        "-a:automatically plays first result"
47
+        "-h:shows this help"
48
+      )
49
+      _describe -t commands 'yt-cli command' commands && ret=0
50
+      ;;
51
+    args)
52
+      case $words[1] in
53
+        -a|--auto)
54
+          _files
55
+          ;;
56
+        *)
57
+          _message 'no more arguments'
58
+          ;;
59
+      esac
60
+      ;;
61
+  esac
62
+}
63
+
64
+_yt-cli "$@"
65
+