mirror of
https://github.com/flynx/argv.js.git
synced 2025-10-29 18:50:09 +00:00
minor fix...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
2c7eb41b10
commit
3b66c4321b
@ -524,7 +524,7 @@ A way to explicitly stop the _nested parser_ processing at a specific
|
|||||||
point in the argument list is to pass it a `-` argument at that point.
|
point in the argument list is to pass it a `-` argument at that point.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
```shell
|
```shell_session
|
||||||
$ script -a nested -b -c - -x -y -z
|
$ script -a nested -b -c - -x -y -z
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
26
README.md
26
README.md
@ -113,14 +113,14 @@ The `<parsed>` object has the `<parser>` as its `.__proto__`.
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```shell
|
```shell_session
|
||||||
$ npm install ig-argv
|
$ npm install ig-argv
|
||||||
```
|
```
|
||||||
|
|
||||||
## Basics
|
## 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
|
```shell_session
|
||||||
$ touch bare.js
|
$ touch bare.js
|
||||||
$ chmod +x bare.js
|
$ chmod +x bare.js
|
||||||
```
|
```
|
||||||
@ -150,7 +150,7 @@ __filename == (require.main || {}).filename
|
|||||||
|
|
||||||
This script already knows how to respond to `-help` and friends.
|
This script already knows how to respond to `-help` and friends.
|
||||||
|
|
||||||
```shell
|
```shell_session
|
||||||
$ ./bare.js --help
|
$ ./bare.js --help
|
||||||
Usage: bare.js [OPTIONS]
|
Usage: bare.js [OPTIONS]
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ Options:
|
|||||||
## Options in more detail
|
## Options in more detail
|
||||||
|
|
||||||
Start by creating an [`options.js`](./examples/options.js) script...
|
Start by creating an [`options.js`](./examples/options.js) script...
|
||||||
```shell
|
```shell_session
|
||||||
$ touch options.js
|
$ touch options.js
|
||||||
$ chmod +x options.js
|
$ chmod +x options.js
|
||||||
```
|
```
|
||||||
@ -445,7 +445,7 @@ The `<parser>` will call different sets of callbacks on different stop condition
|
|||||||
### Calling the script
|
### Calling the script
|
||||||
|
|
||||||
This will create a parser that supports the following:
|
This will create a parser that supports the following:
|
||||||
```shell
|
```shell_session
|
||||||
$ ./options.js --help
|
$ ./options.js --help
|
||||||
Usage: options.js [OPTIONS]
|
Usage: options.js [OPTIONS]
|
||||||
|
|
||||||
@ -478,20 +478,20 @@ Options:
|
|||||||
Commands:
|
Commands:
|
||||||
command - command
|
command - command
|
||||||
nested - nested
|
nested - nested
|
||||||
bare - bare
|
bare - bare
|
||||||
|
|
||||||
Written by John Smith <j.smith@some-mail.com> (2.8.1 / BSD-3-Clause).
|
Written by John Smith <j.smith@some-mail.com> (2.8.1 / BSD-3-Clause).
|
||||||
### stopped at --help.
|
### stopped at --help.
|
||||||
```
|
```
|
||||||
|
|
||||||
Required argument handling
|
Required argument handling
|
||||||
```shell
|
```shell_session
|
||||||
$ ./options.js
|
$ ./options.js
|
||||||
options.js: ParserError: required but missing: -required
|
options.js: ParserError: required but missing: -required
|
||||||
### something went wrong when parsing -required.
|
### something went wrong when parsing -required.
|
||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```shell_session
|
||||||
$ ./options.js -r
|
$ ./options.js -r
|
||||||
### finished normally.
|
### finished normally.
|
||||||
Parser {
|
Parser {
|
||||||
@ -506,7 +506,7 @@ Notice the default values are set in the output above (output partially truncate
|
|||||||
for brevity).
|
for brevity).
|
||||||
|
|
||||||
Passing values implicitly
|
Passing values implicitly
|
||||||
```shell
|
```shell_session
|
||||||
$ ./script.js -r --value 321
|
$ ./script.js -r --value 321
|
||||||
### finished normally.
|
### finished normally.
|
||||||
Parser {
|
Parser {
|
||||||
@ -518,7 +518,7 @@ Parser {
|
|||||||
```
|
```
|
||||||
|
|
||||||
Passing values explicitly
|
Passing values explicitly
|
||||||
```shell
|
```shell_session
|
||||||
$ ./script.js -r --value=321
|
$ ./script.js -r --value=321
|
||||||
### finished normally.
|
### finished normally.
|
||||||
Parser {
|
Parser {
|
||||||
@ -530,7 +530,7 @@ Parser {
|
|||||||
```
|
```
|
||||||
|
|
||||||
Call a nested parser
|
Call a nested parser
|
||||||
```shell
|
```shell_session
|
||||||
$ ./script.js nested -h
|
$ ./script.js nested -h
|
||||||
Usage: options.js nested [OPTIONS]
|
Usage: options.js nested [OPTIONS]
|
||||||
|
|
||||||
@ -542,7 +542,7 @@ Options:
|
|||||||
### stopped at nested.
|
### stopped at nested.
|
||||||
```
|
```
|
||||||
|
|
||||||
```shell
|
```shell_session
|
||||||
$ ./script.js -r bare
|
$ ./script.js -r bare
|
||||||
### finished normally.
|
### finished normally.
|
||||||
Parser {
|
Parser {
|
||||||
@ -562,7 +562,7 @@ Parser {
|
|||||||
```
|
```
|
||||||
|
|
||||||
Split options and pass value to the last one
|
Split options and pass value to the last one
|
||||||
```shell
|
```shell_session
|
||||||
$ ./options.js -rsc=321
|
$ ./options.js -rsc=321
|
||||||
### finished normally.
|
### finished normally.
|
||||||
Parser {
|
Parser {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user