Skip to content

Commit 78ab78c

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 6dfc6ed commit 78ab78c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

podman_compose.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -1671,7 +1671,7 @@ def _parse_args(self):
16711671
_ = subparsers.add_parser("help", help="show help")
16721672
for cmd_name, cmd in self.commands.items():
16731673
subparser = subparsers.add_parser(
1674-
cmd_name, help=cmd.desc
1674+
cmd_name, help=cmd.help, description=cmd.desc
16751675
) # pylint: disable=protected-access
16761676
for cmd_parser in cmd._parse_args: # pylint: disable=protected-access
16771677
cmd_parser(subparser)
@@ -1779,7 +1779,13 @@ def wrapped(*args, **kw):
17791779

17801780
wrapped._compose = self.compose
17811781
# Trim extra indentation at start of multiline docstrings.
1782-
wrapped.desc = self.cmd_desc or re.sub(r"^\s+", "", func.__doc__)
1782+
help_desc = self.cmd_desc or re.sub(r"^\s+", "", func.__doc__)
1783+
if "\n" in help_desc:
1784+
wrapped.help, wrapped.desc = help_desc.split("\n", 1)
1785+
else:
1786+
wrapped.help = help_desc
1787+
wrapped.desc = None
1788+
17831789
wrapped._parse_args = []
17841790
self.compose.commands[self.cmd_name] = wrapped
17851791
return wrapped

0 commit comments

Comments
 (0)