Add a new style for %(prog)s in the usage. The style is applied in argparse-generated usage and in user defined usage whether the user usage is plain text or rich markup.
Click to see the code
```python
import argparse
from rich import get_console
from rich_argparse import RichHelpFormatter
console = get_console()
console.rule("Auto generated usage")
parser = argparse.ArgumentParser(
prog="connect",
description="Edit or show the location of the user configuration file.",
formatter_class=RichHelpFormatter,
)
parser.print_usage()
console.rule("User defined plain text usage")
parser = argparse.ArgumentParser(
prog="connect",
description="Edit or show the location of the user configuration file.",
usage="%(prog)s [-h] config_name\n %(prog)s [-h] url [user] [password]",
formatter_class=RichHelpFormatter,
)
parser.print_usage()
console.rule("User defined markup usage")
RichHelpFormatter.usage_markup = True
parser = argparse.ArgumentParser(
prog="connect",
description="Edit or show the location of the user configuration file.",
usage="[u]%(prog)s \\[-h] config_name[/]\n [i]%(prog)s \\[-h] url \\[user] \\[password][/]",
formatter_class=RichHelpFormatter,
)
parser.print_usage()
```
Closes #55
Add a new style for
%(prog)s
in the usage. The style is applied in argparse-generated usage and in user defined usage whether the user usage is plain text or rich markup.Click to see the code
```python import argparse from rich import get_console from rich_argparse import RichHelpFormatter console = get_console() console.rule("Auto generated usage") parser = argparse.ArgumentParser( prog="connect", description="Edit or show the location of the user configuration file.", formatter_class=RichHelpFormatter, ) parser.print_usage() console.rule("User defined plain text usage") parser = argparse.ArgumentParser( prog="connect", description="Edit or show the location of the user configuration file.", usage="%(prog)s [-h] config_name\n %(prog)s [-h] url [user] [password]", formatter_class=RichHelpFormatter, ) parser.print_usage() console.rule("User defined markup usage") RichHelpFormatter.usage_markup = True parser = argparse.ArgumentParser( prog="connect", description="Edit or show the location of the user configuration file.", usage="[u]%(prog)s \\[-h] config_name[/]\n [i]%(prog)s \\[-h] url \\[user] \\[password][/]", formatter_class=RichHelpFormatter, ) parser.print_usage() ```