Skip to content

Instantly share code, notes, and snippets.

@andresdominguez
Last active April 9, 2018 00:41
Show Gist options
  • Save andresdominguez/d8ca87749a6186ff3a053cff9dd75be4 to your computer and use it in GitHub Desktop.
Save andresdominguez/d8ca87749a6186ff3a053cff9dd75be4 to your computer and use it in GitHub Desktop.
const fs = require('fs');
const mappings = require('./mappings');
function doId(path, token) {
if (!mappings[token]) {
console.log(`Cannot find ${token} mappings file.`);
process.exit(1);
}
const contents = mappings[token] + '\n' +
fs.readFileSync(path, 'utf-8');
fs.writeFileSync(path, contents);
}
const myArgs = process.argv.slice(2);
if (myArgs.length !== 2) {
console.log('usage: boo <path> <token>');
process.exit(1);
}
const [path, token] = myArgs;
doId(path, token);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment