|
9 | 9 | from clikit.api.event import PreHandleEvent
|
10 | 10 | from clikit.api.event import PreResolveEvent
|
11 | 11 | from clikit.api.event.event_dispatcher import EventDispatcher
|
| 12 | +from clikit.api.exceptions import CliKitException |
12 | 13 | from clikit.api.formatter import Style
|
13 | 14 | from clikit.api.io import Input
|
14 | 15 | from clikit.api.io import InputStream
|
@@ -101,7 +102,16 @@ def resolve_help_command(
|
101 | 102 | if args.has_option_token("-h") or args.has_option_token("--help"):
|
102 | 103 | from clikit.api.resolver import ResolvedCommand
|
103 | 104 |
|
104 |
| - resolved_command = self.command_resolver.resolve(args, application) |
| 105 | + try: |
| 106 | + resolved_command = self.command_resolver.resolve(args, application) |
| 107 | + except CliKitException: |
| 108 | + # We weren't able to resolve the command, |
| 109 | + # due to a parse error most likely, |
| 110 | + # so we fall back on the default behavior |
| 111 | + return super(ApplicationConfig, self).resolve_help_command( |
| 112 | + event, event_name, dispatcher |
| 113 | + ) |
| 114 | + |
105 | 115 | # If the current command is the run one, skip option
|
106 | 116 | # check and interpret them as part of the executed command
|
107 | 117 | if resolved_command.command.name == "run":
|
|
0 commit comments