mirror of
https://github.com/flynx/argv.js.git
synced 2026-01-01 08:11:07 +00:00
minor fix...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
262c5a3763
commit
ad8debe6e7
8
argv.js
8
argv.js
@ -1080,7 +1080,7 @@ object.Constructor('Parser', {
|
||||
// NOTE: to explicitly handle '-*' option or '*' command define handlers
|
||||
// for them under '-\\*' and '@\\*' respectively.
|
||||
|
||||
// Handle unknown otions...
|
||||
// Handle unknown options...
|
||||
// - deligate to parent if .delegateUnknownToParent is true
|
||||
// - thrwo error
|
||||
delegateUnknownToParent: true,
|
||||
@ -1447,11 +1447,13 @@ object.Constructor('Parser', {
|
||||
if(rest.length > 0){
|
||||
var mode = 'explicit'
|
||||
var arg = rest.shift()
|
||||
var orig = arg
|
||||
// non-string stuff in arg list...
|
||||
if(typeof(arg) != typeof('str')){
|
||||
unhandled.push(arg)
|
||||
continue }
|
||||
// quote '-*' / '@*'...
|
||||
// XXX why are we quoting here??
|
||||
arg = arg.replace(/^(.)\*$/, '$1\\*')
|
||||
var [type, dfl] = opt_pattern.test(arg) ?
|
||||
['opt', OPTION_PREFIX +'*']
|
||||
@ -1460,7 +1462,7 @@ object.Constructor('Parser', {
|
||||
: ['unhandled']
|
||||
// no handler is found...
|
||||
if(type == 'unhandled'){
|
||||
unhandled.push(arg)
|
||||
unhandled.push(orig)
|
||||
continue }
|
||||
|
||||
// get handler...
|
||||
@ -1477,7 +1479,7 @@ object.Constructor('Parser', {
|
||||
|| parsed.handler(dfl)[1]
|
||||
// no handler found and '-*' or '@*' not defined...
|
||||
if(handler == null){
|
||||
unhandled.push(arg)
|
||||
unhandled.push(orig)
|
||||
continue }
|
||||
|
||||
// mark/unmark handlers...
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-argv",
|
||||
"version": "2.17.1",
|
||||
"version": "2.17.2",
|
||||
"description": "simple argv parser",
|
||||
"main": "argv.js",
|
||||
"scripts": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user