@142vip.utils.Class.VipCommander - 142vip/core-x GitHub Wiki
API 参考 / @142vip/utils / VipCommander
Defined in: packages/utils/src/pkgs/commander.ts:38
终端交互 参考:https://www.npmjs.com/package/commander
Command
new VipCommander(
name,version,description?):VipCommander
Defined in: packages/utils/src/pkgs/commander.ts:39
string
string
string
VipCommander
Command.constructor
args:
string[]
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:298
Command.args
readonlycommands: readonlyCommand[]
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:300
Command.commands
readonlyoptions: readonlyOption[]
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:301
Command.options
parent:
null|Command
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:303
Command.parent
processedArgs:
any[]
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:299
Command.processedArgs
readonlyregisteredArguments: readonlyArgument[]
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:302
Command.registeredArguments
action(
fn):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:547
Register callback fn for the command.
(...args) => void | Promise<void>
this
this command for chaining
program
.command('serve')
.description('start service')
.action(function() {
// do work here
});
Command.action
addArgument(
arg):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:421
Define argument syntax for command, adding a prepared argument.
Argument
this
this command for chaining
Command.addArgument
addCommand(
cmd,opts?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:384
Add a prepared subcommand.
See .command() for creating an attached subcommand which inherits settings from its parent.
Command
CommandOptions
this
this command for chaining
Command.addCommand
addHelpCommand(
cmd):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:454
Add prepared custom help command.
Command
this
Command.addHelpCommand
addHelpCommand(
nameAndArgs,description?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:456
string
string
this
since v12, instead use helpCommand
Command.addHelpCommand
addHelpCommand(
enable?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:458
boolean
this
since v12, instead use helpCommand
Command.addHelpCommand
addHelpOption(
option):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:921
Supply your own option to use for the built-in help option. This is an alternative to using helpOption() to customise the flags and description etc.
Option
this
Command.addHelpOption
addHelpText(
position,text):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:938
Add additional text to be displayed with the built-in help.
Position is 'before' or 'after' to affect just this command, and 'beforeAll' or 'afterAll' to affect this command and all its subcommands.
AddHelpTextPosition
string
this
Command.addHelpText
addHelpText(
position,text):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:939
Add additional text to be displayed with the built-in help.
Position is 'before' or 'after' to affect just this command, and 'beforeAll' or 'afterAll' to affect this command and all its subcommands.
AddHelpTextPosition
(context) => string
this
Command.addHelpText
addOption(
option):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:627
Add a prepared Option.
See .option() and .requiredOption() for creating and attaching an option in a single call.
Option
this
Command.addOption
alias(
alias):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:821
Set an alias for the command.
You may call more than once to add multiple aliases. Only the first alias is shown in the auto-generated help.
string
this
this command for chaining
Command.alias
alias():
string
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:825
Get alias for the command.
string
Command.alias
aliases(
aliases):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:834
Set aliases for the command.
Only the first alias is shown in the auto-generated help.
readonly string[]
this
this command for chaining
Command.aliases
aliases():
string[]
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:838
Get aliases for the command.
string[]
Command.aliases
allowExcessArguments(
allowExcess?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:696
Allow excess command-arguments on the command line. Pass false to make excess arguments an error.
boolean
this
this command for chaining
Command.allowExcessArguments
allowUnknownOption(
allowUnknown?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:689
Allow unknown options on the command line.
boolean
this
this command for chaining
Command.allowUnknownOption
argument<
T>(flags,description,fn,defaultValue?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:408
Define argument syntax for command.
The default is that the argument is required, and you can explicitly indicate this with <> around the name. Put [] around the name for an optional argument.
T
string
string
(value, previous) => T
T
this
this command for chaining
program.argument('<input-file>');
program.argument('[output-file]');
Command.argument
argument(
name,description?,defaultValue?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:414
Define argument syntax for command.
The default is that the argument is required, and you can explicitly indicate this with <> around the name. Put [] around the name for an optional argument.
string
string
unknown
this
this command for chaining
program.argument('<input-file>');
program.argument('[output-file]');
Command.argument
arguments(
names):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:435
Define argument syntax for command, adding multiple at once (without descriptions).
See also .argument().
string
this
this command for chaining
program.arguments('<cmd> [env]');
Command.arguments
combineFlagAndOptionalValue(
combine?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:682
Alter parsing of short flags with optional values.
boolean
this
this command for chaining
// for `.option('-f,--flag [value]'):
.combineFlagAndOptionalValue(true) // `-f80` is treated like `--flag=80`, this is the default behaviour
.combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b`
Command.combineFlagAndOptionalValue
command(
nameAndArgs,opts?):Command
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:341
Define a command, implemented using an action handler.
string
command name and arguments, args are <required> or [optional] and last may also be variadic...
CommandOptions
configuration options
Command
new command
The command description is supplied using .description, not as a parameter to .command.
program
.command('clone <source> [destination]')
.description('clone a repository into a newly created directory')
.action((source, destination) => {
console.log('clone command called')
})Command.command
command(
nameAndArgs,description,opts?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:363
Define a command, implemented in a separate executable file.
string
command name and arguments, args are <required> or [optional] and last may also be variadic...
string
description of executable command
ExecutableCommandOptions
configuration options
this
this command for chaining
The command description is supplied as the second parameter to .command.
program
.command('start <service>', 'start named service')
.command('stop [service]', 'stop named service, or all if no name supplied')Command.command
configureHelp(
configuration):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:491
You can customise the help by overriding Help properties using configureHelp(), or with a subclass of Help by overriding createHelp().
HelpConfiguration
this
Command.configureHelp
configureHelp():
HelpConfiguration
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:493
Get configuration
HelpConfiguration
Command.configureHelp
configureOutput(
configuration):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:511
The default output goes to stdout and stderr. You can customise this for special applications. You can also customise the display of errors by overriding outputError.
The configuration properties are all functions:
// functions to change where being written, stdout and stderr
writeOut(str)
writeErr(str)
// matching functions to specify width for wrapping help
getOutHelpWidth()
getErrHelpWidth()
// functions based on what is being written out
outputError(str, write) // used for displaying errors, and not used for displaying help
OutputConfiguration
this
Command.configureOutput
configureOutput():
OutputConfiguration
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:513
Get configuration
OutputConfiguration
Command.configureOutput
copyInheritedSettings(
sourceCommand):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:520
Copy settings that are useful to have in common across root command and subcommands.
(Used internally when adding a command using .command() so subcommands inherit parent settings.)
Command
this
Command.copyInheritedSettings
createArgument(
name,description?):Argument
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:392
Factory routine to create a new unattached argument.
See .argument() for creating an attached argument, which uses this routine to create the argument. You can override createArgument to return a custom argument.
string
string
Argument
Command.createArgument
createCommand(
name?):Command
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:375
Factory routine to create a new unattached command.
See .command() for creating an attached subcommand, which uses this routine to create the command. You can override createCommand to customise subcommands.
string
Command
Command.createCommand
createHelp():
Help
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:485
You can customise the help with a subclass of Help by overriding createHelp, or by overriding Help properties using configureHelp().
Help
Command.createHelp
createOption(
flags,description?):Option
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:620
Factory routine to create a new unattached option.
See .option() for creating an attached option, which uses this routine to create the option. You can override createOption to return a custom option.
string
string
Option
Command.createOption
description(
str):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:794
Set the description.
string
this
this command for chaining
Command.description
description(
str,argsDescription):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:796
string
Record<string, string>
this
since v8, instead use .argument to add command argument with description
Command.description
description():
string
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:800
Get the description.
string
Command.description
enablePositionalOptions(
positional?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:706
Enable positional options. Positional means global options are specified before subcommands which lets subcommands reuse the same option names, and also enables subcommands to turn on passThroughOptions.
The default behaviour is non-positional and global options may appear anywhere on the command line.
boolean
this
this command for chaining
Command.enablePositionalOptions
error(
message,errorOptions?):never
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:479
Display error message and exit (or call exitOverride).
string
ErrorOptions
never
Command.error
executableDir(
path):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:889
Set the directory for searching for executable subcommands of this command.
string
this
this command for chaining
program.executableDir(__dirname)
// or
program.executableDir('subcommands')Command.executableDir
executableDir():
null|string
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:893
Get the executable search directory.
null | string
Command.executableDir
exitOverride(
callback?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:474
Register callback to use as replacement for calling process.exit.
(err) => void
this
Command.exitOverride
getOptionValue(
key):any
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:644
Retrieve option value.
string
any
Command.getOptionValue
getOptionValueSource(
key):OptionValueSource
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:663
Get source of option value.
string
OptionValueSource
Command.getOptionValueSource
getOptionValueSourceWithGlobals(
key):OptionValueSource
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:668
Get source of option value. See also .optsWithGlobals().
string
OptionValueSource
Command.getOptionValueSourceWithGlobals
help(
context?):never
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:928
Output help information and exit.
Outputs built-in help, and custom text added using .addHelpText().
HelpContext
never
Command.help
help(
cb?):never
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:930
(str) => string
never
since v7
Command.help
helpCommand(
nameAndArgs,description?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:448
Customise or override default help command. By default a help command is automatically added if your command has subcommands.
string
string
this
program.helpCommand('help [cmd]')
program.helpCommand('help [cmd]', 'show help')
program.helpCommand(false) // suppress default help command
program.helpCommand(true) // add help command even if no subcommandsCommand.helpCommand
helpCommand(
enable):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:449
Customise or override default help command. By default a help command is automatically added if your command has subcommands.
boolean
this
program.helpCommand('help [cmd]')
program.helpCommand('help [cmd]', 'show help')
program.helpCommand(false) // suppress default help command
program.helpCommand(true) // add help command even if no subcommandsCommand.helpCommand
helpInformation(
context?):string
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:908
Return command help documentation.
HelpContext
string
Command.helpInformation
helpOption(
flags?,description?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:915
You can pass in flags and a description to override the help flags and help description for your command. Pass in false to disable the built-in help option.
string | boolean
string
this
Command.helpOption
hook(
event,listener):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:463
Add hook for life cycle event.
HookEvent
(thisCommand, actionCommand) => void | Promise<void>
this
Command.hook
init(
options,args):Command
Defined in: packages/utils/src/pkgs/commander.ts:53
初始化,不包括命令
Pick<VipCommanderDetailOptions, "summary" | "description">
VipCommanderOptions = {}
Command
initCommand(
options,args):Command
Defined in: packages/utils/src/pkgs/commander.ts:63
对命令初始化,增加aliases,summary,description等信息
- 增加默认的一些参数
VipCommanderOptions = {}
Command
name(
str):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:856
Set the name of the command.
string
this
this command for chaining
Command.name
name():
string
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:860
Get the name of the command.
string
Command.name
nameFromFilename(
filename):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:875
Set the name of the command from script filename, such as process.argv[1], or require.main.filename, or __filename.
(Used internally and public although not documented in README.)
string
this
this command for chaining
program.nameFromFilename(require.main.filename)Command.nameFromFilename
on(
event,listener):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:947
Add a listener (callback) for when events occur. (Implemented using EventEmitter.)
string | symbol
(...args) => void
this
Command.on
option(
flags,description?,defaultValue?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:569
Define option with flags, description, and optional argument parsing function or defaultValue or both.
The flags string contains the short and/or long flags, separated by comma, a pipe or space. A required
option-argument is indicated by <> and an optional option-argument by [].
See the README for more details, and see also addOption() and requiredOption().
string
string
string | boolean | string[]
this
this command for chaining
program
.option('-p, --pepper', 'add pepper')
.option('-p, --pizza-type <TYPE>', 'type of pizza') // required option-argument
.option('-c, --cheese [CHEESE]', 'add extra cheese', 'mozzarella') // optional option-argument with default
.option('-t, --tip <VALUE>', 'add tip to purchase cost', Number.parseFloat) // custom parse functionCommand.option
option<
T>(flags,description,parseArg,defaultValue?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:574
Define option with flags, description, and optional argument parsing function or defaultValue or both.
The flags string contains the short and/or long flags, separated by comma, a pipe or space. A required
option-argument is indicated by <> and an optional option-argument by [].
See the README for more details, and see also addOption() and requiredOption().
T
string
string
(value, previous) => T
T
this
this command for chaining
program
.option('-p, --pepper', 'add pepper')
.option('-p, --pizza-type <TYPE>', 'type of pizza') // required option-argument
.option('-c, --cheese [CHEESE]', 'add extra cheese', 'mozzarella') // optional option-argument with default
.option('-t, --tip <VALUE>', 'add tip to purchase cost', Number.parseFloat) // custom parse functionCommand.option
option(
flags,description,regexp,defaultValue?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:581
string
string
RegExp
string | boolean | string[]
this
since v7, instead use choices or a custom function
Command.option
opts<
T>():T
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:781
Return an object containing local option values as key-value pairs
T extends OptionValues
T
Command.opts
optsWithGlobals<
T>():T
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:786
Return an object containing merged local and global option values as key-value pairs.
T extends OptionValues
T
Command.optsWithGlobals
outputHelp(
context?):void
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:901
Output help information for this command.
Outputs built-in help, and custom text added using .addHelpText().
HelpContext
void
Command.outputHelp
outputHelp(
cb?):void
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:903
(str) => string
void
since v7
Command.outputHelp
parse(
argv?,parseOptions?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:740
Parse argv, setting options and invoking commands when defined.
Use parseAsync instead of parse if any of your action handlers are async.
Call with no parameters to parse process.argv. Detects Electron and special node options like node --eval. Easy mode!
Or call with an array of strings to parse, and optionally where the user arguments start by specifying where the arguments are from:
-
'node': default,argv[0]is the application andargv[1]is the script being run, with user arguments after that -
'electron':argv[0]is the application andargv[1]varies depending on whether the electron application is packaged -
'user': just user arguments
readonly string[]
ParseOptions
this
this command for chaining
program.parse(); // parse process.argv and auto-detect electron and special node flags
program.parse(process.argv); // assume argv[0] is app and argv[1] is script
program.parse(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]
Command.parse
parseAsync(
argv?,parseOptions?):Promise<VipCommander>
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:761
Parse argv, setting options and invoking commands when defined.
Call with no parameters to parse process.argv. Detects Electron and special node options like node --eval. Easy mode!
Or call with an array of strings to parse, and optionally where the user arguments start by specifying where the arguments are from:
-
'node': default,argv[0]is the application andargv[1]is the script being run, with user arguments after that -
'electron':argv[0]is the application andargv[1]varies depending on whether the electron application is packaged -
'user': just user arguments
readonly string[]
ParseOptions
Promise<VipCommander>
Promise
await program.parseAsync(); // parse process.argv and auto-detect electron and special node flags
await program.parseAsync(process.argv); // assume argv[0] is app and argv[1] is script
await program.parseAsync(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]
Command.parseAsync
parseOptions(
argv):ParseOptionsResult
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:776
Parse options from argv removing known options,
and return argv split into operands and unknown arguments.
argv => operands, unknown
--known kkk op => [op], []
op --known kkk => [op], []
sub --unknown uuu op => [sub], [--unknown uuu op]
sub -- --unknown uuu op => [sub --unknown uuu op], []
string[]
ParseOptionsResult
Command.parseOptions
passThroughOptions(
passThrough?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:717
Pass through options that come after command-arguments rather than treat them as command-options, so actual command-options come before command-arguments. Turning this on for a subcommand requires positional options to have been enabled on the program (parent commands).
The default behaviour is non-positional and options may appear before or after command-arguments.
boolean
this
this command for chaining
Command.passThroughOptions
requiredOption(
flags,description?,defaultValue?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:594
Define a required option, which must have a value after parsing. This usually means the option must be specified on the command line. (Otherwise the same as .option().)
The flags string contains the short and/or long flags, separated by comma, a pipe or space.
string
string
string | boolean | string[]
this
Command.requiredOption
requiredOption<
T>(flags,description,parseArg,defaultValue?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:599
Define a required option, which must have a value after parsing. This usually means the option must be specified on the command line. (Otherwise the same as .option().)
The flags string contains the short and/or long flags, separated by comma, a pipe or space.
T
string
string
(value, previous) => T
T
this
Command.requiredOption
requiredOption(
flags,description,regexp,defaultValue?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:606
string
string
RegExp
string | boolean | string[]
this
since v7, instead use choices or a custom function
Command.requiredOption
setOptionValue(
key,value):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:649
Store option value.
string
unknown
this
Command.setOptionValue
setOptionValueWithSource(
key,value,source):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:654
Store option value and where the value came from.
string
unknown
OptionValueSource
this
Command.setOptionValueWithSource
showHelpAfterError(
displayHelp?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:525
Display the help or a custom message after an error occurs.
string | boolean
this
Command.showHelpAfterError
showSuggestionAfterError(
displaySuggestion?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:530
Display suggestion of similar commands for unknown commands, or options for unknown options.
boolean
this
Command.showSuggestionAfterError
storeOptionsAsProperties<
T>():VipCommander&T
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:635
Whether to store option values as properties on command object, or store separately (specify false). In both cases the option values can be accessed using .opts().
T extends OptionValues
VipCommander & T
this command for chaining
Command.storeOptionsAsProperties
storeOptionsAsProperties<
T>(storeAsProperties):VipCommander&T
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:636
Whether to store option values as properties on command object, or store separately (specify false). In both cases the option values can be accessed using .opts().
T extends OptionValues
true
VipCommander & T
this command for chaining
Command.storeOptionsAsProperties
storeOptionsAsProperties(
storeAsProperties?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:639
Whether to store option values as properties on command object, or store separately (specify false). In both cases the option values can be accessed using .opts().
boolean
this
this command for chaining
Command.storeOptionsAsProperties
summary(
str):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:808
Set the summary. Used when listed as subcommand of parent.
string
this
this command for chaining
Command.summary
summary():
string
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:812
Get the summary.
string
Command.summary
usage(
str):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:845
Set the command usage.
string
this
this command for chaining
Command.usage
usage():
string
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:849
Get the command usage.
string
Command.usage
version(
str,flags?,description?):this
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:315
Set the program version to str.
This method auto-registers the "-V, --version" flag which will print the version number when passed.
You can optionally supply the flags and description to override the defaults.
string
string
string
this
Command.version
version():
undefined|string
Defined in: node_modules/.pnpm/[email protected]/node_modules/commander/typings/index.d.ts:319
Get the program version.
undefined | string
Command.version