Skip to content

Commit 4897a70

Browse files
authored
Fix errors when using the --help option (#1910)
1 parent 930515b commit 4897a70

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

poetry/console/config/application_config.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from clikit.api.event import PreHandleEvent
1010
from clikit.api.event import PreResolveEvent
1111
from clikit.api.event.event_dispatcher import EventDispatcher
12+
from clikit.api.exceptions import CliKitException
1213
from clikit.api.formatter import Style
1314
from clikit.api.io import Input
1415
from clikit.api.io import InputStream
@@ -101,7 +102,16 @@ def resolve_help_command(
101102
if args.has_option_token("-h") or args.has_option_token("--help"):
102103
from clikit.api.resolver import ResolvedCommand
103104

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+
105115
# If the current command is the run one, skip option
106116
# check and interpret them as part of the executed command
107117
if resolved_command.command.name == "run":

0 commit comments

Comments
 (0)