new CliApp(name [, options])
Back-end cli worker process template.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
name |
string | The name of the cli application. |
|
options |
object |
<optional> |
Application options |
- Source:
- CliApp.js
Properties:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
options.logger |
object |
<optional> |
Logger options |
|
options.verbose |
bool |
<optional> |
false | Flag to output trivial information for diagnostics |
Extends
- EventEmitter
Members
-
config :object
-
App configuration
Type:
- object
- Source:
- CliApp.js
-
configLoader :object
-
Configuration loader instance
Type:
- object
- Source:
- CliApp.js
-
configPath :string
-
Config path
Type:
- string
- Source:
- CliApp.js
-
env :string
-
Environment flag
Type:
- string
- Source:
- CliApp.js
-
features :object
-
Loaded features, name => feature object
Type:
- object
- Source:
- CliApp.js
-
name :object
-
Name of the app
Type:
- object
- Source:
- CliApp.js
-
options :object
-
App options
Type:
- object
- Source:
- CliApp.js
-
services :object
-
Loaded services
Type:
- object
- Source:
- CliApp.js
-
workingPath :string
-
Working directory of this cli app
Type:
- string
- Source:
- CliApp.js
Methods
-
getService(name)
-
Get a service from module hierarchy
Parameters:
Name Type Description name
- Source:
- CliApp.js
Returns:
- Type
- object
-
<async> loadConfig_()
-
- Source:
- CliApp.js
Returns:
- Type
- CliApp
-
loadFeature(feature)
-
Load a feature object by name
Parameters:
Name Type Description feature
string - Source:
- CliApp.js
Returns:
- Type
- object
-
log()
-
Default log method, may be override by loggers feature
- Source:
- CliApp.js
-
registerService(name, serviceObject, override)
-
Register a service
Parameters:
Name Type Description name
string serviceObject
object override
boolean - Source:
- CliApp.js
-
<async> start_()
-
Start the cli app
- Source:
- CliApp.js
Fires:
Returns:
- Type
- Promise.<CliApp>
-
<async> stop_()
-
Stop the app module
- Source:
- CliApp.js
Fires:
Returns:
- Type
- Promise.<CliApp>
-
toAbsolutePath(args)
-
Translate a relative path of this app module to an absolute path
Parameters:
Name Type Argument Description args
array <repeatable>
Array of path parts
- Source:
- CliApp.js
Returns:
- Type
- string
Events
-
configLoaded
-
Config loaded event.
- Source:
- CliApp.js
-
ready
-
App ready
- Source:
- CliApp.js
-
stopping
-
App stopping
- Source:
- CliApp.js