You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to add a description to each command argument that will automatically be shown in the help?
This is currently possible for options, e.g.:
program
.option('-d, --debug', 'output extra debugging')
.option('-s, --small', 'small pizza size')
.option('-p, --pizza-type <type>', 'flavour of pizza');
However, I don't see a way to do it for commands.
program
.command('clone <source> [destination]')
.description('clone a repository into a newly created directory')
.action((source, destination) => {
console.log('clone command called');
});
Completely fabricated idea of how this might be done:
program
.command('clone <source> [destination]')
.description('clone a repository into a newly created directory')
.commandArgument("source", "A URL that indicates the source for the clone operation")
.commandArgument("destination", "A directory to clone into")
.action((source, destination) => {
console.log('clone command called');
});
The text was updated successfully, but these errors were encountered:
It is possible! The .description() method allows a second parameter with descriptions of the command arguments.
The parameter is a hash with key of the argument name and value of the description. Using this adds an "Arguments:" section in the built-in help.
program.arguments('<file>').description('print target file',{file: 'file to process'});
Is it possible to add a description to each command argument that will automatically be shown in the help?
This is currently possible for options, e.g.:
However, I don't see a way to do it for commands.
Completely fabricated idea of how this might be done:
The text was updated successfully, but these errors were encountered: