cbeust / jcommander

Command line parsing framework for Java
Apache License 2.0
1.96k stars 334 forks source link

cannot detected the required parameter if no value input #508

Open bglmmz opened 3 years ago

bglmmz commented 3 years ago
..
 @Parameter(
          names = {"--name"},
          arity = 1,
          required = true)
private String name;

 @Parameter(
          names = {"--class"},
          arity = 1,
          required = true)
private String class;
...

the command line is:

MyTest add --name --class one

the error message is:

command 'add' not support option 'one'

but not the expected:

option 'name' cannot be empty

but if the command line is:

MyTest add  --class one --name

the error message is expected.