OptionaldestinationOptionalerrorOptionalexitThe exit code for the command
ProtectedhydratedCheck if a command has been hypdrated
OptionaloverrideProtectedparsedOptionalresultThe result property stores the return value of the "run" method (unless commands sets it explicitly)
StaticaliasesA collection of aliases for the command
StaticargsRegistered arguments
StaticbootedStatic ReadonlycommandThe command name one can type to run the command
Static ReadonlydescriptionThe command description
StaticflagsRegistered flags
Static ReadonlyhelpThe help text for the command. Help text can be a multiline string explaining the usage of command
Protected StaticinstanceSet of instance properties that will be added to each instance during construction. Each entry contains a key and value pair representing the property name and its value.
Static ReadonlyoptionsReference to the command args
Add colors to console messages
Reference to the command name
Reference to the command flags
Is the current command the main command executed from the CLI
Logger to log messages
Reference to the command options
Assert the command exists with a given exit code
Assert the command exists with non-zero exit code
Assert command to log the expected message
Optionalstream: "stdout" | "stderr"Assert command to log the expected message
Optionalstream: "stdout" | "stderr"Assert the command exists with a given exit code
Assert the command exists with zero exit code
Assert the command prints a table to stdout
The completed method is the method invoked after the command finishes or results in an error.
You can access the command error using the this.error property.
Returning true from completed method supresses the error
reporting to the kernel layer.
Creates the codemods module to modify source files
Executes the command
Hydrate command by setting class properties from the parsed output
OptionalinteractThe interact template method is used to display the prompts to the user. The method is called after the prepare method.
The prepare template method is used to prepare the state for the command. This is the first method executed on a given command instance.
The run method should include the implementation for the command.
Terminate the app. A command should prefer calling this method over the "app.terminate", because this method only triggers app termination when the current command is in the charge of the process.
JSON representation of the command
StaticbootDefine static properties on the class. During inheritance, certain properties must inherit from the parent.
StaticdefineSpecify the argument the command accepts. The arguments via the CLI will be accepted in the same order as they are defined.
Mostly, you will be using the @args decorator to define the arguments.
Command.defineArgument('entity', { type: 'string' })
StaticdefineSpecify a flag the command accepts.
Mostly, you will be using the @flags decorator to define a flag.
Command.defineFlag('connection', { type: 'string', required: true })
StaticgetReturns the options for parsing flags and arguments
Optionaloptions: FlagsParserOptionsStaticgetterAdds a getter property to the class prototype using Object.defineProperty. Getters are computed properties that are evaluated each time they are accessed, unless the singleton flag is enabled.
// Add a regular getter
MyClass.getter('timestamp', function() {
return Date.now()
})
// Add a singleton getter (cached after first access)
MyClass.getter('config', function() {
return loadConfig()
}, true)
const instance = new MyClass()
instance.timestamp // Computed each time
instance.config // Computed once, then cached
StaticinstanceAdds an instance property that will be assigned to each instance during construction. Unlike macros which are added to the prototype, instance properties are unique to each instance.
StaticmacroAdds a macro (property or method) to the class prototype. Macros are standard properties that get added to the class prototype, making them available on all instances of the class.
StaticserializeSerializes the command to JSON. The return value satisfies the CommandMetaData
StaticvalidateValidate the yargs parsed output againts the command.
The error raised at the time of the executing the command. The value is undefined if no error is raised.