Skip to content

Commit

Permalink
Fix output for --help
Browse files Browse the repository at this point in the history
  • Loading branch information
nehaljwani committed Dec 25, 2023
1 parent 9b9920f commit e0b6289
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
45 changes: 45 additions & 0 deletions recipe/0001-Fix-output-for-help.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From 3042a419d4da57ab86189c64c2c244a00c91441c Mon Sep 17 00:00:00 2001
From: Nehal J Wani <nehaljw.kkd1@gmail.com>
Date: Mon, 25 Dec 2023 19:04:54 +0000
Subject: [PATCH] Fix output for --help

---
src/ansi2html/converter.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/ansi2html/converter.py b/src/ansi2html/converter.py
index 5e13814..68d3ded 100644
--- a/src/ansi2html/converter.py
+++ b/src/ansi2html/converter.py
@@ -25,6 +25,7 @@ import io
import re
import sys
from collections import OrderedDict
+from argparse import RawTextHelpFormatter
from typing import Iterator, List, Optional, Set, Tuple, Union

from ansi2html.style import (
@@ -663,7 +664,8 @@ def main() -> None:

scheme_names = sorted(SCHEME.keys())
version_str = version("ansi2html")
- parser = argparse.ArgumentParser(usage=main.__doc__)
+ parser = argparse.ArgumentParser(usage=main.__doc__,
+ formatter_class=RawTextHelpFormatter)
parser.add_argument(
"-V", "--version", action="version", version=f"%(prog)s {version_str}"
)
@@ -769,8 +771,8 @@ def main() -> None:
default="ansi2html",
choices=scheme_names,
help=(
- "Specify color palette scheme. Default: %%default. Choices: %s"
- % scheme_names
+ "Specify color palette scheme. Default: %(default)s.\n" +
+ "Choices: %s" % scheme_names
),
)
parser.add_argument(
--
2.33.1

2 changes: 2 additions & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ package:
source:
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
sha256: 5c6837a13ecc1903aab7a545353312049dfedfe5105362ad3a8d9d207871ec71
patches:
- 0001-Fix-output-for-help.patch

build:
number: 0
Expand Down

0 comments on commit e0b6289

Please sign in to comment.