From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-615741-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 38C931381F3 for <garchives@archives.gentoo.org>; Fri, 2 Aug 2013 22:37:05 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 390F4E0A59; Fri, 2 Aug 2013 22:37:03 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B0B53E0A59 for <gentoo-commits@lists.gentoo.org>; Fri, 2 Aug 2013 22:37:02 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8F86C33EC21 for <gentoo-commits@lists.gentoo.org>; Fri, 2 Aug 2013 22:37:01 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 0F584E468F for <gentoo-commits@lists.gentoo.org>; Fri, 2 Aug 2013 22:37:00 +0000 (UTC) From: "Zac Medico" <zmedico@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" <zmedico@gentoo.org> Message-ID: <1375482999.a5823c2118325d01566efbafa947f323f0b925b2.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/repoman X-VCS-Directories: bin/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: a5823c2118325d01566efbafa947f323f0b925b2 X-VCS-Branch: master Date: Fri, 2 Aug 2013 22:37:00 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: d42b727d-61cd-4477-ba5b-8acb29ee13fb X-Archives-Hash: 2d1990b23155bc65497e37b111c65430 commit: a5823c2118325d01566efbafa947f323f0b925b2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Fri Aug 2 22:36:39 2013 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Fri Aug 2 22:36:39 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a5823c21 repoman: simplify help output This will simplify conversion to argparse. --- bin/repoman | 47 +++-------------------------------------------- 1 file changed, 3 insertions(+), 44 deletions(-) diff --git a/bin/repoman b/bin/repoman index 5223439..7d84daa 100755 --- a/bin/repoman +++ b/bin/repoman @@ -121,33 +121,6 @@ def exithandler(signum=None, frame=None): signal.signal(signal.SIGINT, exithandler) -class RepomanHelpFormatter(optparse.IndentedHelpFormatter): - """Repoman needs its own HelpFormatter for now, because the default ones - murder the help text.""" - - def __init__(self, indent_increment=1, max_help_position=24, width=150, short_first=1): - optparse.HelpFormatter.__init__(self, indent_increment, max_help_position, width, short_first) - - def format_description(self, description): - return description - -class RepomanOptionParser(optparse.OptionParser): - """Add the on_tail function, ruby has it, optionParser should too - """ - - def __init__(self, *args, **kwargs): - optparse.OptionParser.__init__(self, *args, **kwargs) - self.tail = "" - - def on_tail(self, description): - self.tail += description - - def format_help(self, formatter=None): - result = optparse.OptionParser.format_help(self, formatter) - result += self.tail - return result - - def ParseArgs(argv, qahelp): """This function uses a customized optionParser to parse command line arguments for repoman Args: @@ -173,11 +146,9 @@ def ParseArgs(argv, qahelp): mode_keys = list(modes) mode_keys.sort() - parser = RepomanOptionParser(formatter=RepomanHelpFormatter(), usage="%prog [options] [mode]") - parser.description = green(" ".join((os.path.basename(argv[0]), "1.2"))) - parser.description += "\nCopyright 1999-2007 Gentoo Foundation" - parser.description += "\nDistributed under the terms of the GNU General Public License v2" - parser.description += "\nmodes: " + " | ".join(map(green, mode_keys)) + parser = optparse.OptionParser(usage="%prog [options] [mode]", + description="Modes: %s" % " | ".join(mode_keys), + epilog="For more help consult the man page.") parser.add_option('-a', '--ask', dest='ask', action='store_true', default=False, help='Request a confirmation before commiting') @@ -250,18 +221,6 @@ def ParseArgs(argv, qahelp): parser.add_option('--mode', type='choice', dest='mode', choices=list(modes), help='specify which mode repoman will run in (default=full)') - parser.on_tail("\n " + green("Modes".ljust(20) + " Description\n")) - - for k in mode_keys: - parser.on_tail(" %s %s\n" % (k.ljust(20), modes[k])) - - parser.on_tail("\n " + green("QA keyword".ljust(20) + " Description\n")) - - sorted_qa = list(qahelp) - sorted_qa.sort() - for k in sorted_qa: - parser.on_tail(" %s %s\n" % (k.ljust(20), qahelp[k])) - opts, args = parser.parse_args(argv[1:]) if not opts.ignore_default_opts: