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 the following:
```
usage: test.py [-h] <path>
test.py: error: the following arguments are required: path
```
Or might can consider to provide a way to let user have there own style, like:
```
usage: test.py [-h] path
```
That's a bit closer to what you asked for, since the required argument
shown in the error message doesn't include the angle brackets. It also
avoids needing to specify a `metavar` for every positional argument.
However, it is overriding a non-public method of the `HelpFormatter`
class, so might not work across all Python versions if the name or
signature of that method changes (even if it does work with all current
versions, it might break in future).
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 300 |
Nodes: | 16 (2 / 14) |
Uptime: | 60:39:50 |
Calls: | 6,712 |
Files: | 12,243 |
Messages: | 5,355,759 |