Skip to content

Commit 1c0c63a

Browse files
clebergnumokibit
authored andcommitted
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, 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 Signed-off-by: Monika Kairaityte <monika@kibit.lt>
1 parent 2f8dbdc commit 1c0c63a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

podman_compose.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2469,7 +2469,7 @@ def _parse_args(self, argv: list[str] | None = None) -> argparse.Namespace:
24692469
subparsers = parser.add_subparsers(title="command", dest="command")
24702470
_ = subparsers.add_parser("help", help="show help")
24712471
for cmd_name, cmd in self.commands.items():
2472-
subparser = subparsers.add_parser(cmd_name, help=cmd.desc) # pylint: disable=protected-access
2472+
subparser = subparsers.add_parser(cmd_name, help=cmd.help, description=cmd.desc) # pylint: disable=protected-access
24732473
for cmd_parser in cmd._parse_args: # pylint: disable=protected-access
24742474
cmd_parser(subparser)
24752475
self.global_args = parser.parse_args(argv)
@@ -2604,7 +2604,12 @@ def wrapped(*args: Any, **kw: Any) -> Any:
26042604
raise PodmanComposeError("Command must be async")
26052605
wrapped._compose = self.compose # type: ignore[attr-defined]
26062606
# Trim extra indentation at start of multiline docstrings.
2607-
wrapped.desc = self.cmd_desc or re.sub(r"^\s+", "", func.__doc__ or "") # type: ignore[attr-defined]
2607+
help_desc = self.cmd_desc or re.sub(r"^\s+", "", func.__doc__ or "") # type: ignore[attr-defined]
2608+
if "\n" in help_desc:
2609+
wrapped.help, wrapped.desc = help_desc.split("\n", 1) # type: ignore[attr-defined]
2610+
else:
2611+
wrapped.help = help_desc # type: ignore[attr-defined]
2612+
wrapped.desc = None # type: ignore[attr-defined]
26082613
wrapped._parse_args = [] # type: ignore[attr-defined]
26092614
self.compose.commands[self.cmd_name] = wrapped
26102615
return wrapped

0 commit comments

Comments
 (0)