Skip to content

Instantly share code, notes, and snippets.

@divarvel
Created May 12, 2015 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save divarvel/afc06a34bcd57e73e8ce to your computer and use it in GitHub Desktop.
Save divarvel/afc06a34bcd57e73e8ce to your computer and use it in GitHub Desktop.
Minimist
> var m = require('minimist')
undefined
> m(["test.js", "23"])
{ _: [ 'test.js', 23 ] }
> m(["test.js", "23"], { "string": ["_"] })
{ _: [ 'test.js', '23' ] }
> m(["test.js", "--option", "23"], { "string": ["_"] })
{ _: [ 'test.js' ], option: 23 }
> m(["test.js", "--option", "23"], { "string": ["_", "option"] })
{ _: [ 'test.js' ], option: '23' }
> m(["test.js", "--option", "23"], { "string": ["_"], "boolean": ["option"] })
{ _: [ 'test.js', '23' ],
option: true }
> m(["test.js", "--option", "true"], { "string": ["_"], "boolean": ["option"] })
{ _: [ 'test.js' ], option: true }
> m(["test.js", "--option", "false"], { "string": ["_"], "boolean": ["option"] })
{ _: [ 'test.js' ], option: false }
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment