The Action Context
ActionContext will only be available at the time of executing the command itself, it provides members who help in the process of building our command as well as in querying arguments and options / flags.
#
Action Context members#
getOptionsoptions are converted to camelCase This member get all options/flags
#
getOptionoptions are converted to camelCase This member finds and returns current command option.
#
getArgsThis member returns current command arguments.
#
exitErrorThis member print's an error and exit with specified code
#
toMixedCreate an MixedType content from string
#
isPlatformCheck if proccess is runing on expected platform
#
logWrite a message in the terminal, a wrapper for console.log but this respects the --silent flag
#
logLinesWrite in the terminal each element of the array on a line. respects the --silent flag
#
logWithLabelWrite in the terminal with a label as a prefix, this label is stylized and formatted according to its context. respects the --silent flag
#
globCreate an promisified glob see more in https://github.com/isaacs/node-glob
#
isSilentCheck if CLI is running on silent mode
#
setSilentArtificially activates silent mode
#
childProcess.shellExecThis is a simple helper thats uses child_process.exec and do some outputs to terminal like errors succes and realtime stdout. Note: This helper is very useful when you need to run third-party tools and want to show the user the progress / monitoring of the execution.
#
childProcess.execFileThis is a simple helper thats uses child_process.exec and do some outputs to terminal like errors succes and realtime stdout.
similar to childProcess.shellExec