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#
getOptions#
options are converted to camelCase This member get all options/flags
getOption#
options are converted to camelCase This member finds and returns current command option.
getArgs#
This member returns current command arguments.
exitError#
This member print's an error and exit with specified code
toMixed#
Create an MixedType content from string
isPlatform#
Check if proccess is runing on expected platform
log#
Write a message in the terminal, a wrapper for console.log but this respects the --silent flag
logLines#
Write in the terminal each element of the array on a line. respects the --silent flag
logWithLabel#
Write in the terminal with a label as a prefix, this label is stylized and formatted according to its context. respects the --silent flag
glob#
Create an promisified glob see more in https://github.com/isaacs/node-glob
isSilent#
Check if CLI is running on silent mode
setSilent#
Artificially activates silent mode
childProcess.shellExec#
This 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.execFile#
This 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