CliUnit

flitter-cli/CliUnit~ CliUnit

Unit that provides the functionality associated with flitter-cli.

Constructor

new CliUnit()

Source:

Extends

Methods

(async) cleanup(app) → {Promise.<void>}

Source:
Inherited From:

Cleans up the unit's resources before Flitter closes.

Parameters:
Name Type Description
app module:libflitter/app/FlitterApp~FlitterApp

the Flitter app

Returns:
Type
Promise.<void>

directives() → {Object}

Source:

Get the directive classes provided by this unit. Should be key-value pairs such that the key is the name of the class, and the value is an instance of module:flitter-cli/Directive~Directive.

Returns:
Type
Object

directories() → {Object}

Source:
Inherited From:

Get the directories provided by the unit. Should be an object such that key => value is the name of the directory => fully qualified path to the directory.

Returns:
Type
Object

(async) go(app, context) → {Promise.<void>}

Source:
Overrides:

Loads the module. If any registered unit has deployments/templates/directives, register them with flitter-cli. Register the help messages to be used by ./flitter help. Then, bind them all to the context.

Parameters:
Name Type Description
app module:libflitter/app/FlitterApp~FlitterApp

the Flitter app

context module:libflitter/Context~Context

the Unit's context

Returns:
Type
Promise.<void>

(async) invoke(directive, argv) → {Promise.<Array>}

Source:

Invoke a command, programmatically. Replaces console.log with a pseudo function that collects messages.

Parameters:
Name Type Description
directive string

the directive to be called

argv Array.<string>

array of command line arguments

Returns:
  • array of items that were sent to console.log during the command's execution
Type
Promise.<Array>

name() → {string}

Source:
Overrides:

Get the name of the unit.

Returns:

"cli"

Type
string