Add new and clean commands.

This commit is contained in:
Nicolás A. Ortega Froysa 2022-10-29 14:03:47 +02:00
parent 17e14672ff
commit cbb6f3d8a3

View File

@ -70,8 +70,13 @@ function set_config_vars()
source $ISIDORE_CONFIG_DIR/config
}
function print_usage()
{
echo "USAGE: $1 <command> [options]"
}
##
# Create a new project
# Create a new project.
#
# Params:
# $1 - The project directory
@ -84,10 +89,31 @@ function new_project()
mkdir $NEW_PROJECT_DIR
mkdir -p $NEW_PROJECT_DIR/site/
mkdir -p $NEW_PROJECT_DIR/templates/
echo "<?php
echo \
"<?php
\$site_name = \"$NEW_PROJECT_NAME\";
\$author = \"$ISIDORE_AUTHOR_NAME\";
?>" >> $NEW_PROJECT_DIR/config.php
}
##
# Clean a project's build.
##
function clean_project()
{
# TODO: Ensure that this is within an Isidore project.
rm -r output/
echo "Project cleaned."
}
set_config_vars
case $1 in
new)
new_project $2 $3;;
clean)
clean_project;;
*)
echo "Unknown command $1. Use the 'help' command."
print_usage $0;;
esac