mirror of
https://github.com/flynx/argv.js.git
synced 2025-12-18 17:41:40 +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:
|
||||
- `-help` – generate and print help
|
||||
- `-version` – print version
|
||||
- `-quiet` – suppress printing
|
||||
- `-` – stop argument processing
|
||||
- Extensible:
|
||||
- Hooks for dynamic option/command handling
|
||||
@ -538,7 +539,8 @@ This will turn quiet mode on.
|
||||
In quiet mode [`<parser>.print(..)`](#parserprint--parserprinterror) will
|
||||
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`
|
||||
|
||||
10
argv.js
10
argv.js
@ -484,8 +484,8 @@ object.Constructor('Parser', {
|
||||
.replace(/\$VERSION/g, this.version || '0.0.0')
|
||||
.replace(/\$SCRIPTNAME/g, this.scriptName) },
|
||||
|
||||
'-h': '-help',
|
||||
// NOTE: this will set .quiet to false...
|
||||
'-h': '-help',
|
||||
'-help': {
|
||||
doc: 'print this message and exit',
|
||||
priority: 99,
|
||||
@ -627,6 +627,7 @@ object.Constructor('Parser', {
|
||||
|
||||
// Version...
|
||||
//
|
||||
// NOTE: this will set .quiet to false...
|
||||
version: undefined,
|
||||
|
||||
'-v': '-version',
|
||||
@ -634,19 +635,24 @@ object.Constructor('Parser', {
|
||||
doc: 'show $SCRIPTNAME verion and exit',
|
||||
priority: 99,
|
||||
handler: function(){
|
||||
this.quiet = false
|
||||
this.print(this.version || '0.0.0')
|
||||
return module.STOP }, },
|
||||
|
||||
|
||||
// Quiet mode...
|
||||
//
|
||||
quiet: undefined,
|
||||
|
||||
'-q': '-quiet',
|
||||
'-quiet': {
|
||||
priority: 99,
|
||||
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
|
||||
// context will be returned to the parent context, effectively
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-argv",
|
||||
"version": "2.7.0",
|
||||
"version": "2.7.1",
|
||||
"description": "simple argv parser",
|
||||
"main": "argv.js",
|
||||
"scripts": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user