1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-09 05:29:32 +00:00

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>
This commit is contained in:
Christopher Larson
2016-04-27 16:23:58 -07:00
committed by Richard Purdie
parent 7669219652
commit 55c760bda3
+7 -2
View File
@@ -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):