Hi, is there a reason why the following won't work?
$ cat make.sh
#!/usr/bin/env bash
read -r -d '' __usage <<-'EOF' || true
-p --print_deps Print dependencies
-c --clean Clean project
-b --build Build project
-t --test Run tests
-v Enable verbose mode, print script as it is executed
-d --debug Enables debug mode
-h --help This page
-n --no-color Disable color output
EOF
read -r -d '' __helptext <<-'EOF' || true # exits non-zero when EOF encountered
This is a script to support the build of Healthbot Projects, it is intended to be used by all projects
and provide required boilerplate functions
EOF
source main.sh
# print_deps mode
if [[ "${arg_p:?}" == "1" ]]; then
info "Print dependencies"
fi
# clean mode
if [[ "${arg_c:?}" == "1" ]]; then
info "Clean project"
fi
# build mode
if [[ "${arg_b:?}" == "1" ]]; then
info "Build project"
fi
# test mode
if [[ "${arg_t:?}" == "1" ]]; then
info "Running Tests"
fi
I've left main.sh as is, other than commenting out the Validation and Runtime sections at the bottom of the file.
./make.sh -p
2019-09-05 21:32:42 UTC [ info] Print dependencies
But the following results in no output.
I was expecting that the help mode below in main.sh would work
# help mode
if [[ "${arg_h:?}" == "1" ]]; then
# Help exists with code 1
help "Help using ${0}"
fi
The rationale for this approach, rather than updating main.sh, is that I can pull the latest main.sh (with fixes / new features) and use with minimal changes.
Any help, much appreciated.
Hi, is there a reason why the following won't work?
I've left main.sh as is, other than commenting out the Validation and Runtime sections at the bottom of the file.
But the following results in no output.
I was expecting that the help mode below in main.sh would work
The rationale for this approach, rather than updating main.sh, is that I can pull the latest main.sh (with fixes / new features) and use with minimal changes.
Any help, much appreciated.