mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 00:40:07 +02:00
Merge pull request #510 from Hongarc/args
Fix space-group in <vcs> <command>
This commit is contained in:
commit
95d5a02170
1 changed files with 6 additions and 9 deletions
|
@ -127,11 +127,11 @@ var parse = function(str) {
|
||||||
method = thisMethod;
|
method = thisMethod;
|
||||||
// every valid regex has to have the parts of
|
// every valid regex has to have the parts of
|
||||||
// <vcs> <command> <stuff>
|
// <vcs> <command> <stuff>
|
||||||
// because there are always two spaces
|
// because there are always two space-groups
|
||||||
// before our "stuff" we can simply
|
// before our "stuff" we can simply
|
||||||
// split on spaces and grab everything after
|
// split on space-groups and grab everything after
|
||||||
// the second:
|
// the second:
|
||||||
options = str.split(' ').slice(2).join(' ');
|
options = str.match(/('.*?'|".*?"|\S+)/g).slice(2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -174,11 +174,8 @@ function CommandOptionParser(vcs, method, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandOptionParser.prototype.explodeAndSet = function() {
|
CommandOptionParser.prototype.explodeAndSet = function() {
|
||||||
// TODO -- this is ugly
|
for (var i = 0; i < this.rawOptions.length; i++) {
|
||||||
// split on spaces, except when inside quotes
|
var part = this.rawOptions[i];
|
||||||
var exploded = this.rawOptions.match(/('.*?'|".*?"|\S+)/g) || [];
|
|
||||||
for (var i = 0; i < exploded.length; i++) {
|
|
||||||
var part = exploded[i];
|
|
||||||
|
|
||||||
if (part.slice(0,1) == '-') {
|
if (part.slice(0,1) == '-') {
|
||||||
// it's an option, check supportedMap
|
// it's an option, check supportedMap
|
||||||
|
@ -191,7 +188,7 @@ CommandOptionParser.prototype.explodeAndSet = function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var next = exploded[i + 1];
|
var next = this.rawOptions[i + 1];
|
||||||
var optionArgs = [];
|
var optionArgs = [];
|
||||||
if (next && next.slice(0,1) !== '-') {
|
if (next && next.slice(0,1) !== '-') {
|
||||||
// only store the next argument as this
|
// only store the next argument as this
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue