Need private packages and team management tools?Check out npm Teams »

tunnit

1.0.0 • Public • Published

tunnit Build Status npm version

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.txt
22.01.2014 09:30-16:45 7:15
23.01.2014 09:30-14:30 5:00
24.01.2014 08:30-17:00 8:30

customization

you can easily add custom rules and logic

~/.config/tunnit.js

module.exports = {
  // :: adjust(mins: Number, line: String): Number
  adjust: function(mins, line) {
    // 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
  mapOutputLine: function(line) {
    // make changes to line right before it is printed.
    // line contains duration at this point
    return line;
  }
};

see another, more involved example config

Keywords

none

Install

npm i tunnit

DownloadsWeekly Downloads

0

Version

1.0.0

License

ISC

Last publish

Collaborators

  • avatar