editenv


Logs | Files | README | README | LICENSE | GitLab


1
commit dfb649fcc800e32ef566924f3b6173b6ec672b24
2
Author: Connor Etherington <[email protected]>
3
Date:   Thu Jul 13 02:08:54 2023 +0200
4
5
    Auto-Commit Update - 20230713
6
---
7
 PKGBUILD                              |  4 +++-
8
 usr/share/zsh/site-functions/_editenv | 25 +++++++++++++++++++++++++
9
 2 files changed, 28 insertions(+), 1 deletion(-)
10
11
diff --git a/PKGBUILD b/PKGBUILD
12
index 37a96b2..d1d41c5 100644
13
--- a/PKGBUILD
14
+++ b/PKGBUILD
15
@@ -1,13 +1,14 @@
16
 # Maintainer: Connor Etherington <[email protected]>
17
 # ---
18
 pkgname=editenv
19
-pkgver=0.2.2
20
+pkgver=0.2.3
21
 pkgrel=1
22
 pkgdesc="A simple command line tool for conveniently storing and editing environment variables."
23
 arch=(any)
24
 url="https://gitlab.com/a4to/${pkgname}"
25
 license=('MIT')
26
 depends=(dialog xsel)
27
+optdepends=('zsh: zsh completion')
28
 install="${pkgname}.install"
29
 source=(
30
   "https://concise.cc/pkg/${pkgname}-${pkgver}-${pkgrel}-$arch.pkg.tar.xz"
31
@@ -29,5 +30,6 @@ package() {
32
 
33
   install -Dm644 usr/share/licenses/${pkgname}/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
34
   install -Dm755 usr/bin/${pkgname} "${pkgdir}/usr/bin/${pkgname}"
35
+  install -Dm0644 usr/share/zsh/site-functions/_${pkgname} "$pkgdir/usr/share/zsh/site-functions/_${pkgname}"
36
 
37
 }
38
diff --git a/usr/share/zsh/site-functions/_editenv b/usr/share/zsh/site-functions/_editenv
39
new file mode 100644
40
index 0000000..bc45f20
41
--- /dev/null
42
+++ b/usr/share/zsh/site-functions/_editenv
43
@@ -0,0 +1,25 @@
44
+#compdef editenv
45
+
46
+_editenv()
47
+{
48
+    local curcontext="$curcontext" state line
49
+    typeset -A opt_args
50
+
51
+    local -a args
52
+    args=(
53
+        '(-h --help)'{-h,--help}'[Show help]'
54
+        '(-c --copy)'{-c,--copy}'[Copy env var to clipboard]: :->copy'
55
+    )
56
+
57
+    _arguments -s -S $args[@] && return
58
+
59
+    case $state in
60
+        copy)
61
+            local -a vars
62
+            vars=($(awk 'NR>3 && /^export /{print substr($2, 1, index($2, "=")-1)}' $HOME/.local/share/editenv/entries))
63
+            _describe 'values' vars && return
64
+        ;;
65
+    esac
66
+}
67
+
68
+compdef _editenv editenv