[LNT] r308991 - lnttool: Give nicer error message for unknown subcommands
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 25 10:21:43 PDT 2017
Author: matze
Date: Tue Jul 25 10:21:43 2017
New Revision: 308991
URL: http://llvm.org/viewvc/llvm-project?rev=308991&view=rev
Log:
lnttool: Give nicer error message for unknown subcommands
Modified:
lnt/trunk/lnt/lnttool/admin.py
lnt/trunk/lnt/lnttool/main.py
Modified: lnt/trunk/lnt/lnttool/admin.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/lnttool/admin.py?rev=308991&r1=308990&r2=308991&view=diff
==============================================================================
--- lnt/trunk/lnt/lnttool/admin.py (original)
+++ lnt/trunk/lnt/lnttool/admin.py Tue Jul 25 10:21:43 2017
@@ -354,7 +354,7 @@ class AdminCLI(click.MultiCommand):
for command in self._commands:
if command.name == name:
return command
- raise ValueError("Request unknown command '%s'" % name)
+ return None
@click.group("admin", cls=AdminCLI, no_args_is_help=True)
Modified: lnt/trunk/lnt/lnttool/main.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/lnttool/main.py?rev=308991&r1=308990&r2=308991&view=diff
==============================================================================
--- lnt/trunk/lnt/lnttool/main.py (original)
+++ lnt/trunk/lnt/lnttool/main.py Tue Jul 25 10:21:43 2017
@@ -116,7 +116,10 @@ class RunTestCLI(click.MultiCommand):
def get_command(self, ctx, name):
import lnt.tests
- return lnt.tests.get_module(name).cli_action
+ try:
+ return lnt.tests.get_module(name).cli_action
+ except KeyError:
+ return None
@click.group("runtest", cls=RunTestCLI, context_settings=dict(
More information about the llvm-commits
mailing list