From 602c48bc0656741f98858689dd5db0bbc87fd7eb Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Tue, 13 Apr 2021 15:27:19 +0200 Subject: [PATCH] Bugfixes for help command handling --- src/cpl_cli/cli.py | 5 +++-- src/cpl_cli/command/help_service.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cpl_cli/cli.py b/src/cpl_cli/cli.py index 5ecb010f..a4e029f7 100644 --- a/src/cpl_cli/cli.py +++ b/src/cpl_cli/cli.py @@ -89,8 +89,9 @@ class CLI(ApplicationABC): if is_option: args.append(cmd.name) - for arg in result_args: - args.append(arg) + if result_args is not None: + for arg in result_args: + args.append(arg) elif result is not None: command = cmd.name diff --git a/src/cpl_cli/command/help_service.py b/src/cpl_cli/command/help_service.py index 566b0260..50e98921 100644 --- a/src/cpl_cli/command/help_service.py +++ b/src/cpl_cli/command/help_service.py @@ -39,11 +39,12 @@ class HelpService(CommandABC): command_name = args[0] command: Optional[CommandABC] = None for cmd in self._commands: - if cmd.name == command_name: + if cmd.name == command_name or command_name in cmd.aliases: command = self._services.get_service(cmd.command) if command is None: Console.error(f'Invalid argument: {command_name}') + return Console.write_line(command.help_message)