tunnit
calculates number of hours for a text file
npm install -g tunnit
intro
assuming work.txt
22.01.2014 09:30-16:45
23.01.2014 09:30-14:30
24.01.2014 08:30-17:00
$ tunnit < work.txt22.01.2014 09:30-16:45 7:1523.01.2014 09:30-14:30 5:0024.01.2014 08:30-17:00 8:30
customization
you can easily add custom rules and logic
~/.config/tunnit.js
moduleexports = // :: adjust(mins: Number, line: String): Number { // you can parse `line` here and adjust `mins` based on that. // subtract 30 minutes for each day because i had lunch return mins - 30; } // :: mapOutputLine(line: String): String { // make changes to line right before it is printed. // line contains duration at this point return line; };
see another, more involved example config