From 6dfc6edfe1a5a0522b08c40f1978ea67a5c8210f Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Thu, 9 Mar 2023 15:13:22 -0500 Subject: [PATCH 1/2] Remove assignment to variable that gets overriden and never used Signed-off-by: Cleber Rosa --- podman_compose.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/podman_compose.py b/podman_compose.py index 2c1e56e..5e2ca7a 100755 --- a/podman_compose.py +++ b/podman_compose.py @@ -1668,7 +1668,7 @@ def _parse_args(self): parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter) self._init_global_parser(parser) subparsers = parser.add_subparsers(title="command", dest="command") - subparser = subparsers.add_parser("help", help="show help") + _ = subparsers.add_parser("help", help="show help") for cmd_name, cmd in self.commands.items(): subparser = subparsers.add_parser( cmd_name, help=cmd.desc From 78ab78ca62817758ea830ca76faa81c5a54074d9 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Thu, 9 Mar 2023 15:30:36 -0500 Subject: [PATCH 2/2] Fix formatting of description of systemd command When running "podman-compose", the list of commands gets displayed. The systemd command is an outlier, showing multiple lines, IMO unintended at this location. This change moves the longer command description to its proper place, that is, it gets shown when "podman-compose systemd --help" is executed. Signed-off-by: Cleber Rosa --- podman_compose.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/podman_compose.py b/podman_compose.py index 5e2ca7a..b42bc25 100755 --- a/podman_compose.py +++ b/podman_compose.py @@ -1671,7 +1671,7 @@ def _parse_args(self): _ = subparsers.add_parser("help", help="show help") for cmd_name, cmd in self.commands.items(): subparser = subparsers.add_parser( - cmd_name, help=cmd.desc + cmd_name, help=cmd.help, description=cmd.desc ) # pylint: disable=protected-access for cmd_parser in cmd._parse_args: # pylint: disable=protected-access cmd_parser(subparser) @@ -1779,7 +1779,13 @@ def wrapped(*args, **kw): wrapped._compose = self.compose # Trim extra indentation at start of multiline docstrings. - wrapped.desc = self.cmd_desc or re.sub(r"^\s+", "", func.__doc__) + help_desc = self.cmd_desc or re.sub(r"^\s+", "", func.__doc__) + if "\n" in help_desc: + wrapped.help, wrapped.desc = help_desc.split("\n", 1) + else: + wrapped.help = help_desc + wrapped.desc = None + wrapped._parse_args = [] self.compose.commands[self.cmd_name] = wrapped return wrapped