forked from kriskbx/gitlab-time-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgtt-sync.js
More file actions
25 lines (20 loc) · 807 Bytes
/
gtt-sync.js
File metadata and controls
25 lines (20 loc) · 807 Bytes
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
const moment = require('moment');
const program = require('commander');
const Config = require('./include/file-config');
const Cli = require('./include/cli');
const Tasks = require('./include/tasks');
program
.option('-p --proxy <proxy>', 'use a proxy server with the given url')
.option('--verbose', 'show verbose output')
.parse(process.argv);
Cli.verbose = program.verbose;
let config = new Config(process.cwd()).set('proxy', program.proxy),
tasks = new Tasks(config);
tasks.syncResolve()
.then(() => {
if (tasks.sync.frames.length === 0) process.exit(0);
return Cli.bar(`${Cli.process} Syncing time records...`, tasks.sync.frames.length)
})
.then(() => tasks.syncNotes())
.then(() => tasks.syncUpdate(Cli.advance))
.catch(error => Cli.x(error));