Type Alias: CommanderCLIEntrypointOptions
CommanderCLIEntrypointOptions =
object
The options of commanderCLIEntrypoint.
Properties
argv?
optionalargv?:string[]
The command-line arguments to parse, without the node executable and the script.
Default
process.argv.slice(2)bin?
optionalbin?:string
The program name shown in the help.
Default
the name of the script run, without its extensionconfigure?
optionalconfigure?: (program) =>void|Promise<void>
Customize the commander program (hooks, global options, additional commands) after the action commands are added and before the arguments are parsed.
Parameters
program
Command
Returns
void | Promise<void>
description?
optionaldescription?:string
The program description shown in the help.
exit?
optionalexit?:"application"|"process"|"none"| ((code) =>void|Promise<void>)
What happens once the command ended, with its exit code (0 on success, 1 on failure, the parser's code for a usage error): 'application' exits the application with the code, 'process' only sets process.exitCode, 'none' does nothing, or a function receiving the code.
Default
'application'format?
optionalformat?: (result) =>string|Uint8Array|undefined
Turn an action's result into the text or bytes written to stdout; undefined writes nothing.
Parameters
result
unknown
Returns
string | Uint8Array | undefined
Default
a string as is (with a final newline), bytes as is, null and undefined as nothing, any other value as indented JSON (the bigints as strings)
groups?
optionalgroups?:Record<string,string>
The descriptions of the command groups, by group name: the first words of the nested commands ('package' for the command 'package exe <file>'), whose help (tool package --help) lists their commands.
interactive?
optionalinteractive?:boolean|"auto"
Prompt for the missing required options (it needs the optional package @inquirer/prompts): 'auto' when both stdin and stdout are terminals, true always, false never. While prompting is on, the required options are not enforced by the parser; without @inquirer/prompts installed, prompting is off (the parser requires them).
Default
'auto'middlewares?
optionalmiddlewares?:MiddlewareDefinition[]
The middlewares of this adapter's actions, run after the entrypoint's global middlewares.
name?
optionalname?:string
The adapter name, to tell apart several CLI adapters of one entrypoint.
noCommand?
optionalnoCommand?:"help"|"ignore"
What happens when no argument is given: 'help' writes the help and ends with the code 1, 'ignore' runs no command and leaves the application running (an application also serving other channels).
Default
'help'stderr?
optionalstderr?:NodeJS.WritableStream
The output stream of the errors.
Default
process.stderrstdin?
optionalstdin?:NodeJS.ReadableStream
The input stream of the prompts.
Default
process.stdinstdout?
optionalstdout?:NodeJS.WritableStream
The output stream of the results, the help and the prompts.
Default
process.stdouttranslate?
optionaltranslate?: (module) =>CLITranslate|Promise<CLITranslate>
Translate the texts of the help and of the prompts (the program, command, argument and option descriptions, the help titles) into the user's language: given the entrypoint's module when the arguments are parsed, it returns the translating function (commanderTranslator of lakutata/com/i18n returns the one of an i18n component). The command and option names are never translated.
Parameters
module
Returns
CLITranslate | Promise<CLITranslate>
Default
the English textsversion?
optionalversion?:string
The program version; adds the -V, --version option.