26 March 2016
Make your hubot coffee scripts into reusable standalone programs
In part 1 of this 2 part series on making your module.exports reusable as standalone programs in JavaScript/CoffeeScript, I explained that this pattern allows for flexible reuse of a function like main
:
var main = function(args) {
console.log(args)
}
module.exports = main
if (module.parent === null) {
main(process.argv)
}
In this article, I’ll show how to make a hubot script that wraps the dig
command into a reusable standalone program. Assuming you’re using Linux, OSX, or another BSD and you have dig installed, let’s get started.