From ed96c35dc1f817835d45a209ec489ea0149229a5 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Sun, 6 May 2012 05:24:14 +0200 Subject: [PATCH] grep-merges: Use optparse to display --help --- debian/changelog | 4 ++-- grep-merges | 14 +++++++++++--- ubuntutools/test/test_help.py | 1 - 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index 69ed718..541e904 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,8 @@ ubuntu-dev-tools (0.142) UNRELEASED; urgency=low * mk-sbuild: Support kmod, when checking for overlayfs availability. * pbuilder-dist: improve bash_completion for *.dsc files. Thanks Maarten Bezemer. (Closes: #670924, LP: #770529) - * submittodebian, check-mir, check-symbols, ubuntu-iso: Do enough argument - parsing to handle --help (LP: #988009) + * check-mir, check-symbols, grep-merges, submittodebian, ubuntu-iso: Do + enough argument parsing to handle --help (LP: #988009) -- Stefano Rivera Wed, 25 Apr 2012 17:38:58 +0200 diff --git a/grep-merges b/grep-merges index 20023a0..d9cfb3a 100755 --- a/grep-merges +++ b/grep-merges @@ -19,6 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import optparse import sys import json @@ -28,12 +29,19 @@ import ubuntutools.misc def main(): - ubuntutools.misc.require_utf8() - if len(sys.argv) > 1: - match = sys.argv[1] + parser = optparse.OptionParser(usage='%prog [options] [string]', + description='List pending merges from Debian matching string') + args = parser.parse_args()[1] + + if len(args) > 1: + parser.error('Too many arguments') + elif len(args) == 1: + match = args[0] else: match = None + ubuntutools.misc.require_utf8() + for component in ('main', 'main-manual', 'restricted', 'restricted-manual', 'universe', 'universe-manual', diff --git a/ubuntutools/test/test_help.py b/ubuntutools/test/test_help.py index 3e8f2ee..3c0930d 100644 --- a/ubuntutools/test/test_help.py +++ b/ubuntutools/test/test_help.py @@ -25,7 +25,6 @@ from ubuntutools import subprocess from ubuntutools.test import unittest BLACKLIST = { - 'grep-merges': 'No Help', 'pbuilder-dist-simple': 'No Help', 'setup-packaging-environment': 'Throws Error', }