Comparing version 1.8.0 to 1.9.0
@@ -164,2 +164,31 @@ #!/usr/bin/env node | ||
} | ||
else if (argv._[0] === 'csv') { | ||
// print header | ||
console.log('Key,Date,Start,End,Duration,Archived,Type,Message'); | ||
var s = db.createReadStream({ | ||
gt: 'time!' + (argv.gt || ''), | ||
lt: 'time!' + (argv.lt || '~') | ||
}); | ||
s.on('error', error); | ||
s.pipe(through(function (row) { | ||
if (row.value.archive && !argv.archive) return; | ||
if (argv.type && row.value.type !== argv.type) return; | ||
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; | ||
console.log('%s,%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.archive ? 'A' : ''), | ||
(row.value.type || '').replace('"', '""'), | ||
(row.value.message || '').replace('"', '""') | ||
); | ||
})); | ||
} | ||
else if (argv._[0] === 'list') { | ||
@@ -166,0 +195,0 @@ var s = db.createReadStream({ |
@@ -26,2 +26,6 @@ usage: | ||
clocker csv {--gt DATE, --lt DATE, -a} | ||
Generate CSV output. | ||
Show dates between lt and gt. Show archived dates with -a. | ||
clocker add START END {-t TYPE, -m MESSAGE} | ||
@@ -28,0 +32,0 @@ Add a hours from START to END as date strings. |
{ | ||
"name": "clocker", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"description": "track project hours", | ||
@@ -5,0 +5,0 @@ "bin": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20330
418
138