fixed myprint and added --version

This commit is contained in:
2024-07-12 02:09:10 +03:00
parent 9b1bbffbc4
commit 0ebc1c47ee
3 changed files with 12 additions and 4 deletions

View File

@@ -14,7 +14,7 @@ fi
function include {
local script_path="$1"
if [[ "$script_path" == cbuild/* ]]; then
script_path="$CBUILD_INSTALL_DIR/$(safeprint $script_path | sed 's,^cbuild/,,')"
script_path="$CBUILD_INSTALL_DIR/$(echo $script_path | sed 's,^cbuild/,,')"
fi
# echp "including script $script_path"
. "$script_path"
@@ -31,8 +31,11 @@ include "cbuild/functions.sh"
include "cbuild/config.sh"
function print_help_and_exit {
myprint "cbuild v$INSTALLED_CBUILD_VERSION"
myprint "C/C++ project build system written in bash."
myprint "Usage: cbuild [OPTIONS] [TASK]"
myprint " -h, --help Show this message"
myprint " -v, --version Shows version"
myprint " -n, --new-project [PROJ_DIR] Initialize new cbuild project directory (default=./)"
myprint " -c, --current-config FILE Set current config file path (default=./current.config)"
myprint " -d, --default-config FILE Set default config file path (default=./current.config)"
@@ -60,6 +63,10 @@ do
'-h' | '--help')
print_help_and_exit
;;
'-v' | '--version')
myprint $INSTALLED_CBUILD_VERSION
exit 0
;;
'-c' | '--current-config')
i=$((i+1))
current_config_path="${args[i]}"