Skip to content

Function: generate()

Generate the command usage.

Signature

ts
export async function generate<G extends GunshiParamsConstraint = DefaultGunshiParams>(command: string | string[] | null, entry: Command<G> | LazyCommand<G>, options: GenerateOptions<G> = {}): Promise<string>

Type Parameters

NameDescription
G extends GunshiParamsConstraint = DefaultGunshiParamsA type extending GunshiParams to specify the shape of command parameters.

Parameters

NameTypeDescription
commandstring | string[] | nullusage generate command, if you want to generate the usage of the default command where there are target commands and sub-commands, specify null.
entryCommand<G> | LazyCommand<G>A entry command
optionsGenerateOptions<G>A cli options (optional, default: {})

Returns

Promise<string> — A rendered usage.

Released under the MIT License.