automake-patches
[Top][All Lists]
Advanced

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

[PATCH 5/6] py-compile: complain on unrecognized options


From: Stefano Lattarini
Subject: [PATCH 5/6] py-compile: complain on unrecognized options
Date: Thu, 9 Jun 2011 16:15:26 +0200

* lib/py-compile: Complain on unrecognized options.  Don't be too
lax in matching `--help' and `--version' options.
* tests/py-compile-usage.test: Extend accordingly.
* NEWS: Update.
---
 ChangeLog                   |    8 ++++++++
 NEWS                        |    2 +-
 lib/py-compile              |    7 +++++--
 tests/py-compile-usage.test |    8 ++++++++
 4 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 070ac06..a530cb8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-06-08  Stefano Lattarini  <address@hidden>
 
+       py-compile: complain on unrecognized options
+       * lib/py-compile: Complain on unrecognized options.  Don't be too
+       lax in matching `--help' and `--version' options.
+       * tests/py-compile-usage.test: Extend accordingly.
+       * NEWS: Update.
+
+2011-06-08  Stefano Lattarini  <address@hidden>
+
        py-compile: normalize error and help messages
        * lib/py-compile: Now error messages do not begin with a capital
        letter, nor end with a period, as per GNU standards.  Prepend the
diff --git a/NEWS b/NEWS
index 5ebae6e..745c6c7 100644
--- a/NEWS
+++ b/NEWS
@@ -6,7 +6,7 @@ New in 1.11.0a:
     is obsoleted by `xz' and `dist-xz' due to upstream changes.
 
   - The py-compile script now accepts empty arguments passed to the options
-    `--destdir' and `--basedir'.
+    `--destdir' and `--basedir', and complains about unrecognized options.
 
 Bugs fixed in 1.11.0a:
 
diff --git a/lib/py-compile b/lib/py-compile
index 140536b..7aa2425 100755
--- a/lib/py-compile
+++ b/lib/py-compile
@@ -62,7 +62,7 @@ while test $# -ne 0; do
       fi
       shift
       ;;
-    -h|--h*)
+    -h|--help)
       cat <<\EOF
 Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] 
FILES..."
 
@@ -78,10 +78,13 @@ Report bugs to <address@hidden>.
 EOF
       exit $?
       ;;
-    -v|--v*)
+    -v|--version)
       echo "$me $scriptversion"
       exit $?
       ;;
+    -*)
+      usage_error "unrecognized option '$1'"
+      ;;
     *)
       files="$files $1"
       ;;
diff --git a/tests/py-compile-usage.test b/tests/py-compile-usage.test
index 6a0f2f2..7e8c786 100755
--- a/tests/py-compile-usage.test
+++ b/tests/py-compile-usage.test
@@ -46,6 +46,14 @@ hour='([01][0-9]|2[0123])'
 LC_ALL=C $EGREP "^py-compile $year-$month-$day\.$hour" stdout
 test `wc -l <stdout` -eq 1
 
+# Unknown option.
+for opt in -b -d --foo; do
+  ./py-compile $opt 2>stderr && { cat stderr >&2; Exit 1; }
+  cat stderr >&2
+  grep "^py-compile: unrecognized option ['\`]$opt'" stderr
+  grep "^Try [\`']py-compile --help' for more information" stderr
+done
+
 # Missing option argument.
 
 for opt in --basedir --destdir; do
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]