-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
53 lines (43 loc) · 1.4 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
'use strict'
const _ = require('lodash')
const vantage = require('vantage')()
const Find = require('./lib/manage/commands/find')
const Collections = require('./lib/manage/commands/collections')
const Create = require('./lib/manage/commands/create')
const Remove = require('./lib/manage/commands/remove')
const Update = require('./lib/manage/commands/update')
const remoteAuth = require('./lib/remote-auth')
class SevrRemote {
constructor(sevr, config) {
this.sevr = sevr
this.config = _.merge({}, {}, config)
}
run() {
// collections
vantage
.command('collections', 'List the available collections')
.action(Collections(this.sevr))
// find
vantage
.command('find <collection> [query]', 'Search for documents within a collection')
.action(Find(this.sevr))
// create
vantage
.command('create <collection>', 'Create a new document within a collection')
.action(Create(this.sevr))
// update
vantage
.command('update <collection> [query]', 'Update a document within a collection')
.option('-s, --select [select]', 'Select fields (comma seperated)')
.action(Update(this.sevr))
// delete
vantage
.command('delete <collection> [query]', 'Delete documents within a collection')
.action(Remove(this.sevr))
vantage
.auth(remoteAuth, { sevr: this.sevr })
.delimiter('sevr-remote$')
.listen(4000)
}
}
module.exports = SevrRemote