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

In usage message, it feels strange to have a required argument in "Optional arguments" section #340

Open
nmoreaud opened this issue Mar 20, 2024 · 0 comments

Comments

@nmoreaud
Copy link

Currently, argparse distinguishes "positional arguments" and "optional arguments".
I wonder if "optional arguments" should be splitted into 2 separate categories: "named arguments" and "optional arguments", so that required arguments are listed first.
Or rename "Optional arguments" into "Named arguments", because it feels weird to have a required argument in "Optional arguments" section.

Also, positional arguments are listed first, but in "Usage: " line, input is the last parameter

Usage: main [--help] [--verbose] --configuration VAR [--optional1 VAR] [--optional2 VAR] [--optional3 VAR] input

A description

Positional arguments:
  input                      json input file [required]

Optional arguments:
  -h, --help                 shows help message and exits 
  -v, --verbose              verbose output 
  -c, --configuration        propagation model configuration [required]
  --optional1              optional argument 1
  --optional2              optional argument 2
  --optional3              optional argument 3

vs

Usage: main [--help] [--verbose] --configuration VAR [--optional1 VAR] [--optional2 VAR] [--optional3 VAR] input

A description

Positional arguments:
  input                      json input file [required]

Named arguments:
  -c, --configuration        propagation model configuration [required]

Optional arguments:
  -h, --help                 shows help message and exits 
  -v, --verbose              verbose output 
  --optional1              optional argument 1
  --optional2              optional argument 2
  --optional3              optional argument 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant