140-opts
Command line arguments parser. This one doesn't do much. But it feets in a tweet.
Installation
$ npm install 140-opts
Alternately, to just copy the file into your repo and avoid an additional package.json
dependency:
$ curl https://cdn.rawgit.com/mklabs/140-opts/master/opts.js > 140-opts.js
# or maybe
$ git clone https://github.com/mklabs/140-opts.git lib/140-opts
Code
module{return a}
in a sligtly more readable way
// 242-optsmodule { return a };
Usage
var opts = processargv;console;
Takes a single argument, an array of String to parse, usually process.argv.slice(2)
.
var opts = ;var argv = ;assert;
Tests
$ node test
Success!
$ --foo foo --bar bar -b baz -o woot --blah
{ foo: 'foo', bar: 'bar', b: 'baz', o: 'woot', blah: true }
\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/
\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/
\o/\o/\o/\o/\o/ \o/\o/\o/\o/\o/\o/\o/
\o/\o/\o/\o/\o/ \o/\o/\o/\o/\o/\o/\o/
\o/\o/\o/\o/\o/ We did it! \o/\o/\o/\o/\o/\o/\o/
\o/\o/\o/\o/\o/ \o/\o/\o/\o/\o/\o/\o/
\o/\o/\o/\o/\o/ \o/\o/\o/\o/\o/\o/\o/
\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/
\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/
\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/\o/
educational and experimental, doing 140bytes snippet of node code is kinda silly... But it's fun! And it's a good opportunity to learn some super-interesting byte saving techniques