Skip to content

Commit

Permalink
Fix errors when using the --help option (#1910)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdispater authored Jan 31, 2020
1 parent 930515b commit 4897a70
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion poetry/console/config/application_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from clikit.api.event import PreHandleEvent
from clikit.api.event import PreResolveEvent
from clikit.api.event.event_dispatcher import EventDispatcher
from clikit.api.exceptions import CliKitException
from clikit.api.formatter import Style
from clikit.api.io import Input
from clikit.api.io import InputStream
Expand Down Expand Up @@ -101,7 +102,16 @@ def resolve_help_command(
if args.has_option_token("-h") or args.has_option_token("--help"):
from clikit.api.resolver import ResolvedCommand

resolved_command = self.command_resolver.resolve(args, application)
try:
resolved_command = self.command_resolver.resolve(args, application)
except CliKitException:
# We weren't able to resolve the command,
# due to a parse error most likely,
# so we fall back on the default behavior
return super(ApplicationConfig, self).resolve_help_command(
event, event_name, dispatcher
)

# If the current command is the run one, skip option
# check and interpret them as part of the executed command
if resolved_command.command.name == "run":
Expand Down

0 comments on commit 4897a70

Please sign in to comment.