Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix formatting of description of systemd command #643

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions podman_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -1668,10 +1668,10 @@ 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
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 @@ -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
Expand Down