Skip to content

Commit bbd1fe3

Browse files
committed
Included examples for help and showHelp functions and fixed few formatting issues
1 parent 16b6d0e commit bbd1fe3

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

readme.markdown

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,31 @@ Format usage output to wrap at `columns` many columns.
389389

390390
Return the generated usage string.
391391

392+
Example:
393+
394+
```
395+
var optimist = require("optimist")
396+
.usage("$0 -operand1 number -operand2 number -operation [add|subtract]");
397+
console.log(optimist.help());
398+
```
399+
400+
Later on, ```argv``` can be retrived with ```optimist.argv```
401+
392402
.showHelp(fn=console.error)
393403
---------------------------
394404

395405
Print the usage data using `fn` for printing.
396406

407+
Example:
408+
409+
```
410+
var optimist = require("optimist")
411+
.usage("$0 -operand1 number -operand2 number -operation [add|subtract]");
412+
optimist.showHelp();
413+
```
414+
415+
Later on, ```argv``` can be retrived with ```optimist.argv```
416+
397417
.parse(args)
398418
------------
399419

@@ -482,6 +502,7 @@ installation
482502
============
483503

484504
With [npm](http://github.com/isaacs/npm), just do:
505+
485506
npm install optimist
486507

487508
or clone this project on github:

0 commit comments

Comments
 (0)