Open stevage opened 7 years ago
I would still like to see this implemented if possible; the answer given in https://github.com/yargs/yargs/issues/730 to use an example doesn't seem as natural as just introducing a metavar name that is printed with the usage string. e.g., as per grep
:
.option('B', {
type: 'number',
alias: ['before-context'],
metavar: 'num',
describe: 'Print num lines of leading context before each match.',
})
Would yield the usage string:
-B num, --before-context=num Print num lines of leading context before each match.
Even better yet, if we could use a template like $0
for default command usage:
describe: 'Print $VAR lines of leading context before each match.'
@stevage @bmundt6 , I'm hacking this behavior by using an alias with leading backspaces ...
// ...
.option('formatter', {
alias: ['f', '\b\b\b\b <command>'], // *hack* use backspaces to fake an option argument description
choices: ['default', 'all', 'deno', 'dprint'],
describe: `Select the code formatter ('default' == 'dprint')`,
nargs: 1,
type: 'string',
});
@mleguen @bcoe , any likelyhood that this could be added to yargs
?
I have an argument specified like:
The help text comes out as:
IMHO, it should be something like:
Is there a way to achieve this? Could there be?