Skip to content

Commit

Permalink
Added documentation for demandCount().
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Ford committed Nov 23, 2013
1 parent 4561ce6 commit 4ebb6c5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,25 @@ console.log(argv.x / argv.y);

Missing required arguments: y

Then demand some non-hypenated arguments!
-----------------------------------------

demand_count.js:
#!/usr/bin/env node
var argv = require('optimist')
.demandCount(2)
.argv;
console.dir(argv)

***

$ ./demand_count.js a
Not enough arguments, expected 2, but only found 1
$ ./demand_count.js a b
{ _: [ 'a', 'b' ], '$0': 'node ./demand_count.js' }
$ ./demand_count.js a b c
{ _: [ 'a', 'b', 'c' ], '$0': 'node ./demand_count.js' }

EVEN MORE HOLY COW
------------------

Expand Down
5 changes: 5 additions & 0 deletions example/demand_count.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env node
var argv = require('optimist')
.demandCount(2)
.argv;
console.dir(argv)

0 comments on commit 4ebb6c5

Please sign in to comment.