Skip to content

Using BooleanOptionalAction and ArgumentDefaultsHelpFormatter results in repeating the default argument twice in the help ouput #177

Open
@pes10k

Description

@pes10k
// example.js
const argparseLib = require('argparse')

const parser = new argparseLib.ArgumentParser({
  formatter_class: argparseLib.ArgumentDefaultsHelpFormatter
})
parser.add_argument('-e', '--an-example', {
  help: 'An example flag.',
  action: argparseLib.BooleanOptionalAction,
  default: true
})
const args = parser.parse_args()
$ node example.js --help
usage: example.js [-h] [-e | --an-example | --no-an-example]

optional arguments:
  -h, --help            show this help message and exit
  -e, --an-example, --no-an-example
                        An example flag. (default: true) (default: true)

The issue is that (default: true) is repeated (e.g. (default: true) (default: true))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions