Re: Add angle brackets for required args in argparse

2023-02-22 Thread scruel tao
Thank you for your workarounds, Mark Bourne. `metavar` argument should be sufficient for infrequent use scenarios, and I will consider to use the custom help formatter if necessary. >>> That's a bit closer to what you asked for, since the required argument >>> shown in the error message doesn't

Re: Add angle brackets for required args in argparse

2023-02-20 Thread Mark Bourne
scruel tao wrote: If we have the following code: ``` parser = argparse.ArgumentParser(description="test") parser.add_argument('path') ``` Run it without args, will get error message: ``` usage: test.py [-h] path test.py: error: the following arguments are required: path ``` However, I hope the

Add angle brackets for required args in argparse

2023-02-15 Thread scruel tao
If we have the following code: ``` parser = argparse.ArgumentParser(description="test") parser.add_argument('path') ``` Run it without args, will get error message: ``` usage: test.py [-h] path test.py: error: the following arguments are required: path ``` However, I hope the message can be as th