[pitivi] xdg-app: Better check script arguments



commit 864186c4e725b980f5170cd8b0fc3df66fcb074c
Author: Thibault Saunier <tsaunier gnome org>
Date:   Tue Feb 2 19:40:44 2016 +0100

    xdg-app: Better check script arguments
    
    Differential Revision: https://phabricator.freedesktop.org/D731

 build/xdg-app/pitivi-bundle |   27 +++++++++++++--------------
 1 files changed, 13 insertions(+), 14 deletions(-)
---
diff --git a/build/xdg-app/pitivi-bundle b/build/xdg-app/pitivi-bundle
index 075f243..20901e8 100755
--- a/build/xdg-app/pitivi-bundle
+++ b/build/xdg-app/pitivi-bundle
@@ -55,19 +55,6 @@ NC='\033[0m'
 
 cd $BUILDDIR
 
-_commandline_args=("$@")
-_document() {
-  help="$1"
-  for arg in "${_commandline_args[ ]}"; do
-    if [ "x$arg" = "x-h" -o "x$arg" = "x--help" ]; then
-      echo "$help"
-      exit
-    elif [ "x$arg" = "x--" ]; then
-      break
-    fi
-  done
-}
-
 HELP="Helper script to work with xdg-app for $APPLICATION_NAME
 
 Options:
@@ -87,11 +74,14 @@ Options:
 
 You can find more information about xdg-app at: https://wiki.gnome.org/Projects/SandboxedApps
 "
-_document $HELP
 
 for i in "$@"
 do
   case $i in
+    -h|--help)
+    echo "$HELP"
+    exit 0
+    ;;
     -d|--devel)
     DEVEL=true
     shift
@@ -177,6 +167,15 @@ if [ -z "$DEVEL" ] && [ -z "$NO_UPDATE" ]
 then
   UPDATE=true
 
+  if [ -n "$*" ]
+  then
+    echo "Unknown arguments: $*"
+    echo ""
+    echo "$HELP"
+
+    exit 1
+  fi
+
   if [ -n "$RUNTIME_INSTALLED" ]
   then
     printf "$GREEN\n==========\nUpdating $APPLICATION_NAME \n==========$NC\n\n"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]