| Hash | Commit message | Author | Date | Files | + | - |
1 | commit 7b7ae63590ce865c1a26a08dc0baa352045134d0 |
2 | Author: Connor Etherington <[email protected]> |
3 | Date: Mon Nov 28 01:22:22 2022 +0200 |
4 | |
5 | Auto-Commit Update 28.11.2022 - 01:22:22 |
6 | --- |
7 | PKGBUILD | 18 +++++++++ |
8 | usr/bin/cfl | 10 +++++ |
9 | usr/bin/qed | 78 ++++++++++++++++++++++++++++++++++++++ |
10 | usr/share/doc/toolkit/.gitkeep | 0 |
11 | usr/share/licenses/toolkit/LICENSE | 28 ++++++++++++++ |
12 | 5 files changed, 134 insertions(+) |
13 | |
14 | diff --git a/PKGBUILD b/PKGBUILD |
15 | new file mode 100644 |
16 | index 0000000..ed6312d |
17 | --- /dev/null |
18 | +++ b/PKGBUILD |
19 | @@ -0,0 +1,18 @@ |
20 | +# Maintainer: Connor Etherington <[email protected]> |
21 | +# --- |
22 | +pkgname=toolkit |
23 | +pkgver=0.1.0 |
24 | +pkgrel=1 |
25 | +pkgdesc="A toolbox for the CLI, rapidly speeding up file editing and data management processes." |
26 | +arch=(any) |
27 | +url="https://gitlab.com/a4to/${pkgname}" |
28 | +license=('MIT') |
29 | +depends=(bat) |
30 | +optdepends=('nvim: the recommended editor for power users') |
31 | +source=("git+$url.git") |
32 | +sha256sums=('SKIP') |
33 | + |
34 | +package() { |
35 | + install -Dm644 usr/share/licenses/${pkgname}/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" |
36 | + install -Dm755 usr/bin/* -t "${pkgdir}/usr/bin" |
37 | +} |
38 | diff --git a/usr/bin/cfl b/usr/bin/cfl |
39 | new file mode 100755 |
40 | index 0000000..469953b |
41 | --- /dev/null |
42 | +++ b/usr/bin/cfl |
43 | @@ -0,0 +1,10 @@ |
44 | +#!/usr/bin/env bash |
45 | + |
46 | +FILE='/tmp/cfl-content.txt' |
47 | + |
48 | +[[ -n ${1} ]] && cat ${1} > ${FILE} && ! bat ${FILE} 2>/dev/null && cat ${FILE} 2>/dev/null |
49 | + |
50 | +[[ -z ${1} ]] && ! bat ${FILE} 2>/dev/null && ! cat ${FILE} 2>/dev/null && |
51 | + echo -e "\e[1;33m[!]\e[1;37m CFL content file has not been created yet, run `basename $0` <file> to create it.\e[0m" |
52 | + |
53 | + |
54 | diff --git a/usr/bin/qed b/usr/bin/qed |
55 | new file mode 100755 |
56 | index 0000000..e8408f2 |
57 | --- /dev/null |
58 | +++ b/usr/bin/qed |
59 | @@ -0,0 +1,78 @@ |
60 | +#!/usr/bin/env bash |
61 | + |
62 | +MarkDir="${XDG_CONFIG_HOME:-$HOME/.config}/qed" |
63 | +MarkFile="${MarkDir}/markfile" |
64 | + |
65 | +[ ! -d ${MarkDir} ] && mkdir -p ${MarkDir} |
66 | +[ ! -f ${MarkFile} ] && touch ${MarkFile} |
67 | + |
68 | + |
69 | +getSlot(){ |
70 | + slot=$(dialog --stdout \ |
71 | + --backtitle "Markfile" \ |
72 | + --title "Markfile" \ |
73 | + --menu "Select MarkFile Slot:" \ |
74 | + 0 0 0 "${markfileOpts[@]}" \ |
75 | + ) |
76 | +} |
77 | + |
78 | +newFileEdit(){ |
79 | + |
80 | + markfile=$1 |
81 | + |
82 | + markfileOpts=( |
83 | + 1 "$(grep '^1=' $MarkFile | cut -d= -f2 | rev | cut -d/ -f1 | rev || echo 'Empty')" |
84 | + 2 "$(grep '^2=' $MarkFile | cut -d= -f2 | rev | cut -d/ -f1 | rev || echo 'Empty')" |
85 | + 3 "$(grep '^3=' $MarkFile | cut -d= -f2 | rev | cut -d/ -f1 | rev || echo 'Empty')" |
86 | + 4 "$(grep '^4=' $MarkFile | cut -d= -f2 | rev | cut -d/ -f1 | rev || echo 'Empty')" |
87 | + 5 "$(grep '^5=' $MarkFile | cut -d= -f2 | rev | cut -d/ -f1 | rev || echo 'Empty')" |
88 | + 6 "$(grep '^6=' $MarkFile | cut -d= -f2 | rev | cut -d/ -f1 | rev || echo 'Empty')" |
89 | + 7 "$(grep '^7=' $MarkFile | cut -d= -f2 | rev | cut -d/ -f1 | rev || echo 'Empty')" |
90 | + 8 "$(grep '^8=' $MarkFile | cut -d= -f2 | rev | cut -d/ -f1 | rev || echo 'Empty')" |
91 | + 9 "$(grep '^9=' $MarkFile | cut -d= -f2 | rev | cut -d/ -f1 | rev || echo 'Empty')" |
92 | + 10 "$(grep '^10=' $MarkFile | cut -d= -f2 | rev | cut -d/ -f1 | rev || echo 'Empty')" |
93 | + ) |
94 | + |
95 | + |
96 | + [[ ! -f $markfile ]] && echo -e "\n\e[31;1m[-] File does not exist!\e[0m\n" && exit 1 |
97 | + |
98 | + [[ -f $markfile ]] && markfile=`realpath $markfile` && getSlot |
99 | + |
100 | + [[ -z $slot ]] && echo -e "\n\e[31;1m[-] No slot selected!\e[0m\n" && exit 1 |
101 | + |
102 | + [[ -n $slot ]] && grep -q "^$slot=" $MarkFile && |
103 | + sed -i "s|^$slot=.*|$slot=$markfile|" $MarkFile || |
104 | + echo "$slot=$markfile" >> $MarkFile && |
105 | + clear |
106 | + echo -e "\n\n\e[32;1m[+] `basename $markfile` set to slot $slot\e[0m ✅\n" || |
107 | + echo -e "\n\n\e[31;1m[-] Error setting slot $slot\e[0m\n" |
108 | + |
109 | +} |
110 | + |
111 | +USAGE(){ |
112 | + clear && echo -e "\n\n \e[32;1;3mUsage:\e[0;35;1m\n\n |
113 | + $(basename $0) \e[1;37m => \e[36;1m (Dry Run) List all slots and associated files\e[35;1m\n |
114 | + $(basename $0) \e[33;1m [ FILE ]\e[1;37m => \e[36;1m Save file to a selected slot (1-10)\e[35;1m |
115 | + $(basename $0) \e[33;1m [ 1 - 10 ]\e[1;37m => \e[36;1m Open file in slot selected slot in ${EDITOR:-your editor}\e[35;1m |
116 | + $(basename $0) \e[33;1m [ -c|cls ]\e[1;37m => \e[36;1m Clear all slots\e[0m\n\n" |
117 | +} |
118 | + |
119 | +case $1 in |
120 | + 1) ${EDITOR:-nvim} $(grep "^1=" $MarkFile | cut -d= -f2) ;; |
121 | + 2) ${EDITOR:-nvim} $(grep "^2=" $MarkFile | cut -d= -f2) ;; |
122 | + 3) ${EDITOR:-nvim} $(grep "^3=" $MarkFile | cut -d= -f2) ;; |
123 | + 4) ${EDITOR:-nvim} $(grep "^4=" $MarkFile | cut -d= -f2) ;; |
124 | + 5) ${EDITOR:-nvim} $(grep "^5=" $MarkFile | cut -d= -f2) ;; |
125 | + 6) ${EDITOR:-nvim} $(grep "^6=" $MarkFile | cut -d= -f2) ;; |
126 | + 7) ${EDITOR:-nvim} $(grep "^7=" $MarkFile | cut -d= -f2) ;; |
127 | + 8) ${EDITOR:-nvim} $(grep "^8=" $MarkFile | cut -d= -f2) ;; |
128 | + 9) ${EDITOR:-nvim} $(grep "^9=" $MarkFile | cut -d= -f2) ;; |
129 | + 10) ${EDITOR:-nvim} $(grep "^10=" $MarkFile | cut -d= -f2) ;; |
130 | + CLEAR|CLEAN|cls) echo -n "" > $MarkFile && echo -e "\n\e[32;1m[+] Markfile Cleared\e[0m ✅\n" ;; |
131 | + -h|--help|help) USAGE ;; |
132 | + "") while read -r line; do |
133 | + echo -e "\e[32;1m[+] Slot $line\e[0m: $(grep "^$line=" $MarkFile | cut -d= -f2 | rev | cut -d/ -f1 | rev)" |
134 | + done < <(seq 1 10) ;; |
135 | + *) newFileEdit $1 ;; |
136 | +esac |
137 | + |
138 | diff --git a/usr/share/doc/toolkit/.gitkeep b/usr/share/doc/toolkit/.gitkeep |
139 | new file mode 100644 |
140 | index 0000000..e69de29 |
141 | diff --git a/usr/share/licenses/toolkit/LICENSE b/usr/share/licenses/toolkit/LICENSE |
142 | new file mode 100644 |
143 | index 0000000..276f429 |
144 | --- /dev/null |
145 | +++ b/usr/share/licenses/toolkit/LICENSE |
146 | @@ -0,0 +1,28 @@ |
147 | +MIT/X Consortium License |
148 | + |
149 | +Creator /Maintainer : |
150 | +© 2020-2022 Connor Etherington <[email protected]> |
151 | +--------------------------------------------------------------------------- |
152 | +Contributors: |
153 | + |
154 | + |
155 | +--------------------------------------------------------------------------- |
156 | + |
157 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
158 | +of this software and associated documentation files (the "Software"), to deal |
159 | +in the Software without restriction, including without limitation the rights |
160 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
161 | +copies of the Software, and to permit persons to whom the Software is |
162 | +furnished to do so, subject to the following conditions: |
163 | + |
164 | +THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN ALL |
165 | +COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. |
166 | + |
167 | + |
168 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
169 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
170 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
171 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
172 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
173 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
174 | +SOFTWARE. |