From 46632988cfccf93c2d1cdd26bd33d91c7dde2c8c Mon Sep 17 00:00:00 2001 From: Peter Cottle Date: Sat, 20 Oct 2012 23:20:23 -0700 Subject: [PATCH] fixed that escaping thing i think --- src/commandModel.js | 3 ++- src/commandViews.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/commandModel.js b/src/commandModel.js index ab708d65..a20910b7 100644 --- a/src/commandModel.js +++ b/src/commandModel.js @@ -274,7 +274,8 @@ OptionParser.prototype.explodeAndSet = function() { // inside var exploded = this.rawOptions.match(/('.*?'|".*?"|\S+)/g) || []; _.each(exploded, function(part, i) { - exploded[i] = part.replace(/['"]/g, ''); + exploded[i] = part.replace(/^['"]|['"]$/g, ''); + console.log(exploded[i]); }); for (var i = 0; i < exploded.length; i++) { diff --git a/src/commandViews.js b/src/commandViews.js index 19d68e91..86393d7f 100644 --- a/src/commandViews.js +++ b/src/commandViews.js @@ -168,14 +168,14 @@ var CommandPromptView = Backbone.View.extend({ // split commands on semicolon _.each(value.split(';'), _.bind(function(command, index) { + command = _.escape(command); + command = command .replace(/^(\s+)/, '') .replace(/(\s+)$/, '') .replace(/"/g, '"') .replace(/'/g, "'"); - command = _.escape(command); - if (index > 0 && !command.length) { return; }