/billing-the-kid

Turn Google Calendar events into invoices 📝

Primary LanguageJavaScript

Billing the Kid

What is it for

It grabs entries from a Google Calendar, sorts/filters them, and outputs a nice table ready to be attached to invoices.

Default output is the console for now. CSV coming asap.

Installation

First, configure a valid gcal-settings.js in /conf, and a proper key.

Then:

npm install
npm link

Development

To compile locally, after pulling/making changes, just run the following command in the root directory.

billtk [...options]

Options

  Minimal options

  billtk          
  --date-start      2019-07-01
  --date-end        2019-07-02
  --title-include   regex "(b:WP)"
  --native-q        Native GCal's API [1]

  Quick (and highly personalized) options
    These options are temporary and override "native-q"
  --weeks    Show the amount of hours worked this week
  --days    
  --months
    

  Planned options

    --title-exclude regex
    --title-split   Split format into columns     
    --desc-include
    --desc-exclude
    --output-format
    --output-timezone "America/Bogota" by default

[1] "Free text search terms to find events that match these terms in any field,
except for extended properties. Optional. ".
Using native search relays filtering to Google instead of my own CPU :)

Formatting

WIP (b:WP) Hola - HolaHola [Categoría]

Dependencies

https://github.com/yuhong90/node-google-calendar To handle auth b/c I'm efficient (lazy).

Preparations needed

Follow https://github.com/yuhong90/node-google-calendar/wiki#preparations-needed

Roadmap

  • Receive essential CLI arguments
    • Switch to commander.js
  • Auth to Google Calendar
  • Fetch N entries
  • Fetch N entries delimited by dates
    • Format dates as RFC3339
    • Add dates to query
  • Filter entries
    • Filter with Google's native "q" option
    • Exclude locally w/ regex
  • Calculate time of events
  • Construct primitive report
    • JSON
    • CSV
      • Convert JSON to CSV string using json2csv.
  • Split titles to columns to categorize
  • Make shortcuts to analyze day/week/month
    • Allow both a specific day OR all events since day
  • Generate aggregate stats
    • Very simple sum of the minutes of retrieved events
  • Use tags to separate content from the description box
    • === Summary
    • === TO-DO
  • Add summary to CSV/JSON output

References

https://www.twilio.com/blog/how-to-build-a-cli-with-node-js