editenv


Logs | Files | README | README | LICENSE | GitLab


1
commit 5cb9eecad915f6cd7f3db8734b0453a61a1c6886
2
Author: Connor Etherington <[email protected]>
3
Date:   Mon Jun 26 16:58:34 2023 +0200
4
5
    Auto-Commit Update - 20230626
6
---
7
 PKGBUILD        |  2 +-
8
 usr/bin/editenv | 17 +++++++++--------
9
 2 files changed, 10 insertions(+), 9 deletions(-)
10
11
diff --git a/PKGBUILD b/PKGBUILD
12
index 3c84473..2e96fb9 100644
13
--- a/PKGBUILD
14
+++ b/PKGBUILD
15
@@ -1,7 +1,7 @@
16
 # Maintainer: Connor Etherington <[email protected]>
17
 # ---
18
 pkgname=editenv
19
-pkgver=0.1.1
20
+pkgver=0.1.2
21
 pkgrel=1
22
 pkgdesc="A simple command line tool for conveniently storing and editing environment variables."
23
 arch=(any)
24
diff --git a/usr/bin/editenv b/usr/bin/editenv
25
index a475d81..0f4b396 100755
26
--- a/usr/bin/editenv
27
+++ b/usr/bin/editenv
28
@@ -1,4 +1,4 @@
29
-#!/usr/bin/env sh
30
+#!/usr/bin/env bash
31
 
32
 # Debugging:
33
 
34
@@ -27,14 +27,14 @@ FZFPREVIEW="cat $ENTRIESFILE|grep {} | grep -q '#YESPREVIEW' &&
35
 
36
 \e[0m ' && return 0 || echo {} | grep -q 'NEW ENTRY' && echo -e '\n\e[1;32m[+] \e[37mCreate new environment variable\e[0m\n'"
37
 
38
-trap 'rm -f ${TMP}; eval $(source $ENTRIESFILE)' EXIT QUIT STOP ERR
39
+trap "rm -f ${TMP}; eval $(source $ENTRIESFILE) >/dev/null 2>&1" EXIT QUIT STOP ERR
40
 
41
 
42
 # Functions:
43
 
44
 err(){ echo -e "${*}" && exit 1 ; }
45
 
46
-PLACEHOLDER(){ echo '* NEW ENTRY' ; awk -F= '{print $1}' ${1:-$ENTRIESFILE}|sed 's/\s*//;/^$/d;s/export //g'|sort -u|grep -v 'EDITENV_ISSOURCED' ; }
47
+PLACEHOLDER(){ echo -e '\e[32mNEW ENTRY\e[0m' ; awk -F= '{print $1}' ${1:-$ENTRIESFILE}|sed 's/\s*//;/^$/d;s/export //g'|sort -u|grep -v 'EDITENV_ISSOURCED' ; }
48
 
49
 SELECTHOLDER(){ awk -F= '{print $1}' ${1:-$ENTRIESFILE}|sed 's/\s*//;/^$/d;s/export //g'|sort -u|grep -v 'EDITENV_ISSOURCED' ; }
50
 
51
@@ -66,7 +66,7 @@ function NEW {
52
     --stdout --title " ~ NEW ENTRY ~ " \
53
     --form "\n                  Please fill in the required information :\n " 13 81 3 \
54
     " Entry Name   :" 1 1 "" 1 16 59 0 \
55
-    " Entry Value  :" 2 1 "" 2 16 59 0  >${TMP}
56
+    " Entry Value  :" 2 1 "" 2 16 59 0  >${TMP} || exit 1
57
 
58
   ENTRYNAME=$(head -n1 ${TMP} | tail -n1)
59
   ENTRYVALUE=$(head -n2 ${TMP} | tail -n1)
60
@@ -75,7 +75,7 @@ function NEW {
61
     --yes-label "Preview" \
62
     --no-label "No Preview" \
63
     --title " ~ editenv ~ " \
64
-    --yesno "\\n         Would you like to preview this entries value upon future selection?\\n " 7 90
65
+    --yesno "\\n         Would you like to preview this entries value upon future selection?\\n " 7 90 || exit 1
66
 
67
   PREVIEW=${?} && [ ${PREVIEW} -eq "0" ] && PREVIEW="YESPREVIEW" || PREVIEW="NOPREVIEW"
68
 
69
@@ -135,12 +135,13 @@ function MAIN {
70
   VALUE=$( PLACEHOLDER $1 |fzf \
71
     --ansi --no-sort --no-info \
72
     --prompt="Edit or add an entry: " \
73
-    --header " " \
74
-    --height 100% \
75
+    --pointer=▶ --marker=✓ --cycle \
76
+    --color=fg:-1,bg:-1,hl:6,fg+:3,bg+:0,hl+:6 \
77
+    --height 100% --header " " \
78
     --preview "${FZFPREVIEW}" \
79
     --preview-window=70% ) || exit 1
80
 
81
-   [[ ${VALUE} == '* NEW ENTRY' ]] && NEW && return 0
82
+   [[ ${VALUE} == 'NEW ENTRY' ]] && NEW && return 0
83
 
84
    EDITORDEL && return 0
85