editenv


Logs | Files | README | README | LICENSE | GitLab


1
commit 3a0998d1085365df878f6df57a05cc208345372b
2
Author: Connor Etherington <[email protected]>
3
Date:   Mon Sep 4 05:52:00 2023 +0200
4
5
    Auto-Commit Update - 20230904
6
---
7
 README.md       | 40 ++++++++++++++++++++++++++++++++++++++++
8
 usr/bin/editenv | 16 +++++++++++++---
9
 2 files changed, 53 insertions(+), 3 deletions(-)
10
11
diff --git a/README.md b/README.md
12
new file mode 100644
13
index 0000000..455fcd6
14
--- /dev/null
15
+++ b/README.md
16
@@ -0,0 +1,40 @@
17
+# Editenv
18
+
19
+Editenv is a CLI utility that allows users to manage environment variables in a simple and organized manner. It also offers the convenience of copying environment variable values directly to the clipboard.
20
+
21
+## Features
22
+- Define environment variables in a simple, consolidated file.
23
+- Copy environment variable values to the clipboard with a simple command.
24
+
25
+## Installation
26
+
27
+Provide installation instructions here.
28
+
29
+## Usage
30
+
31
+`editenv -c <variable>` - Copies the value of `<variable>` to the clipboard.
32
+
33
+`editenv -h` - Shows help information.
34
+
35
+## Autocomplete
36
+
37
+Editenv supports shell autocomplete for Zsh and Bash. This feature can be enabled by following the instructions in the `autocomplete` directory.
38
+
39
+## DWM fix (Preventing not-sourced popup)
40
+
41
+In some cases, such as running the script from a dwm keybinding, for example:
42
+
43
+      { MODKEY,         			XK_period,	spawn,		SHCMD(TERMINAL " -e editenv") },
44
+
45
+
46
+or other instances where the `EDITENV_ISSOURCED` or `EDITENV_PATHFILE` vars are not set, a warning will be displayed. To prevent this popup, the `--ignore-sourced-warning` flag can be added to the command, e.g. `editenv --ignore-sourced-warning`, or:
47
+
48
+      { MODKEY,         			XK_period,	spawn,		SHCMD(TERMINAL " -e editenv --ignore-sourced-warning") },
49
+
50
+
51
+
52
+For any other information, refer to the man page (`man editenv`).
53
+
54
+## License
55
+
56
+E
57
diff --git a/usr/bin/editenv b/usr/bin/editenv
58
index 0137b15..d13965c 100755
59
--- a/usr/bin/editenv
60
+++ b/usr/bin/editenv
61
@@ -121,13 +121,23 @@ function NEW {
62
 
63
 function EDITORDEL {
64
 
65
-  dialog \
66
+  ACTION=`dialog \
67
+    --extra-button \
68
     --stdout --title " ~ EDIT ENV ~ " \
69
     --yes-label "Edit" \
70
+    --extra-label "Copy" \
71
     --no-label "Delete" \
72
-    --yesno "\\n    Would you like to edit or delete this entry?\\n " 7 55
73
+    --yesno "\\n    Would you like to edit or delete this entry?\\n " 7 55`
74
+
75
+  echo $ACTION
76
+  echo $ACTION
77
+  echo $ACTION
78
+  echo $ACTION
79
+  echo $ACTION
80
+  echo $ACTION
81
+
82
 
83
-  ACTION=${?} && [ ${ACTION} -eq "0" ] && EDIT ${VALUE} $(prev=`cat $ENTRIESFILE| grep "${VALUE}="| cut -d# -f2 | cut -b1` && [ $prev == "Y" ] || [ $prev == 'y' ] && echo "Y/n" || echo "y/N" ) || DEL ${VALUE}
84
+  [[ "${ACTION}" == 0 ]] && EDIT ${VALUE} $(prev=`cat $ENTRIESFILE| grep "${VALUE}="| cut -d# -f2 | cut -b1` && [ $prev == "Y" ] || [[ $ACTION -eq 2 ]] [ $prev == 'y' ] && echo "Y/n" || echo "y/N" ) || DEL ${VALUE} || COPYVAL ${VALUE} "✅ Copied ${VALUE} to clipboard"
85
 
86
 }
87