aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2016-04-27 16:23:58 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-06 10:30:56 +0100
commitcf0c5175136966eefde8c0d9aa0679e85779f713 (patch)
tree44ec14b91da2eb9860b736146defac6ed89c641b
parent04eca59068a79ae6a9969be495c4cdf0c5c3e466 (diff)
downloadopenembedded-core-contrib-cf0c5175136966eefde8c0d9aa0679e85779f713.tar.gz
scripts/lib/argparse_oe: show self.prog in the error message
This aligns our subclassed error() with that in the original class, using _print_message and self.prog. Also add a docstring based on the original. Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--scripts/lib/argparse_oe.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/lib/argparse_oe.py b/scripts/lib/argparse_oe.py
index bf3ebaddfd..95b42e75ea 100644
--- a/scripts/lib/argparse_oe.py
+++ b/scripts/lib/argparse_oe.py
@@ -16,8 +16,13 @@ class ArgumentParser(argparse.ArgumentParser):
super(ArgumentParser, self).__init__(*args, **kwargs)
def error(self, message):
- sys.stderr.write('ERROR: %s\n' % message)
- self.print_help()
+ """error(message: string)
+
+ Prints a help message incorporating the message to stderr and
+ exits.
+ """
+ self._print_message('%s: error: %s\n' % (self.prog, message), sys.stderr)
+ self.print_help(sys.stderr)
sys.exit(2)
def error_subcommand(self, message, subcommand):