Skip to content

Commit aae5e4c

Browse files
authored
New README preview (#114)
1 parent b727183 commit aae5e4c

File tree

2 files changed

+7
-18
lines changed

2 files changed

+7
-18
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# rich-argparse
22

33
![python -m rich_argparse](
4-
https://github.com/hamdanal/rich-argparse/assets/93259987/ae4a4968-1008-4fcd-8131-7a90292a7f3f)
4+
https://github.com/hamdanal/rich-argparse/assets/93259987/ed51127f-944c-4ac3-8c94-8033bd1edb10)
55

66
[![tests](https://github.com/hamdanal/rich-argparse/actions/workflows/tests.yml/badge.svg)
77
](https://github.com/hamdanal/rich-argparse/actions/workflows/tests.yml)

rich_argparse/__main__.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from rich_argparse import HelpPreviewAction, RichHelpFormatter
99

1010
if __name__ == "__main__":
11-
RichHelpFormatter.highlights.append(r"(?:^|\s)-{1,2}[\w]+[\w-]* (?P<metavar>METAVAR)\b")
1211
parser = argparse.ArgumentParser(
1312
prog="python -m rich_argparse",
1413
formatter_class=RichHelpFormatter,
@@ -17,23 +16,19 @@
1716
"[link https://docs.python.org/3/library/argparse.html#formatter-class]"
1817
"argparse's help output[/].\n\n"
1918
"It enables you to use the powers of rich like markup and highlights in your CLI help. "
20-
"Read below for a glance at available features."
2119
),
2220
epilog=":link: Read more at https://github.com/hamdanal/rich-argparse#usage.",
2321
)
2422
parser.add_argument(
2523
"formatter-class",
2624
help=(
27-
"All you need to make your argparse.ArgumentParser output colorful text like this is to "
28-
"pass it `formatter_class=RichHelpFormatter` or any of the available variants."
25+
"Simply pass `formatter_class=RichHelpFormatter` to the argument parser to get a "
26+
"colorful help like this."
2927
),
3028
)
3129
parser.add_argument(
3230
"styles",
33-
help=(
34-
"All the styles used by this formatter are defined in `RichHelpFormatter.styles`. "
35-
"Modify this dictionary with any rich style to change the look of your CLI's help text."
36-
),
31+
help="Customize your CLI's help with the `RichHelpFormatter.styles` dictionary.",
3732
)
3833
parser.add_argument(
3934
"--highlights",
@@ -53,16 +48,10 @@
5348
),
5449
)
5550
parser.add_argument(
56-
"-s",
57-
"--long-option",
51+
"-o",
52+
"--option",
5853
metavar="METAVAR",
59-
help=(
60-
"Words that look like --command-line-options are highlighted using the `argparse.args` "
61-
"style. In addition, this example, adds a highlighter regex for the word 'METAVAR' "
62-
"following an option for the sake of demonstrating custom highlights.\n"
63-
"Notice also that if an option takes a value and has short and long options, it is "
64-
"printed as -s, --long-option METAVAR instead of -s METAVAR, --long-option METAVAR."
65-
),
54+
help="Text that looks like an --option is highlighted using the `argparse.args` style.",
6655
)
6756
group = parser.add_argument_group(
6857
"more arguments",

0 commit comments

Comments
 (0)