mirror of
https://github.com/flynx/argv.js.git
synced 2025-10-29 10:50:06 +00:00
docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
84c8e71cd8
commit
bc6649a152
31
README.md
31
README.md
@ -56,7 +56,8 @@ This code is an evolution of that parser.
|
|||||||
- [Contents](#contents)
|
- [Contents](#contents)
|
||||||
- [Installation](#installation)
|
- [Installation](#installation)
|
||||||
- [Basics](#basics)
|
- [Basics](#basics)
|
||||||
- [Configuring help](#configuring-help)
|
- [Options in more detail](#options-in-more-detail)
|
||||||
|
- [Help and metadata](#help-and-metadata)
|
||||||
- [Basic options](#basic-options)
|
- [Basic options](#basic-options)
|
||||||
- [Commands](#commands)
|
- [Commands](#commands)
|
||||||
- [Active options/commands](#active-optionscommands)
|
- [Active options/commands](#active-optionscommands)
|
||||||
@ -110,21 +111,37 @@ This will already create a script that can respond to `-help` and freinds.
|
|||||||
$ ./script.js --help
|
$ ./script.js --help
|
||||||
```
|
```
|
||||||
|
|
||||||
Let us populate the option definitions splitting the job into sections...
|
## Options in more detail
|
||||||
|
|
||||||
|
Let us populate the option definitions splitting the job into sections.
|
||||||
|
|
||||||
### Configuring help
|
And start by creating a parser...
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var parser = argv.Parser({
|
var parser = argv.Parser({
|
||||||
// doc sections...
|
```
|
||||||
varsion: '0.0.1',
|
|
||||||
|
### Help and metadata
|
||||||
|
|
||||||
|
Basic script description
|
||||||
|
```javascript
|
||||||
doc: 'Example script options',
|
doc: 'Example script options',
|
||||||
|
```
|
||||||
|
|
||||||
|
Metadata:
|
||||||
|
```javascript
|
||||||
|
// to make things consistent we'll take the version from package.json
|
||||||
|
varsion: require('./package.json').version,
|
||||||
|
|
||||||
author: 'John Smith <j.smith@some-mail.com>',
|
author: 'John Smith <j.smith@some-mail.com>',
|
||||||
footer: 'Written by $AUTHOR ($VERSION / $LICENSE).',
|
|
||||||
license: 'BSD-3-Clause',
|
license: 'BSD-3-Clause',
|
||||||
```
|
```
|
||||||
|
|
||||||
|
These basic bits of metadata can be referenced in other `-help` sections,
|
||||||
|
for example:
|
||||||
|
```javascript
|
||||||
|
footer: 'Written by $AUTHOR ($VERSION / $LICENSE).',
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### Basic options
|
### Basic options
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user