mirror of
https://github.com/flynx/argv.js.git
synced 2025-10-28 10:20:09 +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
|
||||
|
||||
For basics see README.md
|
||||
For basics see [README.md](./README.md)
|
||||
|
||||
|
||||
## Contents
|
||||
- [argv.js advanced topics](#argvjs-advanced-topics)
|
||||
- [Basics](#basics)
|
||||
- [Contents](#contents)
|
||||
- [Configuration](#configuration)
|
||||
- [Option/command configuration](#optioncommand-configuration)
|
||||
- [`<option>.handler(..)`](#optionhandler)
|
||||
- [`<option>.doc`](#optiondoc)
|
||||
- [`<option>.priority`](#optionpriority)
|
||||
- [`<option>.arg`](#optionarg)
|
||||
- [`<option>.type`](#optiontype)
|
||||
- [`<option>.collect`](#optioncollect)
|
||||
- [`<option>.env`](#optionenv)
|
||||
- [`<option>.default`](#optiondefault)
|
||||
- [`<option>.required`](#optionrequired)
|
||||
- [`<option>.valueRequired`](#optionvaluerequired)
|
||||
- [Built-in options](#built-in-options)
|
||||
- [Disabling or redefining a built-in option](#disabling-or-redefining-a-built-in-option)
|
||||
- [`-` / `--`](#-----)
|
||||
- [`-*` / `@*`](#---)
|
||||
- [`-v` / `--version`](#-v----version)
|
||||
- [`-q` / `--quiet`](#-q----quiet)
|
||||
- [`-h` / `--help`](#-h----help)
|
||||
- [Value placeholders](#value-placeholders)
|
||||
- [Automatically defined values](#automatically-defined-values)
|
||||
- [`<parser>.doc`](#parserdoc)
|
||||
- [`<parser>.usage`](#parserusage)
|
||||
- [`<parser>.version`](#parserversion)
|
||||
- [`<parser>.license`](#parserlicense)
|
||||
- [`<parser>.examples`](#parserexamples)
|
||||
- [`<parser>.footer`](#parserfooter)
|
||||
- [More control over help...](#more-control-over-help)
|
||||
- [Nested parsers](#nested-parsers)
|
||||
- [Components and API](#components-and-api)
|
||||
- [`THEN` / `STOP`](#then--stop)
|
||||
- [`ParserError(..)`](#parsererror)
|
||||
- [`Parser(..)`](#parser)
|
||||
- [`<parser>.then(..)`](#parserthen)
|
||||
- [`<parser>.stop(..)`](#parserstop)
|
||||
- [`<parser>.error(..)`](#parsererror-1)
|
||||
- [`<parser>.off(..)`](#parseroff)
|
||||
- [`<parser>(..)`](#parser-1)
|
||||
- [Advanced parser API](#advanced-parser-api)
|
||||
- [`<parser>.print(..)` / `<parser>.printError(..)`](#parserprint--parserprinterror)
|
||||
- [`<parser>.handlerDefault(..)`](#parserhandlerdefault)
|
||||
- [`<parser>.handleArgumentValue(..)`](#parserhandleargumentvalue)
|
||||
- [`<parser>.handleErrorExit(..)`](#parserhandleerrorexit)
|
||||
- [`<parser>.handle(..)`](#parserhandle)
|
||||
- [`<parser>.setHandlerValue(..)`](#parsersethandlervalue)
|
||||
- [More...](#more)
|
||||
- [Basics](#basics)
|
||||
- [Contents](#contents)
|
||||
- [Configuration](#configuration)
|
||||
- [Option/command configuration](#optioncommand-configuration)
|
||||
- [`<option>.handler(..)`](#optionhandler)
|
||||
- [`<option>.doc`](#optiondoc)
|
||||
- [`<option>.priority`](#optionpriority)
|
||||
- [`<option>.arg`](#optionarg)
|
||||
- [`<option>.type`](#optiontype)
|
||||
- [`<option>.collect`](#optioncollect)
|
||||
- [`<option>.env`](#optionenv)
|
||||
- [`<option>.default`](#optiondefault)
|
||||
- [`<option>.required`](#optionrequired)
|
||||
- [`<option>.valueRequired`](#optionvaluerequired)
|
||||
- [Built-in options](#built-in-options)
|
||||
- [Disabling or redefining a built-in option](#disabling-or-redefining-a-built-in-option)
|
||||
- [`-` / `--`](#-----)
|
||||
- [`-*` / `@*`](#---)
|
||||
- [`-v` / `--version`](#-v----version)
|
||||
- [`-q` / `--quiet`](#-q----quiet)
|
||||
- [`-h` / `--help`](#-h----help)
|
||||
- [Value placeholders](#value-placeholders)
|
||||
- [Automatically defined values](#automatically-defined-values)
|
||||
- [`<parser>.doc`](#parserdoc)
|
||||
- [`<parser>.usage`](#parserusage)
|
||||
- [`<parser>.version`](#parserversion)
|
||||
- [`<parser>.license`](#parserlicense)
|
||||
- [`<parser>.examples`](#parserexamples)
|
||||
- [`<parser>.footer`](#parserfooter)
|
||||
- [More control over help...](#more-control-over-help)
|
||||
- [Nested parsers](#nested-parsers)
|
||||
- [Components and API](#components-and-api)
|
||||
- [`THEN` / `STOP`](#then--stop)
|
||||
- [`ParserError(..)`](#parsererror)
|
||||
- [`Parser(..)`](#parser)
|
||||
- [`<parser>.then(..)`](#parserthen)
|
||||
- [`<parser>.stop(..)`](#parserstop)
|
||||
- [`<parser>.error(..)`](#parsererror-1)
|
||||
- [`<parser>.off(..)`](#parseroff)
|
||||
- [`<parser>(..)`](#parser-1)
|
||||
- [Advanced parser API](#advanced-parser-api)
|
||||
- [`<parser>.print(..)` / `<parser>.printError(..)`](#parserprint--parserprinterror)
|
||||
- [`<parser>.handlerDefault(..)`](#parserhandlerdefault)
|
||||
- [`<parser>.handleArgumentValue(..)`](#parserhandleargumentvalue)
|
||||
- [`<parser>.handleErrorExit(..)`](#parserhandleerrorexit)
|
||||
- [`<parser>.handle(..)`](#parserhandle)
|
||||
- [`<parser>.setHandlerValue(..)`](#parsersethandlervalue)
|
||||
- [More...](#more)
|
||||
|
||||
|
||||
## 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`.
|
||||
|
||||
- `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
|
||||
'-then': {
|
||||
handler: function(){
|
||||
return argv.THEN } },
|
||||
```
|
||||
|
||||
- `STOP` will stop processing and trigger [`<parser>.stop(..)`](#parserstop):
|
||||
- `STOP` will stop processing and trigger [`<parser>.stop(..)`](./ADVANCED.md#parserstop):
|
||||
```javascript
|
||||
'-stop': {
|
||||
handler: function(){
|
||||
@ -285,7 +285,7 @@ There are three ways to stop and/or report errors:
|
||||
throw argv.ParserError('something went wrong.') } },
|
||||
```
|
||||
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:
|
||||
```javascript
|
||||
@ -294,7 +294,7 @@ There are three ways to stop and/or report errors:
|
||||
return argv.ParserError('something went wrong.') } },
|
||||
```
|
||||
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.
|
||||
|
||||
- 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
|
||||
@ -330,7 +330,7 @@ $ ./script.js -fb
|
||||
|
||||
## 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...
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user