mirror of
https://github.com/flynx/argv.js.git
synced 2025-10-28 10:20:09 +00:00
now .handle(..) passes the given key down the call...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
a36f566f10
commit
258e0443e3
4
argv.js
4
argv.js
@ -459,6 +459,7 @@ object.Constructor('Parser', {
|
|||||||
// (see '-?' for a usage example)
|
// (see '-?' for a usage example)
|
||||||
// NOTE: this will not handle anything outside of handler call
|
// NOTE: this will not handle anything outside of handler call
|
||||||
handle: function(handler, rest, key, value, mode){
|
handle: function(handler, rest, key, value, mode){
|
||||||
|
var orig_key = key
|
||||||
// got flag as handler...
|
// got flag as handler...
|
||||||
;[key, handler] =
|
;[key, handler] =
|
||||||
typeof(handler) == typeof('str') ?
|
typeof(handler) == typeof('str') ?
|
||||||
@ -472,11 +473,12 @@ object.Constructor('Parser', {
|
|||||||
return this.handlerDefault(handler, ...args) }))
|
return this.handlerDefault(handler, ...args) }))
|
||||||
.call(this,
|
.call(this,
|
||||||
rest,
|
rest,
|
||||||
key,
|
orig_key,
|
||||||
...(value != null ?
|
...(value != null ?
|
||||||
[value]
|
[value]
|
||||||
: []))
|
: []))
|
||||||
// special-case: nested parser -> set results object to .<arg>...
|
// special-case: nested parser -> set results object to .<arg>...
|
||||||
|
// XXX should we use key or orig_key here???
|
||||||
if(handler instanceof Parser){
|
if(handler instanceof Parser){
|
||||||
res.unhandled
|
res.unhandled
|
||||||
&& this.unhandled.splice(this.unhandled.length, 0, ...res.unhandled)
|
&& this.unhandled.splice(this.unhandled.length, 0, ...res.unhandled)
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ig-argv",
|
"name": "ig-argv",
|
||||||
"version": "2.12.0",
|
"version": "2.13.0",
|
||||||
"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