From 4d5bf40affee84d54d0f891dd721d6729a917748 Mon Sep 17 00:00:00 2001 From: "sigonasr2, Sig, Sigo" Date: Tue, 17 May 2022 14:27:26 +0000 Subject: [PATCH] Custom dynamic variable generation script --- README.md | 16 ++++++++-------- scripts/commit.sh | 6 ++++++ sig | 17 +++++++++-------- utils/define.sh | 7 +++++++ 4 files changed, 30 insertions(+), 16 deletions(-) create mode 100755 scripts/commit.sh create mode 100755 utils/define.sh diff --git a/README.md b/README.md index 4250f28..0a3a1b9 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,14 @@ This repository contains general build scripts and pipelines for all languages t ```bash #Short description about what I do #Language[Folder] - /* The script's code goes in here. - rm -Rf out/* - javac -Xlint:unchecked -cp ${PROJECT_DIR}/.. -d ${OUT_DIR} ${PROJECT_DIR}/*.java - printf "\n\n\nRunning Program...\n\n" - cd $OUT_DIR - java ${MAIN_CLASS} "$@" - ../scripts/clean.sh - */ + # #The script's code goes in here. + # rm -Rf out/* + # javac -Xlint:unchecked -cp ${PROJECT_DIR}/.. -d ${OUT_DIR} ${PROJECT_DIR}/*.java + # printf "\n\n\nRunning Program...\n\n" + # cd $OUT_DIR + # java ${MAIN_CLASS} "$@" + # ../scripts/clean.sh + ``` Each language will be in the following structure: ``` diff --git a/scripts/commit.sh b/scripts/commit.sh new file mode 100755 index 0000000..2597e7d --- /dev/null +++ b/scripts/commit.sh @@ -0,0 +1,6 @@ +#Adds a commit message and pushes project to github repository. +# +git add -u +git add * +git commit -m "$*" +git push \ No newline at end of file diff --git a/sig b/sig index 6f3e062..b4699ed 100755 --- a/sig +++ b/sig @@ -1,8 +1,9 @@ -export PROJECT_NAME="JavaProjectTemplate" -export PROJECT_DIR="src/sig" -export MAIN_CLASS="sig.${PROJECT_NAME}" -export OUT_DIR="bin" +source utils/define.sh +define PROJECT_NAME "JavaProjectTemplate" +define PROJECT_DIR "src/sig" +define MAIN_CLASS "sig.${PROJECT_NAME}" +define OUT_DIR "bin" if [ -z "$1" ] then @@ -11,10 +12,10 @@ if [ -z "$1" ] echo "" printf "====\tCurrent Configuration" printf "\t=====================" - printf "\n\t%-15s%20s" PROJECT_NAME ${PROJECT_NAME} - printf "\n\t%-15s%20s" PROJECT_DIR ${PROJECT_DIR} - printf "\n\t%-15s%20s" MAIN_CLASS ${MAIN_CLASS} - printf "\n\t%-15s%20s" OUT_DIR ${OUT_DIR} + for t in ${VARS[@]} + do + printf "\n\t%-15s%20s" $t ${!t} + done printf "\n=====================================================" echo "" echo "" diff --git a/utils/define.sh b/utils/define.sh new file mode 100755 index 0000000..9f95bd9 --- /dev/null +++ b/utils/define.sh @@ -0,0 +1,7 @@ +export VARS=("") + +function define() { + VARS+=("$1") + value="${*:2}" + eval "$1"='$value' +} \ No newline at end of file