mirror of
https://github.com/RyanGreenup/cadmus.git
synced 2025-08-13 09:35:22 +02:00
Added Template, restructured Scripts
This commit is contained in:
@@ -10,6 +10,7 @@ set -o pipefail # don't hide errors within pipes
|
||||
# * Main Function
|
||||
main() {
|
||||
setVars
|
||||
check_for_dependencies
|
||||
arguments "${@}"
|
||||
SkimAndGrep
|
||||
|
||||
@@ -66,14 +67,14 @@ SkimAndGrep () {
|
||||
|
||||
#
|
||||
#
|
||||
# *** Set variables almost globally
|
||||
# *** Set variables below main
|
||||
setVars () {
|
||||
readonly script_name=$(basename "${0}")
|
||||
readonly script_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
IFS=$'\t\n' # Split on newlines and tabs (but not on spaces)
|
||||
}
|
||||
|
||||
## *** Interpret arguments
|
||||
# *** Interpret arguments
|
||||
arguments () {
|
||||
while test $# -gt 0
|
||||
do
|
||||
@@ -91,7 +92,7 @@ arguments () {
|
||||
done
|
||||
}
|
||||
|
||||
## *** Print Help
|
||||
# *** Print Help
|
||||
|
||||
Help () {
|
||||
|
||||
@@ -118,5 +119,26 @@ Help () {
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
# *** Check for Dependencies
|
||||
check_for_dependencies () {
|
||||
|
||||
for i in ${DependArray[@]}; do
|
||||
command -v "$i" >/dev/null 2>&1 || { echo >&2 "I require $i but it's not installed. Aborting."; exit 1; }
|
||||
done
|
||||
|
||||
|
||||
}
|
||||
|
||||
# **** List of Dependencies
|
||||
|
||||
declare -a DependArray=(
|
||||
"rg"
|
||||
"sk"
|
||||
"mdcat"
|
||||
"xclip"
|
||||
)
|
||||
|
||||
|
||||
## * Call Main Function
|
||||
main "${@}"
|
||||
|
Reference in New Issue
Block a user