minor fix...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2025-12-29 23:44:35 +03:00
parent 262c5a3763
commit ad8debe6e7
2 changed files with 6 additions and 4 deletions

View File

@ -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...

View File

@ -1,6 +1,6 @@
{
"name": "ig-argv",
"version": "2.17.1",
"version": "2.17.2",
"description": "simple argv parser",
"main": "argv.js",
"scripts": {