argparse4j icon indicating copy to clipboard operation
argparse4j copied to clipboard

Default value help formatting gives inappropriate result in some common cases.

Open SSNikolaevich opened this issue 4 years ago • 0 comments

parser.addArgument("-o", "--output")
                .type(FileOutputStream.class)
                .setDefault(System.out)
                .metavar("FILE")
                .help("Output file.");

The code above gives this help output:

  -o FILE, --output FILE
                         Output       file.        (default:       java.io.
                         PrintStream@1b9e1916)

Default value looks broken. For boolean options help string as "(default: false)" not suitable in some cases too. Sometimes it would be better to write "this switch is off by default" or something like that. So more control over help sting formatting is needed in argument definition.

SSNikolaevich avatar Jun 03 '21 07:06 SSNikolaevich