forked from kriskbx/gitlab-time-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgtt-stop.js
More file actions
23 lines (18 loc) · 857 Bytes
/
gtt-stop.js
File metadata and controls
23 lines (18 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const program = require('commander');
const colors = require('colors');
const moment = require('moment');
const Frame = require('./models/frame');
const Config = require('./include/file-config');
const Cli = require('./include/cli');
const Fs = require('./include/filesystem');
program.parse(process.argv);
let config = new Config(__dirname);
Fs.find(`"stop": false`, config.frameDir)
.then(frames => {
if (frames.length === 0) Cli.error('No projects started.');
frames.forEach(file => {
let frame = Frame.fromFile(config, file).stopMe();
console.log(`Stopping project ${frame.project.magenta} ${frame.resource.type.blue} ${('#' + frame.resource.id).blue}, started ${moment(frame.start).fromNow().green} (id: ${frame.id})`);
});
})
.catch(error => Cli.error('Could not read frames.', error));