mirror of
https://github.com/flynx/argv.js.git
synced 2025-10-28 02:10:08 +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)
|
||||
// NOTE: this will not handle anything outside of handler call
|
||||
handle: function(handler, rest, key, value, mode){
|
||||
var orig_key = key
|
||||
// got flag as handler...
|
||||
;[key, handler] =
|
||||
typeof(handler) == typeof('str') ?
|
||||
@ -472,11 +473,12 @@ object.Constructor('Parser', {
|
||||
return this.handlerDefault(handler, ...args) }))
|
||||
.call(this,
|
||||
rest,
|
||||
key,
|
||||
orig_key,
|
||||
...(value != null ?
|
||||
[value]
|
||||
: []))
|
||||
// special-case: nested parser -> set results object to .<arg>...
|
||||
// XXX should we use key or orig_key here???
|
||||
if(handler instanceof Parser){
|
||||
res.unhandled
|
||||
&& this.unhandled.splice(this.unhandled.length, 0, ...res.unhandled)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-argv",
|
||||
"version": "2.12.0",
|
||||
"version": "2.13.0",
|
||||
"description": "simple argv parser",
|
||||
"main": "argv.js",
|
||||
"scripts": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user