Open octogonz opened 1 year ago
I've created a pull request for that: https://github.com/nodeca/argparse/pull/176
@octogonz #176
You can override the entire help
action like this:
const argparse = require('argparse')
const parser = new argparse.ArgumentParser({ add_help: false })
parser.add_argument(
'-h',
'--help',
{
action: 'help',
default: argparse.SUPPRESS,
help: 'Show this help message and exit.'
}
)
parser.print_help()
Please also check bugreport in python version: https://bugs.python.org/issue45912
Any solution they have over there should work here as well.
https://github.com/python/cpython/issues/90070 at first glance, a similar issue in python mainstream recommends to customize help formatter.
Did you try to find python solution? The same principle should work here too. It would be not nice to diverge code from upstream.
https://stackoverflow.com/questions/35847084/customize-argparse-help-message
Migrating from version 1.0 to version 2.0, we noticed that this library has switched to starting descriptions with a lower case letter. For example
-h
now saysshow this help message and exit
:I understand that this is part of the efforts to more closely mimic the Python implementation of
argparse
. 👍And indeed, Python uses short lower case sentence fragments for its own docs:
HOWEVER, many many many other tools prefer to write more detailed documentation using grammatically complete English sentences. Some popular examples:
tsc
:--help, -h Print this message.
gcc
:-help Display available options
eslint:
-h, --help Show help
powershell
:-Help, -?, /? Shows this message.
webpack
:-h, --help [verbose] Display help for commands and options.
Even Python's own package manager uses properly capitalized full sentences:
Feature request
To support tools that want to adopt maintstream capitalization, it would be great if this library provided a setting to capitalize the first letter of sentences, and generally to provide less terse phrasing of messages.
Or alternatively, maybe the API could provide a general way to customize all of the strings printed by the library, and then we can adjust them however we like. (This might also provide a simple mechanism for localization.)