abstractCommand <O, P, Options>
Hierarchy
- CommandManager<Options>
- Command
Implements
- Commandable<O, P>
Index
Events
Other
- constructor
- exit
- help
- locale
- log
- options
- rest
- unknown
- version
- aliases
- allowUnknownOptions
- allowVariadicParams
- categories
- category
- deprecated
- description
- hidden
- options
- params
- path
- usage
- blueprint
- configure
- createHelp
- executeCommand
- getArguments
- getCommand
- getCommandPaths
- getMetadata
- getParserOptions
- getPath
- register
- render
- run
- runProgram
- runTask
Events
readonlyonAfterRegister
readonlyonBeforeRegister
Called before a command has been registered.
Other
constructor
Type parameters
- O: GlobalOptions = GlobalOptions
- P: PrimitiveType[] = ArgList
- Options: object = {}
exit
Method to exit the current program, with an optional error code.
help
Value of --help
, -h
passed on the command line.
locale
Value of --locale
passed on the command line.
log
Method to log to the console using a log level.
readonlyoptions
Validated and configured options.
rest
Additional arguments passed after --
on the command line.
unknown
Unknown options passed on the command line.
version
Value of --version
, -v
passed on the command line.
staticaliases
staticallowUnknownOptions
staticallowVariadicParams
staticcategories
staticcategory
staticdeprecated
staticdescription
statichidden
staticoptions
staticparams
staticpath
staticusage
blueprint
Validate options passed to the constructor.
configure
Set an options object by merging the new partial and existing options with the defined blueprint, while running all validation checks. Freeze and return the options object.
object.configure({ name: 'Boost' });
object.configure((prevOptions) => ({
nestedObject: {
...prevOptions.nestedObject,
some: 'value',
},
}));
createHelp
Create a React element based on the Help component.
executeCommand
Execute a system native command with the given arguments and pass the results through a promise. This does not execute Boost CLI commands, use
runProgram()
instead.
getArguments
Return the current command class as an arguments object. Options and params must be parsed first to operate correctly.
getCommand
Return a command by registered path, or
null
if not found.Type parameters
- O: object = {}
- P: PrimitiveType[] = ArgList
getCommandPaths
Return a list of all registered command paths (including aliases).
getMetadata
Validate and return all metadata registered to this command instance.
getParserOptions
Return metadata as options for argument parsing.
getPath
Return the command path (canonical name on the command line).
register
Register a command and its canonical path (must be unique), otherwise an error is thrown.
render
Render a React element with Ink and output to the configured streams.
abstractrun
Executed when the command is being ran.
runProgram
Run the program within itself, by passing a custom command and argv list.
runTask
Run a task (function) with the defined arguments and the current command instance bound to the task's context.
Type parameters
- A: unknown[]
- R
Called after a command has been registered.