Skip to content

Commit

Permalink
Fix formatting of description of systemd command
Browse files Browse the repository at this point in the history
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 <crosa@redhat.com>
  • Loading branch information
clebergnu committed Mar 9, 2023
1 parent a77511b commit 2a1e045
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions podman_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -1606,7 +1606,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)
Expand Down Expand Up @@ -1713,7 +1713,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
Expand Down

0 comments on commit 2a1e045

Please sign in to comment.