Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using %(default)s inside square brackets crashes with ValueError #152

Closed
hamdanal opened this issue Feb 1, 2025 · 0 comments · Fixed by #153
Closed

Using %(default)s inside square brackets crashes with ValueError #152

hamdanal opened this issue Feb 1, 2025 · 0 comments · Fixed by #153
Labels
argparse Concerns argparse bug Something isn't working

Comments

@hamdanal
Copy link
Owner

hamdanal commented Feb 1, 2025

This program crashes with ValueError: substring not found

import argparse
from rich_argparse._argparse import RichHelpFormatter

parser = argparse.ArgumentParser(prog="PROG", formatter_class=RichHelpFormatter)
parser.add_argument("--hello", default="world", help="say hello to [default: %(default)s]")
parser.print_help()

Using square brackets here is wrong since it is considered markup but it shouldn't crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
argparse Concerns argparse bug Something isn't working
Projects
None yet
1 participant