Skip to content

Commit

Permalink
Support calling from the command line via the script bin/rgb.js
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaelzer committed Apr 16, 2014
1 parent 4a492ae commit b996165
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bin/rgb.js
Original file line number Diff line number Diff line change
@@ -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));
Empty file modified index.js
100644 → 100755
Empty file.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit b996165

Please sign in to comment.