From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id CD10713888F for ; Fri, 9 Oct 2015 05:57:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 11572E080D; Fri, 9 Oct 2015 05:57:36 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 74F68E077F for ; Fri, 9 Oct 2015 05:57:35 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 1FBF13406F1 for ; Fri, 9 Oct 2015 05:57:32 +0000 (UTC) From: Mike Frysinger To: gentoo-catalyst@lists.gentoo.org Subject: [gentoo-catalyst] [PATCH 1/3] main: group related command line flags Date: Fri, 9 Oct 2015 01:57:26 -0400 Message-Id: <1444370248-13159-1-git-send-email-vapier@gentoo.org> X-Mailer: git-send-email 2.5.2 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-catalyst@lists.gentoo.org Reply-to: gentoo-catalyst@lists.gentoo.org X-Archives-Salt: 7ef17004-a887-47e0-b5ce-cae0c6a26fea X-Archives-Hash: 0407cf68f7df8f7d44f7753761ed49d8 This makes the --help output more manageable so people can quickly scan and skip options that they don't care about. --- catalyst/main.py | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/catalyst/main.py b/catalyst/main.py index 03c13c0..e6b6447 100644 --- a/catalyst/main.py +++ b/catalyst/main.py @@ -168,41 +168,49 @@ Using the specfile option (-f, --file) to build a stage target: $ catalyst -f stage1-specfile.spec""" parser = argparse.ArgumentParser(epilog=epilog, formatter_class=argparse.RawDescriptionHelpFormatter) - parser.add_argument('-d', '--debug', + + parser.add_argument('-V', '--version', + action='version', version=get_version(), + help='display version information') + + group = parser.add_argument_group('Program output options') + group.add_argument('-d', '--debug', default=False, action='store_true', help='enable debugging') - parser.add_argument('-v', '--verbose', + group.add_argument('-v', '--verbose', default=False, action='store_true', help='verbose output') - parser.add_argument('-c', '--config', - type=FilePath(), - help='use specified configuration file') - parser.add_argument('-f', '--file', - type=FilePath(), - help='read specfile') - parser.add_argument('-F', '--fetchonly', - default=False, action='store_true', - help='fetch files only') - parser.add_argument('-a', '--clear-autoresume', + + group = parser.add_argument_group('Temporary file management') + group.add_argument('-a', '--clear-autoresume', default=False, action='store_true', help='clear autoresume flags') - parser.add_argument('-p', '--purge', + group.add_argument('-p', '--purge', default=False, action='store_true', help='clear tmp dirs, package cache, autoresume flags') - parser.add_argument('-P', '--purgeonly', + group.add_argument('-P', '--purgeonly', default=False, action='store_true', help='clear tmp dirs, package cache, autoresume flags and exit') - parser.add_argument('-T', '--purgetmponly', + group.add_argument('-T', '--purgetmponly', default=False, action='store_true', help='clear tmp dirs and autoresume flags and exit') - parser.add_argument('-s', '--snapshot', + + group = parser.add_argument_group('Target/config file management') + group.add_argument('-F', '--fetchonly', + default=False, action='store_true', + help='fetch files only') + group.add_argument('-c', '--config', + type=FilePath(), + help='use specified configuration file') + group.add_argument('-f', '--file', + type=FilePath(), + help='read specfile') + group.add_argument('-s', '--snapshot', help='generate a release snapshot') - parser.add_argument('-V', '--version', - action='version', version=get_version(), - help='display version information') - parser.add_argument('-C', '--cli', + group.add_argument('-C', '--cli', default=[], nargs=argparse.REMAINDER, help='catalyst commandline (MUST BE LAST OPTION)') + return parser -- 2.5.2