Cli

module:extensions/Cli/Cli~ Cli

Cli extension.

Constructor

new Cli()

Source:

Methods

getCwd() → {string}

Returns Current Working Directory.
Source:
Returns:
Type:
string

getExitCode() → {number}

Returns latest command execution exit code.
Source:
Returns:
Type:
number
The exit code

getOutput(typeopt) → {string}

Returns captured output.
Source:
Parameters:
Name Type Attributes Default Description
type string <optional>
stdout The standard stream type
Throws:
Argument `type` must be one of: 'stdout', 'stderr'
Type
TypeError
Returns:
Type:
string
The captured output

reset()

Resets the Cli helper: - CWD is reset to current process CWD - environment variables - killDelay & killSignal are disabled - exitCode is set to null - stdout is set to an empty string - stderr is set to an empty string
Source:

run(rawCommand) → {Promise.<boolean>}

Run given command.
Source:
Parameters:
Name Type Description
rawCommand string The command string
Returns:
Type:
Promise.<boolean>
The resulting `Promise`

setCwd(cwd)

Sets the Current Working Directory for the command.
Source:
Parameters:
Name Type Description
cwd string The new CWD

setEnvironmentVariable(name, value)

Defines a single environment variable.
Source:
Parameters:
Name Type Description
name string The environment variable name
value string The value associated to the variable

setEnvironmentVariables(env)

Defines environment variables. Beware that all existing ones will be overridden!
Source:
Parameters:
Name Type Description
env Object The environment variables object