Skip to content

Commit

Permalink
Fixing documentation on positional arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
Brendon Crawford committed Jun 24, 2011
1 parent cae3b09 commit 497f083
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@ Add's a callback for a switch or an argument (defined by index). Switch hooks MU
// Show help section
});

And this example show how to hook an argument (an option without the leading - or --):
And this example show how to hook a positional argument (an option without the leading - or --).
Note that positional argument 0 will be "node" and positional argument 1 will be the path of the
script being run. Positional argument 2 will be the first positional argument after the script path:

parser.on(0, function(opt) {
parser.on(2, function(opt) {
puts('The first non-switch option is:' + opt);
});

Expand Down

0 comments on commit 497f083

Please sign in to comment.