-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathglobals
More file actions
219 lines (189 loc) · 3.9 KB
/
globals
File metadata and controls
219 lines (189 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#!/bin/bash
# SPDX-FileCopyrightText: 2017 - 2024 sudorook <daemon@nullcodon.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# Utility functions
#
show_error() {
local red=$'\033[0;91m'
local nc=$'\033[0m'
if [[ "${1:--e}" =~ ^(-e|-n)$ ]]; then
echo "${1:--e}" "${red}${*:2}${nc}" 1>&2
else
echo -e "${red}${*}${nc}" 1>&2
fi
}
export -f show_error
show_info() {
local green=$'\033[0;92m'
local nc=$'\033[0m'
if [[ "${1:--e}" =~ ^(-e|-n)$ ]]; then
echo "${1:--e}" "${green}${*:2}${nc}"
else
echo -e "${green}${*}${nc}"
fi
}
export -f show_info
show_warning() {
local yellow=$'\033[0;93m'
local nc=$'\033[0m'
if [[ "${1:--e}" =~ ^(-e|-n)$ ]]; then
echo "${1:--e}" "${yellow}${*:2}${nc}"
else
echo -e "${yellow}${*}${nc}"
fi
}
export -f show_warning
show_question() {
local blue=$'\033[0;94m'
local nc=$'\033[0m'
if [[ "${1:--e}" =~ ^(-e|-n)$ ]]; then
echo "${1:--e}" "${blue}${*:2}${nc}"
else
echo -e "${blue}${*}${nc}"
fi
}
export -f show_question
ask_question() {
local blue=$'\033[0;94m'
local nc=$'\033[0m'
local var
read -r -p "${blue}$*${nc} " var
echo "${var}"
}
export -f ask_question
ask_secret() {
local blue=$'\033[0;94m'
local nc=$'\033[0m'
local var
stty -echo echonl
read -r -p "${blue}$*${nc} " var
stty echo -echonl
echo "${var}"
}
export -f ask_secret
show_success() {
local purple=$'\033[0;95m'
local nc=$'\033[0m'
if [[ "${1:--e}" =~ ^(-e|-n)$ ]]; then
echo "${1:--e}" "${purple}${*:2}${nc}"
else
echo -e "${purple}${*}${nc}"
fi
}
export -f show_success
show_header() {
local cyan=$'\033[0;96m'
local nc=$'\033[0m'
if [[ "${1:--e}" =~ ^(-e|-n)$ ]]; then
echo "${1:--e}" "${cyan}${*:2}${nc}"
else
echo -e "${cyan}${*}${nc}"
fi
}
export -f show_header
show_listitem() {
local white=$'\033[0;97m'
local nc=$'\033[0m'
if [[ "${1:--e}" =~ ^(-e|-n)$ ]]; then
echo "${1:--e}" "${white}${*:2}${nc}"
else
echo -e "${white}${*}${nc}"
fi
}
export -f show_listitem
check_command() {
local package
local missing=()
for package in "${@}"; do
if ! command -v "${package}" > /dev/null; then
missing+=("${package}")
fi
done
if [ ${#missing[@]} -eq 0 ]; then
return 0
else
show_error "MISSING: ${missing[*]@Q} not installed."
return 1
fi
}
export -f check_command
#
# Global variables
#
# archive destination dir
archivedir=
export archivedir
# backup-home, backup-vms
backup1=
backup2=
export backup1
export backup2
# kvm dirs
kvmdir=
kvmshare=
export kvmdir
export kvmshare
# virtualbox dirs
vboxdir=
export vboxdir
# encrypted folder
encryptpath=
decryptpath=
export encryptpath
export decryptpath
# theme dirs
gtkdir=
plasmadir=
icondir=
export gtkdir
export plasmadir
export icondir
# zsh dir
zshdir=
export zshdir
# pkgbuild dir
pkgbuilddir=
export pkgbuilddir
# project folders
projectdir=
ignoreprojectdirs=()
export projectdir
export ignoreprojectdirs
# music folders
musicdir=
export musicdir
# video folders
videodir=
export videodir
# Calibre folders
calibrelibrarydir=
export calibrelibrarydir
# Zotero folders
zoterodatadir=
export zoterodatadir
# entry
entrydir=
template=
export entrydir
export template
# WeeChat plugin directory
weechatplugindir=
# Vim pack directory
vimpackdir=
# NeoVim pack directory
nvimpackdir=