@@ -62,7 +62,4 @@ (function() { | ||
| CliOption.prototype._formatOptionWithArgs = function() { | ||
| var args, argsString; | ||
| args = _.map(this.args, (function(s) { | ||
| return Util.surroundSingleQuote(s); | ||
| })); | ||
| argsString = Util.quoteAll(args).join(' '); | ||
| var argsString; | ||
| argsString = Util.quoteAll(this.args, true).join(' '); | ||
| if (this.option.length === 1) { | ||
@@ -69,0 +66,0 @@ return "-" + this.option + " " + argsString; |
+7
-7
@@ -43,5 +43,2 @@ (function() { | ||
| }, | ||
| surroundSingleQuote: function(s) { | ||
| return s.replace(/'/g, "'\"'\"'"); | ||
| }, | ||
| quote: function(value, escape) { | ||
@@ -52,10 +49,13 @@ if (escape == null) { | ||
| if (escape) { | ||
| value = value.replace(/'/g, "\\'"); | ||
| value = value.replace(/"/g, "\\\""); | ||
| } | ||
| return "'" + value + "'"; | ||
| return "\"" + value + "\""; | ||
| }, | ||
| quoteAll: function(values) { | ||
| quoteAll: function(values, escape) { | ||
| if (escape == null) { | ||
| escape = false; | ||
| } | ||
| return _.map(values, (function(_this) { | ||
| return function(value) { | ||
| return _this.quote(value); | ||
| return _this.quote(value, escape); | ||
| }; | ||
@@ -62,0 +62,0 @@ })(this)); |
+1
-1
| { | ||
| "name": "git-cli", | ||
| "version": "0.8.2", | ||
| "version": "0.8.3", | ||
| "description": "Simple CLI like git interface for NodeJS", | ||
@@ -5,0 +5,0 @@ "main": "lib/git-cli.js", |
| (function() { | ||
| var CliOption, CliOptions, Util, _; | ||
| _ = require('underscore'); | ||
| Util = require('./util'); | ||
| CliOption = require('./cli-option'); | ||
| CliOptions = (function() { | ||
| function CliOptions(options) { | ||
| Util.checkArgs(options, [Array, Object]); | ||
| if (!_.isArray(options)) { | ||
| options = _.pairs(options); | ||
| } | ||
| this.options = _.map(options, ((function(_this) { | ||
| return function(opt) { | ||
| return _this._initOption(opt); | ||
| }; | ||
| })(this))); | ||
| } | ||
| CliOptions.prototype._initOption = function(option) { | ||
| Util.checkArgs(option, [Array, CliOption]); | ||
| if (Util.isSameType(option, CliOption)) { | ||
| return option; | ||
| } | ||
| if (option.length !== 2) { | ||
| throw new TypeError("options object should be a single key/value pair"); | ||
| } | ||
| if (_.isUndefined(option[1]) || option[1] === '') { | ||
| return new CliOption(option[0]); | ||
| } else { | ||
| return new CliOption(option[0], option[1]); | ||
| } | ||
| }; | ||
| return CliOptions; | ||
| })(); | ||
| }).call(this); |
| (function() { | ||
| var Runner; | ||
| Runner = { | ||
| execute: function(command, options) {} | ||
| }; | ||
| }).call(this); |
| (function() { | ||
| var Git; | ||
| Git = { | ||
| bin: "/usr/bin/git", | ||
| execute: function(command, options) {} | ||
| }; | ||
| }).call(this); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
26634
-68.79%19
-20.83%645
-7.19%