mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-29 01:10:04 +02:00
fixed bad option parsing
This commit is contained in:
parent
edb4f0dc2a
commit
86cbb19a28
6 changed files with 15 additions and 7 deletions
|
@ -10265,10 +10265,12 @@ var parse = function(str) {
|
||||||
// we support this command!
|
// we support this command!
|
||||||
// parse off the options and assemble the map / general args
|
// parse off the options and assemble the map / general args
|
||||||
var parsedOptions = new CommandOptionParser(vcs, method, options);
|
var parsedOptions = new CommandOptionParser(vcs, method, options);
|
||||||
|
var error = parsedOptions.explodeAndSet();
|
||||||
return {
|
return {
|
||||||
toSet: {
|
toSet: {
|
||||||
generalArgs: parsedOptions.generalArgs,
|
generalArgs: parsedOptions.generalArgs,
|
||||||
supportedMap: parsedOptions.supportedMap,
|
supportedMap: parsedOptions.supportedMap,
|
||||||
|
error: error,
|
||||||
vcs: vcs,
|
vcs: vcs,
|
||||||
method: method,
|
method: method,
|
||||||
options: options,
|
options: options,
|
||||||
|
@ -10291,7 +10293,6 @@ function CommandOptionParser(vcs, method, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.generalArgs = [];
|
this.generalArgs = [];
|
||||||
this.explodeAndSet();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandOptionParser.prototype.explodeAndSet = function() {
|
CommandOptionParser.prototype.explodeAndSet = function() {
|
||||||
|
@ -10304,7 +10305,7 @@ CommandOptionParser.prototype.explodeAndSet = function() {
|
||||||
if (part.slice(0,1) == '-') {
|
if (part.slice(0,1) == '-') {
|
||||||
// it's an option, check supportedMap
|
// it's an option, check supportedMap
|
||||||
if (this.supportedMap[part] === undefined) {
|
if (this.supportedMap[part] === undefined) {
|
||||||
throw new CommandProcessError({
|
return new CommandProcessError({
|
||||||
msg: intl.str(
|
msg: intl.str(
|
||||||
'option-not-supported',
|
'option-not-supported',
|
||||||
{ option: part }
|
{ option: part }
|
||||||
|
@ -14721,6 +14722,7 @@ var Command = Backbone.Model.extend({
|
||||||
|
|
||||||
errorChanged: function() {
|
errorChanged: function() {
|
||||||
var err = this.get('error');
|
var err = this.get('error');
|
||||||
|
if (!err) { return; }
|
||||||
if (err instanceof CommandProcessError ||
|
if (err instanceof CommandProcessError ||
|
||||||
err instanceof GitError) {
|
err instanceof GitError) {
|
||||||
this.set('status', 'error');
|
this.set('status', 'error');
|
||||||
|
@ -24069,10 +24071,12 @@ var parse = function(str) {
|
||||||
// we support this command!
|
// we support this command!
|
||||||
// parse off the options and assemble the map / general args
|
// parse off the options and assemble the map / general args
|
||||||
var parsedOptions = new CommandOptionParser(vcs, method, options);
|
var parsedOptions = new CommandOptionParser(vcs, method, options);
|
||||||
|
var error = parsedOptions.explodeAndSet();
|
||||||
return {
|
return {
|
||||||
toSet: {
|
toSet: {
|
||||||
generalArgs: parsedOptions.generalArgs,
|
generalArgs: parsedOptions.generalArgs,
|
||||||
supportedMap: parsedOptions.supportedMap,
|
supportedMap: parsedOptions.supportedMap,
|
||||||
|
error: error,
|
||||||
vcs: vcs,
|
vcs: vcs,
|
||||||
method: method,
|
method: method,
|
||||||
options: options,
|
options: options,
|
||||||
|
@ -24095,7 +24099,6 @@ function CommandOptionParser(vcs, method, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.generalArgs = [];
|
this.generalArgs = [];
|
||||||
this.explodeAndSet();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandOptionParser.prototype.explodeAndSet = function() {
|
CommandOptionParser.prototype.explodeAndSet = function() {
|
||||||
|
@ -24108,7 +24111,7 @@ CommandOptionParser.prototype.explodeAndSet = function() {
|
||||||
if (part.slice(0,1) == '-') {
|
if (part.slice(0,1) == '-') {
|
||||||
// it's an option, check supportedMap
|
// it's an option, check supportedMap
|
||||||
if (this.supportedMap[part] === undefined) {
|
if (this.supportedMap[part] === undefined) {
|
||||||
throw new CommandProcessError({
|
return new CommandProcessError({
|
||||||
msg: intl.str(
|
msg: intl.str(
|
||||||
'option-not-supported',
|
'option-not-supported',
|
||||||
{ option: part }
|
{ option: part }
|
||||||
|
@ -31062,6 +31065,7 @@ var Command = Backbone.Model.extend({
|
||||||
|
|
||||||
errorChanged: function() {
|
errorChanged: function() {
|
||||||
var err = this.get('error');
|
var err = this.get('error');
|
||||||
|
if (!err) { return; }
|
||||||
if (err instanceof CommandProcessError ||
|
if (err instanceof CommandProcessError ||
|
||||||
err instanceof GitError) {
|
err instanceof GitError) {
|
||||||
this.set('status', 'error');
|
this.set('status', 'error');
|
||||||
|
|
1
build/bundle.min.99b7703b.js
Normal file
1
build/bundle.min.99b7703b.js
Normal file
File diff suppressed because one or more lines are too long
1
build/bundle.min.js
vendored
Normal file
1
build/bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -445,7 +445,7 @@
|
||||||
For a much easier time perusing the source, see the individual files at:
|
For a much easier time perusing the source, see the individual files at:
|
||||||
https://github.com/pcottle/learnGitBranching
|
https://github.com/pcottle/learnGitBranching
|
||||||
-->
|
-->
|
||||||
<script src="build/bundle.js"></script>
|
<script src="build/bundle.min.99b7703b.js"></script>
|
||||||
|
|
||||||
<!-- The advantage of github pages: super-easy, simple, slick static hostic.
|
<!-- The advantage of github pages: super-easy, simple, slick static hostic.
|
||||||
The downside? No raw logs to parse for analytics, so I have to include
|
The downside? No raw logs to parse for analytics, so I have to include
|
||||||
|
|
|
@ -139,10 +139,12 @@ var parse = function(str) {
|
||||||
// we support this command!
|
// we support this command!
|
||||||
// parse off the options and assemble the map / general args
|
// parse off the options and assemble the map / general args
|
||||||
var parsedOptions = new CommandOptionParser(vcs, method, options);
|
var parsedOptions = new CommandOptionParser(vcs, method, options);
|
||||||
|
var error = parsedOptions.explodeAndSet();
|
||||||
return {
|
return {
|
||||||
toSet: {
|
toSet: {
|
||||||
generalArgs: parsedOptions.generalArgs,
|
generalArgs: parsedOptions.generalArgs,
|
||||||
supportedMap: parsedOptions.supportedMap,
|
supportedMap: parsedOptions.supportedMap,
|
||||||
|
error: error,
|
||||||
vcs: vcs,
|
vcs: vcs,
|
||||||
method: method,
|
method: method,
|
||||||
options: options,
|
options: options,
|
||||||
|
@ -165,7 +167,6 @@ function CommandOptionParser(vcs, method, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.generalArgs = [];
|
this.generalArgs = [];
|
||||||
this.explodeAndSet();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandOptionParser.prototype.explodeAndSet = function() {
|
CommandOptionParser.prototype.explodeAndSet = function() {
|
||||||
|
@ -178,7 +179,7 @@ CommandOptionParser.prototype.explodeAndSet = function() {
|
||||||
if (part.slice(0,1) == '-') {
|
if (part.slice(0,1) == '-') {
|
||||||
// it's an option, check supportedMap
|
// it's an option, check supportedMap
|
||||||
if (this.supportedMap[part] === undefined) {
|
if (this.supportedMap[part] === undefined) {
|
||||||
throw new CommandProcessError({
|
return new CommandProcessError({
|
||||||
msg: intl.str(
|
msg: intl.str(
|
||||||
'option-not-supported',
|
'option-not-supported',
|
||||||
{ option: part }
|
{ option: part }
|
||||||
|
|
|
@ -210,6 +210,7 @@ var Command = Backbone.Model.extend({
|
||||||
|
|
||||||
errorChanged: function() {
|
errorChanged: function() {
|
||||||
var err = this.get('error');
|
var err = this.get('error');
|
||||||
|
if (!err) { return; }
|
||||||
if (err instanceof CommandProcessError ||
|
if (err instanceof CommandProcessError ||
|
||||||
err instanceof GitError) {
|
err instanceof GitError) {
|
||||||
this.set('status', 'error');
|
this.set('status', 'error');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue