[oe-commits] [openembedded-core] 21/31: scripts/lib/argparse_oe: show self.prog in the error message
git at git.openembedded.org
git at git.openembedded.org
Fri Apr 29 08:24:28 UTC 2016
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit 9fbf377badfc0f429e642e755a0d1016e29c3017
Author: Christopher Larson <chris_larson at mentor.com>
AuthorDate: Wed Apr 27 16:23:58 2016 -0700
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 at mentor.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
scripts/lib/argparse_oe.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/scripts/lib/argparse_oe.py b/scripts/lib/argparse_oe.py
index bf3ebad..95b42e7 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):
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list