File tree Expand file tree Collapse file tree 4 files changed +32
-2
lines changed
Expand file tree Collapse file tree 4 files changed +32
-2
lines changed Original file line number Diff line number Diff line change 1+ const program = require('commander');
2+ const colors = require('colors');
3+ const moment = require('moment');
4+
5+ const Frame = require('./models/frame');
6+ const Config = require('./include/file-config');
7+ const Cli = require('./include/cli');
8+ const Fs = require('./include/filesystem');
9+
10+ program.parse(process.argv);
11+
12+ let config = new Config(__dirname);
13+
14+ Fs.find(`"stop": false`, config.frameDir)
15+ .then(frames => {
16+ if (frames.length === 0) {
17+ console.log('No projects are started right now.');
18+ return;
19+ }
20+
21+ frames.forEach(file => {
22+ let frame = Frame.fromFile(config, file);
23+ console.log(`Project ${frame.project.magenta} ${frame.resource.type.blue} ${('#' + frame.resource.id).blue} is running, started ${moment(frame.start).fromNow().green} (id: ${frame.id})`);
24+ });
25+ })
26+ .catch(error => Cli.error('Could not read frames.', error));
Original file line number Diff line number Diff line change 11#!/usr/bin/env node
22
3- const version = '1.1.2 ';
3+ const version = '1.1.3 ';
44const program = require('commander');
55
66program
77 .version(version)
88 .command('start [project] [id]', 'start monitoring time for the given project and resource id')
9+ .command('status', 'shows if time monitoring is running')
910 .command('stop', 'stop monitoring time')
1011 .command('cancel', 'cancel and discard active monitoring time')
1112 .command('log', 'log recorded time records')
Original file line number Diff line number Diff line change 11{
22 "name": "gitlab-time-tracker",
3- "version": "1.1.2 ",
3+ "version": "1.1.3 ",
44 "description": "A CLI that makes working with GitLabs time tracking feature more enjoyable",
55 "main": "gtt.js",
66 "scripts": {},
Original file line number Diff line number Diff line change @@ -55,6 +55,9 @@ you can sync time records to GitLab and create "time spent comments" automatical
5555gtt start "kriskbx/example-project" 15
5656gtt start 15
5757
58+ # status
59+ gtt status
60+
5861# stop LOCAL time monitoring
5962gtt stop
6063
You can’t perform that action at this time.
0 commit comments