tweaking docs...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-08-02 16:29:09 +03:00
parent f54e555abd
commit 6c2df284b2

View File

@ -1,21 +1,21 @@
# argv.js # argv.js
Simple argv parser Simple yet complete argv parser
## Motivation ## Motivation
I needed a new argv parser for a quick and dirty project I was working I needed a new argv parser for a quick and dirty project I was working
on and evaluating and selecting the proper existing parser and then on and evaluating and selecting the proper existing parser and then
learning its API, quirks and adapting the architecture to it seemed learning its API, quirks and adapting the project architecture to it
to be more complicated, require more effort and far less fun than seemed to be more complicated, require more effort and far less fun
putting together a trivial parser myself in a couple of hours. than putting together a trivial parser myself in a couple of hours.
This code is an evolution of that parser. This code is an evolution of that parser.
## Features ## Features
- Simple - Simple / well documented
- Supports both the _option_ (a-la `ls`) and _command_ (a-la `git`) paradigms - Supports both the _option_ (a-la `ls`) and _command_ (a-la `git`) paradigms
- Nestable - Nestable
parsers can be nested as option/command handlers defining independent parsers can be nested as option/command handlers defining independent
@ -23,8 +23,8 @@ This code is an evolution of that parser.
- Option expansion - Option expansion
`-abc` expands to `-a -b -c` if `-abc` is not defined `-abc` expands to `-a -b -c` if `-abc` is not defined
- Option/command value passing - Option/command value passing
implicit `-a 123` (requires definition or manual handling) or explicit implicit `-a 123` (requires either _definition_ or manual handling) or
`-a=123` explicit `-a=123`
- Environment variable option/command value defaults - Environment variable option/command value defaults
- Option/command value conversion - Option/command value conversion
- Option/command value collection - Option/command value collection
@ -56,8 +56,7 @@ This code is an evolution of that parser.
- [Planned](#planned) - [Planned](#planned)
- [Contents](#contents) - [Contents](#contents)
- [Architecture](#architecture) - [Architecture](#architecture)
- [Installation](#installation) - [Basics and quick start](#basics-and-quick-start)
- [Basics](#basics)
- [Options in more detail](#options-in-more-detail) - [Options in more detail](#options-in-more-detail)
- [Help and metadata](#help-and-metadata) - [Help and metadata](#help-and-metadata)
- [Basic options](#basic-options) - [Basic options](#basic-options)
@ -112,14 +111,13 @@ The `<parsed>` object has the `<parser>` as its `.__proto__`.
## Installation ## Basics and quick start
To install:
```shell_session ```shell_session
$ npm install ig-argv $ npm install --save ig-argv
``` ```
## Basics
Create a [bare.js](./examples/bare.js) script and make it runnable Create a [bare.js](./examples/bare.js) script and make it runnable
```shell_session ```shell_session
$ touch bare.js $ touch bare.js
@ -130,7 +128,6 @@ Now for the code
```javascript ```javascript
#!/usr/bin/env node #!/usr/bin/env node
// compatible with both node's and RequireJS' require(..)
var argv = require('ig-argv') var argv = require('ig-argv')
var parser = var parser =