From 68e2ed8701c4c1e858072ec54623fa4e51460d43 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Tue, 23 Oct 2012 18:19:01 +0200
Subject: [PATCH] Improve devel/upload command line handling

To people not used to it, it was completely non-obvious why
"./devel/upload" didn't do anything.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 devel/upload.in | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/devel/upload.in b/devel/upload.in
index 9b2977475..c58313400 100644
--- a/devel/upload.in
+++ b/devel/upload.in
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-# Copyright (C) 2006, 2007, 2008, 2009, 2010 Google Inc.
+# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2012 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -27,6 +27,11 @@
 
 set -e
 
+usage() {
+  echo "Usage: $0 [--no-restart] [--no-cron] [--no-debug] hosts..." >&2
+  exit $1
+}
+
 PREFIX='@PREFIX@'
 SYSCONFDIR='@SYSCONFDIR@'
 PKGLIBDIR='@PKGLIBDIR@'
@@ -48,12 +53,11 @@ while [ "$#" -gt 0 ]; do
       NO_DEBUG=1
       ;;
     -h|--help)
-      echo "Usage: $0 [--no-restart] hosts..."
-      exit 0
+      usage 0
       ;;
     -*)
       echo "Unknown option: $opt" >&2
-      exit 1
+      usage 1
       ;;
     *)
       hosts="$hosts $opt"
@@ -62,6 +66,10 @@ while [ "$#" -gt 0 ]; do
   shift
 done
 
+if [ -z "$hosts" ]; then
+  usage 1
+fi
+
 set ${hosts}
 
 make regen-vcs-version
-- 
GitLab