mirror of
https://github.com/flynx/argv.js.git
synced 2025-10-29 10:50:06 +00:00
more changes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
236e62b4f6
commit
df9f0f89ee
98
ADVANCED.md
98
ADVANCED.md
@ -5,59 +5,59 @@ This file will cover the usage, contents and configuration topics in more detail
|
|||||||
|
|
||||||
## Basics
|
## Basics
|
||||||
|
|
||||||
For basics see README.md
|
For basics see [README.md](./README.md)
|
||||||
|
|
||||||
|
|
||||||
## Contents
|
## Contents
|
||||||
- [argv.js advanced topics](#argvjs-advanced-topics)
|
- [argv.js advanced topics](#argvjs-advanced-topics)
|
||||||
- [Basics](#basics)
|
- [Basics](#basics)
|
||||||
- [Contents](#contents)
|
- [Contents](#contents)
|
||||||
- [Configuration](#configuration)
|
- [Configuration](#configuration)
|
||||||
- [Option/command configuration](#optioncommand-configuration)
|
- [Option/command configuration](#optioncommand-configuration)
|
||||||
- [`<option>.handler(..)`](#optionhandler)
|
- [`<option>.handler(..)`](#optionhandler)
|
||||||
- [`<option>.doc`](#optiondoc)
|
- [`<option>.doc`](#optiondoc)
|
||||||
- [`<option>.priority`](#optionpriority)
|
- [`<option>.priority`](#optionpriority)
|
||||||
- [`<option>.arg`](#optionarg)
|
- [`<option>.arg`](#optionarg)
|
||||||
- [`<option>.type`](#optiontype)
|
- [`<option>.type`](#optiontype)
|
||||||
- [`<option>.collect`](#optioncollect)
|
- [`<option>.collect`](#optioncollect)
|
||||||
- [`<option>.env`](#optionenv)
|
- [`<option>.env`](#optionenv)
|
||||||
- [`<option>.default`](#optiondefault)
|
- [`<option>.default`](#optiondefault)
|
||||||
- [`<option>.required`](#optionrequired)
|
- [`<option>.required`](#optionrequired)
|
||||||
- [`<option>.valueRequired`](#optionvaluerequired)
|
- [`<option>.valueRequired`](#optionvaluerequired)
|
||||||
- [Built-in options](#built-in-options)
|
- [Built-in options](#built-in-options)
|
||||||
- [Disabling or redefining a built-in option](#disabling-or-redefining-a-built-in-option)
|
- [Disabling or redefining a built-in option](#disabling-or-redefining-a-built-in-option)
|
||||||
- [`-` / `--`](#-----)
|
- [`-` / `--`](#-----)
|
||||||
- [`-*` / `@*`](#---)
|
- [`-*` / `@*`](#---)
|
||||||
- [`-v` / `--version`](#-v----version)
|
- [`-v` / `--version`](#-v----version)
|
||||||
- [`-q` / `--quiet`](#-q----quiet)
|
- [`-q` / `--quiet`](#-q----quiet)
|
||||||
- [`-h` / `--help`](#-h----help)
|
- [`-h` / `--help`](#-h----help)
|
||||||
- [Value placeholders](#value-placeholders)
|
- [Value placeholders](#value-placeholders)
|
||||||
- [Automatically defined values](#automatically-defined-values)
|
- [Automatically defined values](#automatically-defined-values)
|
||||||
- [`<parser>.doc`](#parserdoc)
|
- [`<parser>.doc`](#parserdoc)
|
||||||
- [`<parser>.usage`](#parserusage)
|
- [`<parser>.usage`](#parserusage)
|
||||||
- [`<parser>.version`](#parserversion)
|
- [`<parser>.version`](#parserversion)
|
||||||
- [`<parser>.license`](#parserlicense)
|
- [`<parser>.license`](#parserlicense)
|
||||||
- [`<parser>.examples`](#parserexamples)
|
- [`<parser>.examples`](#parserexamples)
|
||||||
- [`<parser>.footer`](#parserfooter)
|
- [`<parser>.footer`](#parserfooter)
|
||||||
- [More control over help...](#more-control-over-help)
|
- [More control over help...](#more-control-over-help)
|
||||||
- [Nested parsers](#nested-parsers)
|
- [Nested parsers](#nested-parsers)
|
||||||
- [Components and API](#components-and-api)
|
- [Components and API](#components-and-api)
|
||||||
- [`THEN` / `STOP`](#then--stop)
|
- [`THEN` / `STOP`](#then--stop)
|
||||||
- [`ParserError(..)`](#parsererror)
|
- [`ParserError(..)`](#parsererror)
|
||||||
- [`Parser(..)`](#parser)
|
- [`Parser(..)`](#parser)
|
||||||
- [`<parser>.then(..)`](#parserthen)
|
- [`<parser>.then(..)`](#parserthen)
|
||||||
- [`<parser>.stop(..)`](#parserstop)
|
- [`<parser>.stop(..)`](#parserstop)
|
||||||
- [`<parser>.error(..)`](#parsererror-1)
|
- [`<parser>.error(..)`](#parsererror-1)
|
||||||
- [`<parser>.off(..)`](#parseroff)
|
- [`<parser>.off(..)`](#parseroff)
|
||||||
- [`<parser>(..)`](#parser-1)
|
- [`<parser>(..)`](#parser-1)
|
||||||
- [Advanced parser API](#advanced-parser-api)
|
- [Advanced parser API](#advanced-parser-api)
|
||||||
- [`<parser>.print(..)` / `<parser>.printError(..)`](#parserprint--parserprinterror)
|
- [`<parser>.print(..)` / `<parser>.printError(..)`](#parserprint--parserprinterror)
|
||||||
- [`<parser>.handlerDefault(..)`](#parserhandlerdefault)
|
- [`<parser>.handlerDefault(..)`](#parserhandlerdefault)
|
||||||
- [`<parser>.handleArgumentValue(..)`](#parserhandleargumentvalue)
|
- [`<parser>.handleArgumentValue(..)`](#parserhandleargumentvalue)
|
||||||
- [`<parser>.handleErrorExit(..)`](#parserhandleerrorexit)
|
- [`<parser>.handleErrorExit(..)`](#parserhandleerrorexit)
|
||||||
- [`<parser>.handle(..)`](#parserhandle)
|
- [`<parser>.handle(..)`](#parserhandle)
|
||||||
- [`<parser>.setHandlerValue(..)`](#parsersethandlervalue)
|
- [`<parser>.setHandlerValue(..)`](#parsersethandlervalue)
|
||||||
- [More...](#more)
|
- [More...](#more)
|
||||||
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|||||||
12
README.md
12
README.md
@ -259,14 +259,14 @@ And for quick-n-dirty hacking stuff together, a shorthand (_not for production_)
|
|||||||
|
|
||||||
To stop option processing either return `STOP` or `THEN`.
|
To stop option processing either return `STOP` or `THEN`.
|
||||||
|
|
||||||
- `THEN` is the normal case, stop processing and trigger [`<parser>.then(..)`](#parserthen):
|
- `THEN` is the normal case, stop processing and trigger [`<parser>.then(..)`](./ADVANCED.md#parserthen):
|
||||||
```javascript
|
```javascript
|
||||||
'-then': {
|
'-then': {
|
||||||
handler: function(){
|
handler: function(){
|
||||||
return argv.THEN } },
|
return argv.THEN } },
|
||||||
```
|
```
|
||||||
|
|
||||||
- `STOP` will stop processing and trigger [`<parser>.stop(..)`](#parserstop):
|
- `STOP` will stop processing and trigger [`<parser>.stop(..)`](./ADVANCED.md#parserstop):
|
||||||
```javascript
|
```javascript
|
||||||
'-stop': {
|
'-stop': {
|
||||||
handler: function(){
|
handler: function(){
|
||||||
@ -285,7 +285,7 @@ There are three ways to stop and/or report errors:
|
|||||||
throw argv.ParserError('something went wrong.') } },
|
throw argv.ParserError('something went wrong.') } },
|
||||||
```
|
```
|
||||||
Here the error will be reported automatically after processing has stopped
|
Here the error will be reported automatically after processing has stopped
|
||||||
but before [`<parser>.error(..)`](#parsererror-1) is triggered.
|
but before [`<parser>.error(..)`](./ADVANCED.md#parsererror-1) is triggered.
|
||||||
|
|
||||||
- _Silently_ `return` a `ParserError(..)` instance:
|
- _Silently_ `return` a `ParserError(..)` instance:
|
||||||
```javascript
|
```javascript
|
||||||
@ -294,7 +294,7 @@ There are three ways to stop and/or report errors:
|
|||||||
return argv.ParserError('something went wrong.') } },
|
return argv.ParserError('something went wrong.') } },
|
||||||
```
|
```
|
||||||
This will _not_ report the error but will stop processing and trigger
|
This will _not_ report the error but will stop processing and trigger
|
||||||
[`<parser>.error(..)`](#parsererror-1), so the user can either recover
|
[`<parser>.error(..)`](./ADVANCED.md#parsererror-1), so the user can either recover
|
||||||
from or report the issue manually.
|
from or report the issue manually.
|
||||||
|
|
||||||
- For a critical error simply `throw` any other JavaScript error/exception:
|
- For a critical error simply `throw` any other JavaScript error/exception:
|
||||||
@ -307,7 +307,7 @@ There are three ways to stop and/or report errors:
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
Also see: [`<parser>.printError(..)`](#parserprint--parserprinterror)
|
Also see: [`<parser>.printError(..)`](./ADVANCED.md#parserprint--parserprinterror)
|
||||||
|
|
||||||
|
|
||||||
### Usage examples
|
### Usage examples
|
||||||
@ -330,7 +330,7 @@ $ ./script.js -fb
|
|||||||
|
|
||||||
## In detail
|
## In detail
|
||||||
|
|
||||||
For a more detailed set of docs see ADVANCED.md
|
For a more detailed set of docs see [ADVANCED.md](./ADVANCED.md)
|
||||||
|
|
||||||
|
|
||||||
## More...
|
## More...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user