Add help command.

This commit is contained in:
Nicolás A. Ortega Froysa 2022-10-29 14:23:42 +02:00
parent 253ae30746
commit 44d7def8d4

View File

@ -23,6 +23,8 @@ ISIDORE_CONFIG_DIR_OPTIONS=(
"$HOME/.isidore") "$HOME/.isidore")
ISIDORE_AUTHOR_NAME="" ISIDORE_AUTHOR_NAME=""
PROG_NAME=$0
## ##
# Create the configuration file. This function is called if it does not already # Create the configuration file. This function is called if it does not already
# exist. # exist.
@ -76,7 +78,23 @@ function set_config_vars()
## ##
function print_usage() function print_usage()
{ {
echo "USAGE: $1 <command> [options]" echo "USAGE: $PROG_NAME <command> [options]"
}
function print_help()
{
print_usage
echo -e "\nCOMMANDS:
new <dir> <name>
Create a new Isidore project
build
Build the project rooted in the current directory
clean
Clean the built files
version
Print the current version
help
Show this help information"
} }
## ##
@ -133,7 +151,9 @@ case $1 in
new_project $2 $3;; new_project $2 $3;;
clean) clean)
clean_project;; clean_project;;
help)
print_help;;
*) *)
echo "Unknown command $1. Use the 'help' command." echo "Unknown command $1. Use the 'help' command."
print_usage $0;; print_usage;;
esac esac