The lightweight Node arguments parser
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.travis.yml
LICENSE
README.md
index.js
package.json
test.js

README.md

gar

The lightweight Node arguments parser

GitHub | NPM

Install

npm i gar

Use

gar usage demo

const args = require('gar')(process.argv.slice(2))

console.log(args)

So for: -h hey --toggle -ac --hey=hi -spaced "hey there" -num 1 lone

{
	"h": "hey",
	"toggle": true,
	"a": true,
	"c": true,
	"hey": "hi",
	"spaced": "hey there",
	"num": 1,
	"_": ["lone"]
}

Why use gar?

gar is way more lightweight than other argument parsing packages.

gar is less than 4% the size of the optimist library.

Package Size (KB) Dependencies
(Tree Count)
Size Comparison
(vs. gar)
optimist 109 2 27.25x
minimist 31 0 7.75x
args-parser 15 0 3.75x
gar 4 0 1x