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

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

Open
pes10k opened this issue Dec 3, 2024 · 0 comments · May be fixed by #178

Comments

@pes10k
Copy link

pes10k commented Dec 3, 2024

// 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))

pes10k added a commit to pes10k/argparse that referenced this issue Dec 3, 2024
…to avoid duplciating it in ArgumentDefaultsHelpFormatter, fixes nodeca#177
pes10k added a commit to pes10k/argparse that referenced this issue Dec 3, 2024
…to avoid duplciating it in ArgumentDefaultsHelpFormatter, fixes nodeca#177
pes10k added a commit to pes10k/argparse that referenced this issue Dec 3, 2024
…to avoid duplciating it in ArgumentDefaultsHelpFormatter, fixes nodeca#177
pes10k added a commit to pes10k/argparse that referenced this issue Dec 3, 2024
…to avoid duplciating it in ArgumentDefaultsHelpFormatter, fixes nodeca#177
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant