Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
minimal log for integration in shell prompt
  • Loading branch information
Andreas Müller committed Dec 6, 2022
commit a8fd623431f604325cff5fc8594e08b445b5b582
14 changes: 11 additions & 3 deletions src/gtt-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const Tasks = require('./include/tasks');

program
.option('--verbose', 'show verbose output')
.option('-s', 'short output')
.parse(process.argv);

Cli.verbose = program.opts().verbose;
Expand All @@ -18,10 +19,17 @@ let config = new Config(__dirname),
tasks.status()
.then(frames => {
if (frames.length === 0) {
console.log('No projects are started right now.');
if (program.opts().s) {
console.log('gtt idle ');
}else {
console.log('No projects are started right now.');
}
return;
}

frames.forEach(frame => console.log(`Project ${frame.project.magenta} ${frame.resource.type.blue} ${('#' + frame.resource.id).blue} ${frame.note?frame.note:''} is running, started ${moment(frame.start).fromNow().green} (id: ${frame.id})`));
if (program.opts().s) {
frames.forEach(frame => console.log(`${frame.project.magenta} ${frame.resource.type.blue} ${('#' + frame.resource.id).blue} ${moment(frame.start).fromNow().green} (id: ${frame.id})`));
} else {
frames.forEach(frame => console.log(`Project ${frame.project.magenta} ${frame.resource.type.blue} ${('#' + frame.resource.id).blue} ${frame.note?frame.note:''} is running, started ${moment(frame.start).fromNow().green} (id: ${frame.id})`));
}
})
.catch(error => Cli.error('Could not read frames.', error));