From cbb6f3d8a3c8909c97fe40002e2824c975d66418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Sat, 29 Oct 2022 14:03:47 +0200 Subject: [PATCH] Add new and clean commands. --- isidore.sh | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/isidore.sh b/isidore.sh index 9882f42..249cd7e 100755 --- a/isidore.sh +++ b/isidore.sh @@ -70,8 +70,13 @@ function set_config_vars() source $ISIDORE_CONFIG_DIR/config } +function print_usage() +{ + echo "USAGE: $1 [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 "" >> $NEW_PROJECT_DIR/config.php + echo \ +"" >> $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