Skip to content

Instantly share code, notes, and snippets.

@vaxinate
Last active April 19, 2019 22:17
Show Gist options
  • Save vaxinate/afabc6c4a2711497f7000c62c70a691f to your computer and use it in GitHub Desktop.
Save vaxinate/afabc6c4a2711497f7000c62c70a691f to your computer and use it in GitHub Desktop.
[
{"project":"Hosting Platform","date":"01/10/2019","category":"DevOps","hours":"2.5"},
{"project":"Hosting Platform","date":"01/12/2019","category":"DevOps","hours":"3"}
]
#! /usr/bin/env node
// usage:
// punchtabs "Adam Clarke" "/Users/adam/.punches.json"
const util = require('util')
const {execSync} = require('child_process')
const args = process.argv.slice(2)
const name = args[0]
const punches = require(args[1])
const openTab = (punch) => {
const { project, date, hours, category } = punch
const url = `https://airtable.com/shrV4tXD46VGk42JM?prefill_Name=${name}&prefill_Project=${project}&prefill_Category=${category}&prefill_Date=${date}&prefill_Hours=${hours}`
console.log(execSync(`open '${url}'`))
}
punches.forEach(openTab)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment