diff --git a/bin/rgb.js b/bin/rgb.js new file mode 100644 index 0000000..88afa6a --- /dev/null +++ b/bin/rgb.js @@ -0,0 +1,11 @@ +#!/usr/bin/env node +var color = require('../index.js'); + +var firstArg = function(fn, context) { + return function() { + var args = Array.prototype.slice.call(arguments); + return fn.call(context, args.length ? args[0] : null); + }; +} + +process.argv.slice(2).map(firstArg(color)).forEach(firstArg(console.log)); \ No newline at end of file diff --git a/index.js b/index.js old mode 100644 new mode 100755 diff --git a/package.json b/package.json index a98ca5f..2eb9096 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,9 @@ "version": "0.0.1", "description": "converts all sorts of colors to rgb format.", "main": "index.js", + "bin": { + "rgb": "bin/rgb.js" + }, "repository": { "type": "git", "url": "https://github.com/kamicane/rgb"