commander
Advanced tools
Comparing version 1.2.0 to 1.3.0
1.3.0 / 2013-07-09 | ||
================== | ||
* add EACCES error handling | ||
* fix sub-command --help | ||
1.2.0 / 2013-06-13 | ||
@@ -3,0 +9,0 @@ ================== |
15
index.js
@@ -375,6 +375,8 @@ /*! | ||
var result = this.parseArgs(this.args, parsed.unknown); | ||
// executable sub-commands, skip .parseArgs() | ||
if (this.executables) return this.executeSubCommand(argv, args, parsed.unknown); | ||
return this.parseArgs(this.args, parsed.unknown); | ||
return result; | ||
}; | ||
@@ -409,10 +411,11 @@ | ||
var local = path.join(dir, bin); | ||
if (exists(local)) bin = local; | ||
// run it | ||
args = args.slice(1); | ||
var proc = spawn(bin, args, { stdio: 'inherit', customFds: [0, 1, 2] }); | ||
proc.on('exit', function(code){ | ||
if (code == 127) { | ||
console.error('\n %s(1) does not exist\n', bin); | ||
var proc = spawn(local, args, { stdio: 'inherit', customFds: [0, 1, 2] }); | ||
proc.on('error', function(err){ | ||
if (err.code == "ENOENT") { | ||
console.error('\n %s(1) does not exist, try --help\n', bin); | ||
} else if (err.code == "EACCES") { | ||
console.error('\n %s(1) not executable. try chmod or run with root\n', bin); | ||
} | ||
@@ -419,0 +422,0 @@ }); |
{ | ||
"name": "commander" | ||
, "version": "1.2.0" | ||
, "version": "1.3.0" | ||
, "description": "the complete solution for node.js command-line programs" | ||
@@ -5,0 +5,0 @@ , "keywords": ["command", "option", "parser", "prompt", "stdin"] |
@@ -34,3 +34,3 @@ # Commander.js | ||
if (program.peppers) console.log(' - peppers'); | ||
if (program.pineapple) console.log(' - pineappe'); | ||
if (program.pineapple) console.log(' - pineapple'); | ||
if (program.bbq) console.log(' - bbq'); | ||
@@ -55,3 +55,3 @@ console.log(' - %s cheese', program.cheese); | ||
-p, --peppers Add peppers | ||
-P, --pineapple Add pineappe | ||
-P, --pineapple Add pineapple | ||
-b, --bbq Add bbq sauce | ||
@@ -278,2 +278,2 @@ -c, --cheese <type> Add the specified type of cheese [marble] | ||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
36299
1002
277