From: Zac Medico Date: Fri, 2 Aug 2013 18:05:51 +0000 (-0700) Subject: xattr-helper.py: portage.util._argparse X-Git-Tag: v2.2.0_alpha192~19 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3b5023b646455cce1d7ba43c0dd065fb0b99717c;p=portage.git xattr-helper.py: portage.util._argparse --- diff --git a/bin/xattr-helper.py b/bin/xattr-helper.py index e63f2cbbd..a85309f4d 100755 --- a/bin/xattr-helper.py +++ b/bin/xattr-helper.py @@ -1,13 +1,14 @@ #!/usr/bin/python -# Copyright 2012 Gentoo Foundation +# Copyright 2012-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import array -import optparse import os import re import sys +from portage.util._argparse import ArgumentParser + if hasattr(os, "getxattr"): class xattr(object): @@ -128,21 +129,20 @@ def main(argv): usage = "usage: %s [--dump | --restore]\n" % \ os.path.basename(argv[0]) - parser = optparse.OptionParser(description=description, usage=usage) + parser = ArgumentParser(description=description, usage=usage) - actions = optparse.OptionGroup(parser, 'Actions') - actions.add_option("--dump", + actions = parser.add_argument_group('Actions') + actions.add_argument("--dump", action="store_true", help="Dump the values of all extended " "attributes associated with null-separated" " paths read from stdin.") - actions.add_option("--restore", + actions.add_argument("--restore", action="store_true", help="Restore extended attributes using" " a dump read from stdin.") - parser.add_option_group(actions) - options, args = parser.parse_args(argv[1:]) + options, args = parser.parse_known_args(argv[1:]) if len(args) != 0: parser.error("expected zero arguments, "