mirror of
https://github.com/flynx/argv.js.git
synced 2025-12-19 18:11:42 +00:00
minor fix...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
3a8ab9508e
commit
aa9a08258d
@ -32,6 +32,7 @@ This code is an evolution of that parser.
|
|||||||
- Reasonable defaults:
|
- Reasonable defaults:
|
||||||
- `-help` – generate and print help
|
- `-help` – generate and print help
|
||||||
- `-version` – print version
|
- `-version` – print version
|
||||||
|
- `-quiet` – suppress printing
|
||||||
- `-` – stop argument processing
|
- `-` – stop argument processing
|
||||||
- Extensible:
|
- Extensible:
|
||||||
- Hooks for dynamic option/command handling
|
- Hooks for dynamic option/command handling
|
||||||
@ -538,7 +539,8 @@ This will turn quiet mode on.
|
|||||||
In quiet mode [`<parser>.print(..)`](#parserprint--parserprinterror) will
|
In quiet mode [`<parser>.print(..)`](#parserprint--parserprinterror) will
|
||||||
not print anything.
|
not print anything.
|
||||||
|
|
||||||
Passing [`--help`](#-h----help) will disable quiet mode and print normally.
|
Passing [`--help`](#-h----help) or [`--version`](#-v----version) will
|
||||||
|
disable quiet mode and print normally.
|
||||||
|
|
||||||
|
|
||||||
#### `-h` / `--help`
|
#### `-h` / `--help`
|
||||||
|
|||||||
10
argv.js
10
argv.js
@ -484,8 +484,8 @@ object.Constructor('Parser', {
|
|||||||
.replace(/\$VERSION/g, this.version || '0.0.0')
|
.replace(/\$VERSION/g, this.version || '0.0.0')
|
||||||
.replace(/\$SCRIPTNAME/g, this.scriptName) },
|
.replace(/\$SCRIPTNAME/g, this.scriptName) },
|
||||||
|
|
||||||
'-h': '-help',
|
|
||||||
// NOTE: this will set .quiet to false...
|
// NOTE: this will set .quiet to false...
|
||||||
|
'-h': '-help',
|
||||||
'-help': {
|
'-help': {
|
||||||
doc: 'print this message and exit',
|
doc: 'print this message and exit',
|
||||||
priority: 99,
|
priority: 99,
|
||||||
@ -627,6 +627,7 @@ object.Constructor('Parser', {
|
|||||||
|
|
||||||
// Version...
|
// Version...
|
||||||
//
|
//
|
||||||
|
// NOTE: this will set .quiet to false...
|
||||||
version: undefined,
|
version: undefined,
|
||||||
|
|
||||||
'-v': '-version',
|
'-v': '-version',
|
||||||
@ -634,19 +635,24 @@ object.Constructor('Parser', {
|
|||||||
doc: 'show $SCRIPTNAME verion and exit',
|
doc: 'show $SCRIPTNAME verion and exit',
|
||||||
priority: 99,
|
priority: 99,
|
||||||
handler: function(){
|
handler: function(){
|
||||||
|
this.quiet = false
|
||||||
this.print(this.version || '0.0.0')
|
this.print(this.version || '0.0.0')
|
||||||
return module.STOP }, },
|
return module.STOP }, },
|
||||||
|
|
||||||
|
|
||||||
// Quiet mode...
|
// Quiet mode...
|
||||||
//
|
//
|
||||||
|
quiet: undefined,
|
||||||
|
|
||||||
'-q': '-quiet',
|
'-q': '-quiet',
|
||||||
'-quiet': {
|
'-quiet': {
|
||||||
priority: 99,
|
priority: 99,
|
||||||
doc: 'quiet mode', },
|
doc: 'quiet mode', },
|
||||||
|
|
||||||
|
|
||||||
// Stop processing arguments and continue into .then(..) handlers...
|
// Stop argument processing...
|
||||||
|
//
|
||||||
|
// This will trigger .then(..) handlers...
|
||||||
//
|
//
|
||||||
// If .then(..) does not handle rest in the nested context then this
|
// If .then(..) does not handle rest in the nested context then this
|
||||||
// context will be returned to the parent context, effectively
|
// context will be returned to the parent context, effectively
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ig-argv",
|
"name": "ig-argv",
|
||||||
"version": "2.7.0",
|
"version": "2.7.1",
|
||||||
"description": "simple argv parser",
|
"description": "simple argv parser",
|
||||||
"main": "argv.js",
|
"main": "argv.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user