Skip to content

Commit

Permalink
Add help message to generate_reference.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanLovato committed Feb 4, 2020
1 parent f45e996 commit e6d678d
Showing 1 changed file with 34 additions and 5 deletions.
39 changes: 34 additions & 5 deletions generate_reference.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,54 @@
project_directory=$1
output_directory=$2

echo_help() {
echo "
Generate a code reference from GDScript
Usage:
generate_reference.sh $project_directory (optional)$output_directory
Arguments:
$project_directory -- path to your Godot project directory.
This directory or one of its subdirectories should contain a
project.godot file.
$output_directory -- directory path to output the documentation into.
Flags:
-h/--help -- Display this help message.
"
exit 0
}

if [ $1 = "-h" ]
then echo_help
fi
if [ $1 = "--help" ]
then echo_help
fi
if [ $1 = "help" ]
then echo_help
fi

# Testing input parameters
if [ -z $project_directory ]
then echo Missing first parameter: project_directory
exit 1
fi
if [ -z $output_directory ]
then echo Missing second parameter: output_directory
exit 1
fi
if ! test -d $project_directory
then echo Directory $project_directory does not exist, exiting.
exit 1
fi

godot_project_file=`find $project_directory -iname project.godot -print -quit`
if ! test -f $godot_project_file
then echo "Could not find a project.godot file in $target_directory. This program needs a Godot project to work."
exit 1
fi
if [ -z $output_directory ]
then output_directory="dist"
fi

# Generate reference JSON data from Godot
godot_project_dir=`dirname $godot_project_file`
Expand Down

0 comments on commit e6d678d

Please sign in to comment.