[yocto] [PATCHv2 2/3] scripts/build.sh: Added help option to the cmdline

mail at timomueller.eu mail at timomueller.eu
Mon Dec 10 00:13:43 PST 2012


From: Timo Mueller <timo.mueller at bmw-carit.de>

Calling the build script with the -h option will now show the usage.
The cmdline parsing can be extended to add new options in the future.
---
 scripts/build.sh |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/scripts/build.sh b/scripts/build.sh
index cbb7375..693dcf7 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -3,12 +3,13 @@
 help ()
 {
   echo "Build the Yocto Eclipse plugins"
-  echo "Usage: $0 <branch name> <release name>";
+  echo "Usage: $0 [OPTIONS] BRANCH_NAME RELEASE_NAME [TAG_NAME]";
   echo ""
   echo "Options:"
-  echo "<branch name> - git branch name to build upon"
-  echo "<release name> - release name in the final output name"
-  echo "[tag name] - git tag name to build upon. defaults to master if not set"
+  echo "-h - display this help and exit"
+  echo "BRANCH_NAME - git branch name to build upon"
+  echo "RELEAES_NAME - release name in the final output name"
+  echo "TAG_NAME - git tag name to build upon. defaults to HEAD if not set"
   echo ""
   echo "Example: $0 master r0 M1.1_rc1";
   exit 1;
@@ -66,6 +67,15 @@ check_env ()
 }
 
 USE_LOCAL_GIT_REPO=0
+while getopts ":h" opt; do
+	case $opt in
+		h)
+			help
+			;;
+	esac
+done
+shift $(($OPTIND - 1))
+
 
 if [ $# -ne 2 ] && [ $# -ne 3 ]; then 
    help
-- 
1.7.7.6




More information about the yocto mailing list