mirror of
https://github.com/flynx/argv.js.git
synced 2025-10-28 18:30:07 +00:00
minor refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
7fb1ddb760
commit
de9c29ac66
6
argv.js
6
argv.js
@ -462,8 +462,8 @@ object.Constructor('Parser', {
|
||||
'-v': '-verbose',
|
||||
|
||||
|
||||
unknownOption: function(_, key){
|
||||
console.error('Unknown option:', key)
|
||||
unknownArgument: function(_, key){
|
||||
console.error('Unknown '+ (key.startsWith('-') ? 'option:' : 'command:'), key)
|
||||
return module.ERROR },
|
||||
|
||||
|
||||
@ -529,7 +529,7 @@ object.Constructor('Parser', {
|
||||
if(type != 'unhandled'){
|
||||
// get handler...
|
||||
var handler = this.getHandler(arg).pop()
|
||||
|| this.unknownOption
|
||||
|| this.unknownArgument
|
||||
// get option value...
|
||||
var value = (handler.arg && !opt_pattern.test(argv[0])) ?
|
||||
argv.shift()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user