Supplies the root menu for program opperation,
if commandline arguments supplied, moves user to the correct jump point.
- Source:
Requires
- module:fs
- module:bluebird
Methods
(static) get(path, permisionopt, noCacheopt) → {Promise.<(ConfigAPI|Error)>}
Request a config file be loaded, assign API methods based on permision arg.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
path |
string | The location of the config file. | ||
permision |
string |
<optional> |
'read' | If `"write"` the config api will be returned with save and revert methods |
noCache |
boolean |
<optional> |
false | If `true` will ignore cached instances of config file |
- Source:
Throws:
-
-
path param undefined or not a string
- Type
- badParam
-
-
-
any errors during fs.stat
- Type
- fs.stat.err
-
-
-
any errors during fs.readFileSync
- Type
- fs.readFileSync.err
-
Returns:
- Type
- Promise.<(ConfigAPI|Error)>
(static) purge(pathopt) → {boolean}
Cleans entire cache or cleans cache of specific file if path provided
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
path |
string |
<optional> |
The location of the config file to purge from cache. If not provided, cleans entire cache |
- Source:
Returns:
true for successful purges, false if path supplied and not found in cache
- Type
- boolean
(static) setDir(basePath) → {bool}
Sets the base working directory to load JSON config files from.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
basePath |
string | false | the path to the directory to load config files in |
- Source:
Throws:
-
-
basePath param not provided, or not string
- Type
- badParam
-
-
-
basePath does not point to a directory
- Type
- nonDir
-
Returns:
true on good directory, false on bad directory
- Type
- bool
Type Definitions
ConfigAPI
Type:
- Object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
data |
object | the parsed JSON config file | |
save |
function |
<optional> |
method to save any changes back to JSON config file |
revert |
function |
<optional> |
rollback any changes made in .data to state when it was loaded |
- Source: