allowed user to pass arguments to run

This commit is contained in:
Noah Swerhun 2021-12-24 11:03:10 -06:00
parent 1059f7b43d
commit 9e7cd161c6

View file

@ -49,13 +49,13 @@ Usage:
./cbuild.sh [COMMAND] ./cbuild.sh [COMMAND]
COMMAND: COMMAND:
build generate the makefile, compile objects and link target. build generate the makefile, compile objects and link target.
clean remove makefile, objects, and target. clean remove makefile, objects, and target.
buildcn clean, and then build. buildcn clean, and then build.
generate ONLY generate the makefile. generate ONLY generate the makefile.
run build, then execute TARGET. run [ARGS] build, then execute TARGET with arguments ARGS.
dryrun print all commands that will be executed during the build process dryrun print all commands that will be executed during the build process
to stdout. to stdout.
EOF EOF
} }
@ -138,7 +138,7 @@ clean() {
run() { run() {
build || exit $? build || exit $?
info "Running ./${TARGET}" info "Running ./${TARGET}"
"./${TARGET}" || "./${TARGET}" $@ ||
err "Run FAILURE ./${TARGET} returned $?" err "Run FAILURE ./${TARGET} returned $?"
} }
@ -169,7 +169,7 @@ case $1 in
clean) clean;; clean) clean;;
buildcn) clean ; build;; buildcn) clean ; build;;
generate) gen_makefile && info "Done";; generate) gen_makefile && info "Done";;
run) run;; run) shift 1 && run $@;;
dryrun) dry_run;; dryrun) dry_run;;
__progress__) __progress__ "${2}" "${3}";; __progress__) __progress__ "${2}" "${3}";;
*) usage;; *) usage;;