Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clocker

Package Overview
Dependencies
Maintainers
3
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clocker - npm Package Compare versions

Comparing version 1.13.2 to 1.14.0

76

bin/cmd.js

@@ -249,12 +249,4 @@ #!/usr/bin/env node

console.log(
'%s %s [ %s - %s ] (%s)%s%s',
toStamp(row.key),
strftime('%F', start),
strftime('%T', start),
end ? strftime('%T', end) : 'NOW',
fmt(elapsed),
(row.value.type ? ' [' + row.value.type + ']' : ''),
(row.value.archive ? ' A' : '')
);
printEntry(row.key, start, end, elapsed, row.value.type, row.value.archive);
if (argv.verbose && row.value.message) {

@@ -363,2 +355,43 @@ var lines = row.value.message.split('\n');

}
else if (argv._[0] === 'report') {
// options and arguments
var day = argv.reportDay;
// get report data
var reportDay = (day && typeof day === 'string') ? getDate(day) : new Date();
var reportDayTomorrow = new Date(reportDay);
reportDayTomorrow.setDate(reportDayTomorrow.getDate() +1);
console.log('Report for %s:', printDate(reportDay));
var s = db.createReadStream({
gt: 'time!' + (strftime('%F', reportDay) || ''),
lt: 'time!' + (strftime('%F', reportDayTomorrow) || '~')
});
s.on('error', error);
var sumsByType = {};
var totalSum = 0;
s.pipe(through(function (row) {
var start = new Date(row.key.split('!')[1]);
var end = row.value.end && new Date(row.value.end);
var elapsed = (end ? end : new Date) - start;
printEntry(row.key, start, end, elapsed, row.value.type, row.value.archive);
sumsByType[row.value.type] ? sumsByType[row.value.type] += elapsed : sumsByType[row.value.type] = elapsed;
}, function end () {
console.log('');
for(var type in sumsByType) {
console.log("%s: %s", type, fmt(sumsByType[type]));
totalSum += sumsByType[type];
}
console.log("\ntotal: %s", fmt(totalSum));
}));
}
else usage(1)

@@ -526,3 +559,26 @@

function printEntry (key, start, end, elapsed, type, archive) {
console.log(
'%s %s [ %s - %s ] (%s)%s%s',
toStamp(key),
strftime('%F', start),
strftime('%T', start),
end ? strftime('%T', end) : 'NOW',
fmt(elapsed),
(type ? ' [' + type + ']' : ''),
(archive ? ' A' : '')
);
}
function printDate(date) {
var monthNames = [
"January", "February", "March",
"April", "May", "June", "July",
"August", "September", "October",
"November", "December"
];
return date.getDate() + ' ' + monthNames[date.getMonth()] + ' ' + date.getFullYear();
}
function addData (obj) {

@@ -529,0 +585,0 @@ var data = minimist(argv['--']);

@@ -27,2 +27,6 @@ usage:

clocker report {--reportDay DATE}
Show all logged hours of a specific day.
If no --reportDay is set, the current day will be used.
clocker csv {--gt DATE, --lt DATE, --props FIELDS, -a}

@@ -29,0 +33,0 @@ Generate CSV output.

7

package.json
{
"name": "clocker",
"version": "1.13.2",
"version": "1.14.0",
"description": "track project hours",

@@ -18,7 +18,4 @@ "bin": {

},
"devDependencies": {
"tape": "~2.3.2"
},
"scripts": {
"test": "tape test/*.js"
"test": "echo \"Error: no test specified\" && exit 1"
},

@@ -25,0 +22,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc