1
0
mirror of https://github.com/RyanGreenup/cadmus.git synced 2025-08-29 16:50:00 +02:00

Added a smarter Print

This commit is contained in:
Ryan Greenup
2020-07-13 02:52:33 +10:00
parent e919436ad5
commit 3feee6d787

View File

@@ -1,15 +1,41 @@
#!/usr/bin/env bash #!/usr/bin/env bash
main() { main () {
printThis
check_for_dependencies check_for_dependencies
download_the_repo download_the_repo
} }
check_for_dependencies() { printThis () {
echo "This Script will print to the terminal for review, press any key to continue"
read -d '' -s -n1
cd $(dirname "$0")
pwd
me=`basename "$0"`
safePrint $me
echo "Are you happy to proceed? Press y to continue"
read -d '' -s -n1 proceedQ
if [ "$proceedQ" != "y" ]; then
return
fi
}
safePrint () {
if hash highlight 2>/dev/null; then
highlight "$@"
else
cat "$@"
fi
}
check_for_dependencies () {
echo "Press Any Key to Check for dependencies, press the c Key to Skip this" echo "Press Any Key to Check for dependencies, press the c Key to Skip this"
return_from_function_Q c
read -d '' -s -n1 CheckDepQ read -d '' -s -n1 CheckDepQ
if [ "$CheckDepQ" == "c" ]; then if [ "$CheckDepQ" == "c" ]; then
return return
@@ -23,7 +49,7 @@ check_for_dependencies() {
} }
download_the_repo() { download_the_repo () {
echo "Press y to download the repo" echo "Press y to download the repo"
read -d '' -s -n1 downloadQ read -d '' -s -n1 downloadQ
@@ -56,26 +82,26 @@ download_the_repo() {
# Declare an array of string with type # Declare an array of string with type
declare -a StringArray=("R" declare -a StringArray=("R"
"highlight" "highlight"
node "node"
nvim "nvim"
fzf "fzf"
code "code"
sk "sk"
rg "rg"
perl "perl"
stow "stow"
python "python"
tmsu "tmsu"
ranger "ranger"
mdcat "mdcat"
xclip "xclip"
sd "sd"
fd "fd"
sed "sed"
cut "cut"
grep "grep"
find "find"
realpath "realpath"
) )
# Iterate the string array using for loop # Iterate the string array using for loop