Skip to content

Commit 2a1e045

Browse files
committed
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 <[email protected]>
1 parent a77511b commit 2a1e045

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

podman_compose.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,7 @@ def _parse_args(self):
16061606
_ = subparsers.add_parser("help", help="show help")
16071607
for cmd_name, cmd in self.commands.items():
16081608
subparser = subparsers.add_parser(
1609-
cmd_name, help=cmd.desc
1609+
cmd_name, help=cmd.help, description=cmd.desc
16101610
) # pylint: disable=protected-access
16111611
for cmd_parser in cmd._parse_args: # pylint: disable=protected-access
16121612
cmd_parser(subparser)
@@ -1713,7 +1713,13 @@ def wrapped(*args, **kw):
17131713

17141714
wrapped._compose = self.compose
17151715
# Trim extra indentation at start of multiline docstrings.
1716-
wrapped.desc = self.cmd_desc or re.sub(r"^\s+", "", func.__doc__)
1716+
help_desc = self.cmd_desc or re.sub(r"^\s+", "", func.__doc__)
1717+
if "\n" in help_desc:
1718+
wrapped.help, wrapped.desc = help_desc.split("\n", 1)
1719+
else:
1720+
wrapped.help = help_desc
1721+
wrapped.desc = None
1722+
17171723
wrapped._parse_args = []
17181724
self.compose.commands[self.cmd_name] = wrapped
17191725
return wrapped

0 commit comments

Comments
 (0)