mirror of
				https://github.com/flynx/argv.js.git
				synced 2025-10-31 03:30:08 +00:00 
			
		
		
		
	bugfix...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									4fe9837881
								
							
						
					
					
						commit
						88790b9441
					
				
							
								
								
									
										13
									
								
								argv.js
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								argv.js
									
									
									
									
									
								
							| @ -448,9 +448,10 @@ object.Constructor('Parser', { | |||||||
| 
 | 
 | ||||||
| 	// common tests...
 | 	// common tests...
 | ||||||
| 	isCommand: function(str){ | 	isCommand: function(str){ | ||||||
| 		return this.commandInputPattern.test(str)  | 		return (str == ''  | ||||||
|  | 				|| this.commandInputPattern.test(str)) | ||||||
| 			&& ((COMMAND_PREFIX + str) in this  | 			&& ((COMMAND_PREFIX + str) in this  | ||||||
| 				|| this['@*']) }, | 				|| !!this['@*']) }, | ||||||
| 	hasArgument: function(handler){ | 	hasArgument: function(handler){ | ||||||
| 		handler = typeof(handler) == typeof('str') ? | 		handler = typeof(handler) == typeof('str') ? | ||||||
| 			this.handler(handler)[1] | 			this.handler(handler)[1] | ||||||
| @ -876,8 +877,6 @@ object.Constructor('Parser', { | |||||||
| 	// 		all the parse data...
 | 	// 		all the parse data...
 | ||||||
| 	// NOTE: this (i.e. parser) can be used as a nested command/option 
 | 	// NOTE: this (i.e. parser) can be used as a nested command/option 
 | ||||||
| 	// 		handler...
 | 	// 		handler...
 | ||||||
| 	//
 |  | ||||||
| 	// XXX BUG: can't pass "" as value...
 |  | ||||||
| 	__call__: function(context, argv, main, root_value){ | 	__call__: function(context, argv, main, root_value){ | ||||||
| 		var parsed = Object.create(this) | 		var parsed = Object.create(this) | ||||||
| 		var opt_pattern = parsed.optionInputPattern | 		var opt_pattern = parsed.optionInputPattern | ||||||
| @ -925,14 +924,16 @@ object.Constructor('Parser', { | |||||||
| 				: arg.split(/=/) | 				: arg.split(/=/) | ||||||
| 			// get value...
 | 			// get value...
 | ||||||
| 			value = value == null ? | 			value = value == null ? | ||||||
| 				(((parsed.hasArgument(handler)  | 				((parsed.hasArgument(handler)  | ||||||
| 								&& rest.length > 0 | 								&& rest.length > 0 | ||||||
| 								&& !opt_pattern.test(rest[0])) ? | 								&& !opt_pattern.test(rest[0])) ? | ||||||
| 							rest.shift() | 							rest.shift() | ||||||
| 						: (typeof(process) != 'undefined' && handler.env) ? | 						: (typeof(process) != 'undefined' && handler.env) ? | ||||||
| 							process.env[handler.env.replace(/^\$/, '')] | 							process.env[handler.env.replace(/^\$/, '')] | ||||||
| 						: value) | 						: value) | ||||||
| 					|| handler.default) | 				: value | ||||||
|  | 			value = value == null ? | ||||||
|  | 				handler.default | ||||||
| 				: value | 				: value | ||||||
| 			// value conversion...
 | 			// value conversion...
 | ||||||
| 			value = (value != null  | 			value = (value != null  | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "ig-argv", |   "name": "ig-argv", | ||||||
|   "version": "2.9.1", |   "version": "2.9.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