diff --git a/isidore.sh b/isidore.sh
index b15800a..950e349 100755
--- a/isidore.sh
+++ b/isidore.sh
@@ -86,8 +86,8 @@ function print_help()
{
print_usage
echo -e "\nCOMMANDS:
- new
- Create a new Isidore project
+ new [-i]
+ Create a new Isidore project (use interactive mode with '-i')
build
Build the project rooted in the current directory
clean
@@ -115,14 +115,22 @@ function check_in_project()
#
# Params:
# $1 - The project directory
-# $2 - The project name
+# $2 - Interactive mode (1 = true; 0 = false)
##
function new_project()
{
echo "$PROJECT_NAME v$ISIDORE_VERSION"
NEW_PROJECT_DIR=$1
- NEW_PROJECT_NAME=$2
+ NEW_PROJECT_NAME="New Project"
+ NEW_PROJECT_URL="http://example.com/"
+ if [ $2 == 1 ]
+ then
+ echo -n "Project name: "
+ read NEW_PROJECT_NAME
+ echo -n "URL: "
+ read NEW_PROJECT_URL
+ fi
mkdir $NEW_PROJECT_DIR
mkdir -p $NEW_PROJECT_DIR/site/
mkdir -p $NEW_PROJECT_DIR/templates/
@@ -130,12 +138,13 @@ function new_project()
"" >> $NEW_PROJECT_DIR/config.php
echo "$ISIDORE_VERSION" > $NEW_PROJECT_DIR/.isidore-version
echo "New project created."
- echo "Consider taking a look at the $NEW_PROJECT_DIR/config.php file."
+ [ $2 == 0 ] &&
+ echo "Consider taking a look at the $NEW_PROJECT_DIR/config.php file."
}
##
@@ -183,7 +192,31 @@ set_config_vars
case $1 in
new)
- new_project $2 $3;;
+ if [ $# -lt 2 ]
+ then
+ echo "Insufficient number of arguments."
+ print_usage
+ exit 1
+ fi
+ INTERACTIVE=0
+ NEW_DIR=""
+ for i in ${@:2}
+ do
+ case $i in
+ -i)
+ INTERACTIVE=1;;
+ *)
+ if [ -z "$NEW_DIR" ]
+ then
+ NEW_DIR="$i"
+ else
+ echo "Unknown argument for new '$i'. Use the 'help' command."
+ print_usage
+ exit 1
+ fi
+ esac
+ done
+ new_project $NEW_DIR $INTERACTIVE;;
build)
build_project;;
clean)
@@ -194,5 +227,6 @@ case $1 in
echo "$PROJECT_NAME v$ISIDORE_VERSION";;
*)
echo "Unknown command $1. Use the 'help' command."
- print_usage;;
+ print_usage
+ exit 1;;
esac