snip


Logs | Files | README | LICENSE | GitLab


1
commit 651d255b73876ee98464fccc65bc011166b0070a
2
Author: Connor Etherington <[email protected]>
3
Date:   Thu May 4 16:47:43 2023 +0200
4
5
    Auto-Commit Update - 20230504
6
---
7
 PKGBUILD     |  2 +-
8
 usr/bin/snip | 37 +++++++++++++++++++++++++------------
9
 2 files changed, 26 insertions(+), 13 deletions(-)
10
11
diff --git a/PKGBUILD b/PKGBUILD
12
index d550251..5ed18e7 100644
13
--- a/PKGBUILD
14
+++ b/PKGBUILD
15
@@ -1,7 +1,7 @@
16
 # Maintainer: Connor Etherington <[email protected]>
17
 # ---
18
 pkgname=snip
19
-pkgver=1.0.0
20
+pkgver=1.1.0
21
 pkgrel=1
22
 pkgdesc="A simple snippet manager for your predefined Ultisnips Snippet Directory"
23
 arch=(any)
24
diff --git a/usr/bin/snip b/usr/bin/snip
25
index b067fff..8dd1d18 100755
26
--- a/usr/bin/snip
27
+++ b/usr/bin/snip
28
@@ -29,25 +29,38 @@ newCatagory(){ \
29
 
30
   [ -z "${snipType}" ] && err "No Snippet Type Was Entered..."
31
 
32
+  AutoFill="1"
33
+  Low="10"
34
+  Medium="20"
35
+  High="30"
36
+  Important="40"
37
+  Critical="50"
38
+  Vital="60"
39
+  Essential="70"
40
+  Mandatory="80"
41
+
42
   snipFile=$(dialog \
43
     --stdout --colors --no-tags \
44
     --title " ~ New Snippet ~ " \
45
-    --menu "\\n Please Select Snippet Priority (10=highest):\\n "  16 50 70 \
46
-    "10" "10" \
47
-    "20" "20" \
48
-    "30" "30" \
49
-    "40" "40" \
50
-    "50" "50" \
51
-    "60" "60" || exit 0)
52
+    --menu "\\n       Please Select Snippet Priority:\\n "  16 50 70 \
53
+    "AutoFill" "AutoFill" \
54
+    "Low" "Low" \
55
+    "Medium" "Medium" \
56
+    "High" "High" \
57
+    "Important" "Important" \
58
+    "Critical" "Critical" \
59
+    "Vital" "Vital" \
60
+    "Essential" "Essential" \
61
+    "Mandatory" "Mandatory" || exit 0)
62
 
63
   [ -z "${snipFile}" ] && err "No Snippet Type Was Entered..."
64
 
65
   [ -d ${SNIPDIR}/${snipType} ] || mkdir -p ${SNIPDIR}/${snipType} >/dev/null 2>&1
66
 
67
-  [ -f "${SNIPDIR}/${snipType}/${snipType}-p${snipFile%0}.snippets" ] ||
68
-    echo -e "priority ${snipFile}\n" >> "${SNIPDIR}/${snipType}/${snipType}-p${snipFile%0}.snippets"
69
+  [ -f "${SNIPDIR}/${snipType}/${snipFile}-p${!snipFile}.snippets" ] ||
70
+    echo -e "priority ${!snipFile}\n" >> "${SNIPDIR}/${snipType}/${snipFile}-p${!snipFile}.snippets"
71
 
72
-  ${EDITOR} ${SNIPDIR}/${snipType}/${snipType}-p${snipFile%0}.snippets &&
73
+  ${EDITOR} ${SNIPDIR}/${snipType}/${snipFile}-p${!snipFile}.snippets &&
74
   notify-send " ✅ New Snippet File Created!" &&
75
   exit 0 || err "Snippet file could not be altered ..."
76
 
77
@@ -85,7 +98,7 @@ SNIPDIR="$(realpath ${SNIPDIR})"
78
 editSnippet(){ dialog \
79
   --stdout --no-tags --colors \
80
   --title " ~ Select Snippet Type ~ " \
81
-  --menu "\\n         Please Select Snippet Type :\\n " 16 50 70 \
82
+  --menu "\\n         Please Select Snippet Type :\\n " 30 50 21 \
83
     "${snipType[@]}" 'NEW' 'Define New Snippet Type' \
84
     >${tmpSnipType} || exit 0
85
 
86
@@ -122,7 +135,7 @@ source ${SNIPDATA}/sniprc >/dev/null 2>&1
87
 echo 'snipType=(' >${tmpSnipName}
88
 
89
 for Dirs in $(find ${SNIPDIR} -maxdepth 1 -type d|sort); do for x in $(ls -1 ${Dirs}|sort|grep ".*\.snippets$"); do
90
-echo "'${x}' '$(basename ${x} .snippets) \
91
+  echo "'${x}' '$(basename ${Dirs[@]}) ($(basename ${x} .snippets | sed 's|-p.*||')[$(basename ${x} .snippets | sed 's/.*-p//')]) \
92
 Snippets'" >>${tmpSnipName} ; done
93
 done
94