提交 75e652a9 编写于 作者: L Lukáš Doktor

parser: Suggest installing plugins on missing command

Many arguments are provided by plugins, let's suggest checking the
installed plugins on unrecognized argument to raise awareness of the
need to install additional plugins which might help people that see
Avocado for the first time.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 3eaa5a43
......@@ -39,6 +39,9 @@ class ArgumentParser(argparse.ArgumentParser):
def error(self, message):
LOG_UI.debug(self.format_help())
LOG_UI.error("%s: error: %s", self.prog, message)
if "unrecognized arguments" in message:
LOG_UI.warning("Perhaps a plugin is missing; run 'avocado"
" plugins' to list the installed ones")
self.exit(exit_codes.AVOCADO_FAIL)
def _get_option_tuples(self, option_string):
......
......@@ -42,6 +42,7 @@ class ArgumentParsingTest(unittest.TestCase):
subcommand_error_msg = (b'avocado run: error: unrecognized arguments: '
b'--whacky-argument')
self.assertIn(subcommand_error_msg, result.stderr)
self.assertIn(b"run 'avocado plugins'", result.stderr)
class ArgumentParsingErrorEarlyTest(unittest.TestCase):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册