mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-29 09:20:03 +02:00
fixed bad option parsing
This commit is contained in:
parent
edb4f0dc2a
commit
86cbb19a28
6 changed files with 15 additions and 7 deletions
|
@ -139,10 +139,12 @@ var parse = function(str) {
|
|||
// we support this command!
|
||||
// parse off the options and assemble the map / general args
|
||||
var parsedOptions = new CommandOptionParser(vcs, method, options);
|
||||
var error = parsedOptions.explodeAndSet();
|
||||
return {
|
||||
toSet: {
|
||||
generalArgs: parsedOptions.generalArgs,
|
||||
supportedMap: parsedOptions.supportedMap,
|
||||
error: error,
|
||||
vcs: vcs,
|
||||
method: method,
|
||||
options: options,
|
||||
|
@ -165,7 +167,6 @@ function CommandOptionParser(vcs, method, options) {
|
|||
}
|
||||
|
||||
this.generalArgs = [];
|
||||
this.explodeAndSet();
|
||||
}
|
||||
|
||||
CommandOptionParser.prototype.explodeAndSet = function() {
|
||||
|
@ -178,7 +179,7 @@ CommandOptionParser.prototype.explodeAndSet = function() {
|
|||
if (part.slice(0,1) == '-') {
|
||||
// it's an option, check supportedMap
|
||||
if (this.supportedMap[part] === undefined) {
|
||||
throw new CommandProcessError({
|
||||
return new CommandProcessError({
|
||||
msg: intl.str(
|
||||
'option-not-supported',
|
||||
{ option: part }
|
||||
|
|
|
@ -210,6 +210,7 @@ var Command = Backbone.Model.extend({
|
|||
|
||||
errorChanged: function() {
|
||||
var err = this.get('error');
|
||||
if (!err) { return; }
|
||||
if (err instanceof CommandProcessError ||
|
||||
err instanceof GitError) {
|
||||
this.set('status', 'error');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue