The desc
(or description
) property controls the text displayed immediately to the right of the option or argument in the generated help text.
If not specified, the description will be blank.
sywac.boolean('--confirm', {
desc: 'skip confirmation prompt'
});
Options:
--confirm skip confirmation prompt [boolean]
See also the hints property.
The group
option allows you to organize options into multiple sections in the generated help text. By default, commands are grouped under the section Commands:
, positional arguments are grouped under the section Arguments:
, and flagged options are grouped under Options:
.
Tip:
The text you specify will be used verbatim, so be sure to include the ending colon (
:
)
within your label if you want the colon in your section header.
sywac.number('-p, --port <port>', {
desc: 'port to listen on',
group: 'Server Options:'
});
Server Options:
-p, --port port to listen on [number]
The hidden
option allows you to specify that an option or argument should not be included
in the generated help text.
You can use this to hide a rarely-used or deprecated option, while still taking advantage
of sywac’s parsing.
sywac.boolean('--fancy', {
hidden: true
});
You can also use it to slurp up extra positional arguments, without being displayed in the arguments section.
sywac.positional('[users...]', {
hidden: true
});
The hints
property controls the type information displayed to the far right of the option or argument in the generated help text.
By default, a hint will be generated automatically based on the type of the option - for example, [boolean]
or [number]
.
You can use this to display an optional option as if it was required, or to make the hint more specific.
sywac.string('--name <name>', {
hints: '[required] [string]'
});
sywac.array('--users', {
hints: '[list of users]'
});
Options:
--name [required] [string]
--users [list of users]
You can also use this property to suppress an unwanted auto-generated hint.
sywac.command({
aliases: 'update <student-id>',
desc: 'update a student record',
hints: '' // suppress usual aliases hint
});
Commands:
update update a student record
See also the desc property.