mirror of
https://github.com/flynx/argv.js.git
synced 2026-01-05 18:21:09 +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
|
// NOTE: to explicitly handle '-*' option or '*' command define handlers
|
||||||
// for them under '-\\*' and '@\\*' respectively.
|
// for them under '-\\*' and '@\\*' respectively.
|
||||||
|
|
||||||
// Handle unknown otions...
|
// Handle unknown options...
|
||||||
// - deligate to parent if .delegateUnknownToParent is true
|
// - deligate to parent if .delegateUnknownToParent is true
|
||||||
// - thrwo error
|
// - thrwo error
|
||||||
delegateUnknownToParent: true,
|
delegateUnknownToParent: true,
|
||||||
@ -1447,11 +1447,13 @@ object.Constructor('Parser', {
|
|||||||
if(rest.length > 0){
|
if(rest.length > 0){
|
||||||
var mode = 'explicit'
|
var mode = 'explicit'
|
||||||
var arg = rest.shift()
|
var arg = rest.shift()
|
||||||
|
var orig = arg
|
||||||
// non-string stuff in arg list...
|
// non-string stuff in arg list...
|
||||||
if(typeof(arg) != typeof('str')){
|
if(typeof(arg) != typeof('str')){
|
||||||
unhandled.push(arg)
|
unhandled.push(arg)
|
||||||
continue }
|
continue }
|
||||||
// quote '-*' / '@*'...
|
// quote '-*' / '@*'...
|
||||||
|
// XXX why are we quoting here??
|
||||||
arg = arg.replace(/^(.)\*$/, '$1\\*')
|
arg = arg.replace(/^(.)\*$/, '$1\\*')
|
||||||
var [type, dfl] = opt_pattern.test(arg) ?
|
var [type, dfl] = opt_pattern.test(arg) ?
|
||||||
['opt', OPTION_PREFIX +'*']
|
['opt', OPTION_PREFIX +'*']
|
||||||
@ -1460,7 +1462,7 @@ object.Constructor('Parser', {
|
|||||||
: ['unhandled']
|
: ['unhandled']
|
||||||
// no handler is found...
|
// no handler is found...
|
||||||
if(type == 'unhandled'){
|
if(type == 'unhandled'){
|
||||||
unhandled.push(arg)
|
unhandled.push(orig)
|
||||||
continue }
|
continue }
|
||||||
|
|
||||||
// get handler...
|
// get handler...
|
||||||
@ -1477,7 +1479,7 @@ object.Constructor('Parser', {
|
|||||||
|| parsed.handler(dfl)[1]
|
|| parsed.handler(dfl)[1]
|
||||||
// no handler found and '-*' or '@*' not defined...
|
// no handler found and '-*' or '@*' not defined...
|
||||||
if(handler == null){
|
if(handler == null){
|
||||||
unhandled.push(arg)
|
unhandled.push(orig)
|
||||||
continue }
|
continue }
|
||||||
|
|
||||||
// mark/unmark handlers...
|
// mark/unmark handlers...
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ig-argv",
|
"name": "ig-argv",
|
||||||
"version": "2.17.1",
|
"version": "2.17.2",
|
||||||
"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