Skip to content

Commit 59420ee

Browse files
committed
Use RawTextHelpFormatter when generating argparse help message
By default, argparse seems to ignore newlines in the epilog string used when generating help message, resulting in a messy help message. RawTextHelpFormatter ensures the message (specifically, the epilog part) is formatted properly. This going to be needed when argparse is utilized by `/packit help` command in the future.
1 parent 5836e60 commit 59420ee

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packit_service/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import argparse
55
import logging
66
import os
7+
from argparse import RawTextHelpFormatter
78
from datetime import datetime, timezone
89
from io import StringIO
910
from logging import StreamHandler
@@ -223,6 +224,7 @@ def get_pr_comment_parser(prog: str, description: str, epilog: str) -> argparse.
223224
prog=prog,
224225
description=description,
225226
epilog=epilog,
227+
formatter_class=RawTextHelpFormatter,
226228
)
227229
parser.add_argument("--package", help="Specific package from monorepo to apply job to")
228230

@@ -285,6 +287,7 @@ def get_pr_comment_parser_fedora_ci(
285287
prog=prog,
286288
description=description,
287289
epilog=epilog,
290+
formatter_class=RawTextHelpFormatter,
288291
)
289292
parser.add_argument("--package", help="Specific package from monorepo to apply job to")
290293

0 commit comments

Comments
 (0)