adamocomp/README.md

94 lines
2.3 KiB
Markdown
Raw Normal View History

2020-05-21 12:17:47 +00:00
# Adamocomp
The adamocomp is an automaton worker that is able to fuzzy-parse mixed and unorganized data in order to perform local and remote operations across very flexible host clusterings. Its primary purpose is to handle complicated operations that must be done precisely the same way across multiple systems. But in reality it assists me in virtually all of my system operations tasks.
2020-05-21 12:08:44 +00:00
# Adamocomp Data Parser
This library provides methods to interpret the adamocomp data file.
## Example Usage
``` javascript
const Parser = require('adamocomp/parser.js');
var parser = new Parser();
parser.get.data('gitlab repo').then(function(data){
// "data" contains all data for the gitlab deal
})
parser.get_formatted.data('gitlab repo').then(function(printable){
// Standard output as stringified json.
console.log(printable)
})
// parser.get_formatted.root('gitlab').then(function(str){
// console.log(str)
// }
// Output below
```
``` bash
node data_tool.js path "gitlab"
# ["gitlab"]
```
## Constructor Options
* `new Parser({options})`
| property | type | description | default |
|---|---|---|---|
| path | string | Path to data file | `${program_root}/data.json` |
## Methods
### `get.file()`
Type: async
Params: none
Returns: an object literal of the data file.
``` javascript
parser.get.file().then(function(file){
// 'file' is the entire data file
})
```
### `get.data(string)`
Type: async
| param | type | description |
|---|---|---|
| 1 | string | search string |
Returns: data tree underneath node corresponding to search string, if found, otherwise null.
``` javascript
parser.get.data(str).then(function(data){
console.log(JSON.stringify(data));
})
```
### `get.root(string)`
Type: async
| param | type | description |
|---|---|---|
| 1 | string | search string |
Returns: array of keys (directories) leading to deal, if found, or an empty array.
``` javascript
parser.get.root(str).then(function(nodes){
console.log(locations);
// ['gitlab']
})
```
### `get.list()`
Type: async
Params: none
Returns: array of all deployments in the environment.
``` javascript
parser.get.list().then(function(deployments){
console.log(location);
// ['gitlab', 'factorio/clusterio_host', 'factorio/factorio_host', etc.]
})
```
## Running Tests
`npm test`