Comparing version 1.7.4 to 1.7.5
@@ -57,3 +57,2 @@ var Command, Option, Signature, _; | ||
return exports.state.getMatchCommand(args.command, function(error, command) { | ||
var error1; | ||
if (error != null) { | ||
@@ -60,0 +59,0 @@ return typeof callback === "function" ? callback(error) : void 0; |
@@ -75,3 +75,3 @@ var Command, Option, Signature, _, parse, settings, state, utils; | ||
return _this._checkElevation(function(error, isElevated) { | ||
var error1, parsedOptions; | ||
var parsedOptions; | ||
if (error != null) { | ||
@@ -92,3 +92,2 @@ return typeof callback === "function" ? callback(error) : void 0; | ||
return _this.applyPermissions(function(error) { | ||
var error2; | ||
if (error != null) { | ||
@@ -99,4 +98,4 @@ return typeof callback === "function" ? callback(error) : void 0; | ||
_this.action(params, parsedOptions, callback); | ||
} catch (error2) { | ||
error = error2; | ||
} catch (error1) { | ||
error = error1; | ||
return typeof callback === "function" ? callback(error) : void 0; | ||
@@ -103,0 +102,0 @@ } |
@@ -39,3 +39,6 @@ var Parameter, _, settings, state, yargsParser; | ||
result.options = _.mapValues(options, function(value) { | ||
if (/^\d+(\.\d+)?$/.test(value)) { | ||
if (/^\d+$/.test(value)) { | ||
return parseInt(value); | ||
} | ||
if (/^\d*\.\d+?$/.test(value)) { | ||
return parseFloat(value); | ||
@@ -64,7 +67,8 @@ } | ||
pair = function(arg) { | ||
var end, start; | ||
var end, middle, start; | ||
start = arg[0], end = arg[1]; | ||
start = '\\' + start; | ||
end = '\\' + end; | ||
return regex += start + "[^" + end + "]+" + end + "|"; | ||
middle = '\\\\' + end; | ||
return regex += start + "(?:[^" + middle + "]|\\\\.)*" + end + "|"; | ||
}; | ||
@@ -71,0 +75,0 @@ pair('[]'); |
{ | ||
"name": "capitano", | ||
"version": "1.7.4", | ||
"version": "1.7.5", | ||
"description": "Powerful, non opitionated command line parser for serious applications", | ||
@@ -5,0 +5,0 @@ "main": "build/capitano.js", |
@@ -38,2 +38,7 @@ Capitano | ||
capitano.command | ||
signature: '*' | ||
description: 'Default command that will run when no command is passed' | ||
action: someFunction | ||
capitano.run process.argv, (error) -> | ||
@@ -53,3 +58,3 @@ throw error if error? | ||
We wrote Capitano as we couldn't find any NodeJS command line parser that met our needs. Alternatives such as [commander.js](https://github.com/tj/commander.js), albeit being very good, didn't have good support for features such as infinitely nested git-like subcommands, per-command options and complete customisation. Capitano is our attempt at creating a non opitionated command line parser that can do everything you can imagine. | ||
We wrote Capitano as we couldn't find any NodeJS command line parser that met our needs. Alternatives such as [commander.js](https://github.com/tj/commander.js), albeit being very good, didn't have good support for features such as infinitely nested git-like subcommands, per-command options and complete customisation. Capitano is our attempt at creating a non-opinionated command line parser that can do everything you can imagine. | ||
@@ -174,3 +179,3 @@ Features | ||
### globals (object) | ||
### global (object) | ||
@@ -181,3 +186,3 @@ An object containing the matches and parsed global options. | ||
It accepts a `cli` object (returned by [capitano.parse()](https://github.com/resin-io/capitano#capitanoparseargv)) and | ||
It accepts a `cli` object (returned by [capitano.parse()](https://github.com/resin-io/capitano#capitanoparseargv)) and | ||
executes the corresponding command, with it's corresponding options. | ||
@@ -252,3 +257,3 @@ | ||
#### Command#signature (Signature) | ||
#### Command#signature (Signature) | ||
@@ -293,3 +298,3 @@ See the [Signature class](https://github.com/resin-io/capitano#signature). | ||
#### Option#signature | ||
#### Option#signature | ||
@@ -330,3 +335,3 @@ See [Signature class](https://github.com/resin-io/capitano#signature). | ||
done() | ||
capitano.run process.argv, (error) -> | ||
@@ -366,3 +371,3 @@ throw error if error? | ||
console.log('\nCommands:\n') | ||
for command in capitano.state.commands | ||
@@ -406,3 +411,3 @@ continue if command.isWildcard() | ||
return outputGeneralHelp() if not params? | ||
capitano.state.getMatchCommand params.command, (error, command) -> | ||
@@ -413,6 +418,6 @@ return done(error) if error? | ||
return capitano.defaults.actions.commandNotFound(params.command) | ||
console.log(command.help) | ||
done() | ||
capitano.run process.argv, (error) -> | ||
@@ -440,3 +445,7 @@ throw error if error? | ||
--------- | ||
### 1.7.5 | ||
- Cli: Parse escaped commands correctly | ||
- Add example default command | ||
### 1.7.4 | ||
@@ -443,0 +452,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
143487
779
545
34
1