Skip to content

Commit

Permalink
Added example of receiving args from options
Browse files Browse the repository at this point in the history
Updated file to give example and how to manage arguments using options parsing.
  • Loading branch information
codyj110 authored and roman-vanesyan committed Nov 22, 2018
1 parent 27aeac1 commit 03f7d38
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ if (program.sauce) console.log(' with sauce');
else console.log(' without sauce');
```

To get string arguments from options you will need to use angle brackets <> for required inputs <br>
or square brackets [] for optional inputs.

e.g. ```.option(' -m --myarg [myVar]', 'my super cool description')```<br>

Then to access the input if it was passed in.

e.g. ```var myInput = program.myarg```

**NOTE**: If you pass a argument without using brackets the example above will return true and not the value passed in.


## Version option

Calling the `version` implicitly adds the `-V` and `--version` options to the command.
Expand Down

0 comments on commit 03f7d38

Please sign in to comment.