summaryrefslogtreecommitdiffstats
path: root/scripts
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:31:13 +0100
commit55c760bda391f8ac398aa078391a78415dd68a82 (patch)
treeb886d45cf3b7c4112c27869fd173b9cb284cd00a /scripts
parent7669219652bcc10fe957114952861d450f825274 (diff)
downloadpoky-55c760bda391f8ac398aa078391a78415dd68a82.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. (From OE-Core rev: cf0c5175136966eefde8c0d9aa0679e85779f713) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-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):
16 super(ArgumentParser, self).__init__(*args, **kwargs) 16 super(ArgumentParser, self).__init__(*args, **kwargs)
17 17
18 def error(self, message): 18 def error(self, message):
19 sys.stderr.write('ERROR: %s\n' % message) 19 """error(message: string)
20 self.print_help() 20
21 Prints a help message incorporating the message to stderr and
22 exits.
23 """
24 self._print_message('%s: error: %s\n' % (self.prog, message), sys.stderr)
25 self.print_help(sys.stderr)
21 sys.exit(2) 26 sys.exit(2)
22 27
23 def error_subcommand(self, message, subcommand): 28 def error_subcommand(self, message, subcommand):