mirror of
https://github.com/flynx/argv.js.git
synced 2025-12-27 05:41:57 +00:00
cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
74ae4ffd1c
commit
0418a830c8
13
argv.js
13
argv.js
@ -993,10 +993,8 @@ object.Constructor('Parser', {
|
|||||||
if(typeof(arg) != typeof('str')){
|
if(typeof(arg) != typeof('str')){
|
||||||
unhandled.push(arg)
|
unhandled.push(arg)
|
||||||
continue }
|
continue }
|
||||||
// options / commands...
|
// quote '-*' / '@*'...
|
||||||
// NOTE: opts and commands do not follow the same path here
|
arg = arg.replace(/^(.)\*$/, '$1\\*')
|
||||||
// because options if unidentified need to be split into
|
|
||||||
// single letter options and commands to not...
|
|
||||||
var [type, dfl] = opt_pattern.test(arg) ?
|
var [type, dfl] = opt_pattern.test(arg) ?
|
||||||
['opt', OPTION_PREFIX +'*']
|
['opt', OPTION_PREFIX +'*']
|
||||||
: parsed.isCommand(arg) ?
|
: parsed.isCommand(arg) ?
|
||||||
@ -1005,10 +1003,11 @@ object.Constructor('Parser', {
|
|||||||
if(type == 'unhandled'){
|
if(type == 'unhandled'){
|
||||||
unhandled.push(arg)
|
unhandled.push(arg)
|
||||||
continue }
|
continue }
|
||||||
// quote '-*' / '@*'...
|
|
||||||
arg = arg.replace(/^(.)\*$/, '$1\\*')
|
|
||||||
|
|
||||||
// get handler...
|
// get handler...
|
||||||
|
// NOTE: opts and commands do not follow the same path here
|
||||||
|
// because options if unidentified need to be split into
|
||||||
|
// single letter options and commands to not...
|
||||||
var handler = parsed.handler(arg)[1]
|
var handler = parsed.handler(arg)[1]
|
||||||
// handle merged options...
|
// handle merged options...
|
||||||
|| (type == 'opt'
|
|| (type == 'opt'
|
||||||
@ -1028,8 +1027,6 @@ object.Constructor('Parser', {
|
|||||||
|
|
||||||
// implicit options -- with .env and or .default set...
|
// implicit options -- with .env and or .default set...
|
||||||
} else {
|
} else {
|
||||||
values instanceof Map
|
|
||||||
&& console.log('>>>>>', values)
|
|
||||||
values = values instanceof Map ?
|
values = values instanceof Map ?
|
||||||
[...values]
|
[...values]
|
||||||
: values
|
: values
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user