forked from capitalist/omnifocus-github
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.js
executable file
·26 lines (20 loc) · 812 Bytes
/
cli.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
#!/usr/bin/env node
var AssignmentSource = require('./lib/assignment-source.js')
var Config = require('./lib/config.js')
var GitHubApi = require('github')
var OmniFocusSync = require('./lib/omnifocus-sync.js')
var PromiseConcatenator = require('./lib/promise-concatenator.js')
var config = new Config()
var omniSync = new OmniFocusSync(config.settings)
var connections = config.connections()
var sourceAssignments = Array.from(Object.values(connections), (conn) => {
let api = new GitHubApi(conn.settings)
api.authenticate(conn.auth)
let source = new AssignmentSource(api)
let assignments = source.getAssignments()
return assignments
})
new PromiseConcatenator(sourceAssignments).
then((data) => omniSync.processItems(data)).
then(() => console.log("Sync Complete.")).
catch(console.error)