add a vcs level to the shortcut map

This commit is contained in:
Siddharth Agarwal 2013-07-30 23:50:23 -07:00
parent f14c128174
commit 3c1887f1d0
6 changed files with 34 additions and 38 deletions

View file

@ -9891,17 +9891,13 @@ var commands = {
return commandConfig[name].regex;
},
isCommandSupported: function(name) {
return !!commandConfig[name];
},
getShortcutMap: function() {
var map = {};
this.loop(function(config, name) {
var map = {'git': {}};
this.loop(function(config, name, vcs) {
if (!config.sc) {
return;
}
map['git ' + name] = config.sc;
map[vcs][name] = config.sc;
}, this);
return map;
},
@ -9944,7 +9940,7 @@ var commands = {
},
loop: function(callback, context) {
_.each(commandConfig, callback);
_.each(commandConfig, function (config, name) { callback(config, name, 'git') });
}
};
@ -14288,12 +14284,14 @@ ParseWaterfall.prototype.expandAllShortcuts = function(commandStr) {
};
ParseWaterfall.prototype.expandShortcut = function(commandStr, shortcutMap) {
_.each(shortcutMap, function(regex, method) {
_.each(shortcutMap, function(map, vcs) {
_.each(map, function(regex, method) {
var results = regex.exec(commandStr);
if (results) {
commandStr = method + ' ' + commandStr.slice(results[0].length);
commandStr = vcs + ' ' + method + ' ' + commandStr.slice(results[0].length);
}
});
});
return commandStr;
};
@ -23789,17 +23787,13 @@ var commands = {
return commandConfig[name].regex;
},
isCommandSupported: function(name) {
return !!commandConfig[name];
},
getShortcutMap: function() {
var map = {};
this.loop(function(config, name) {
var map = {'git': {}};
this.loop(function(config, name, vcs) {
if (!config.sc) {
return;
}
map['git ' + name] = config.sc;
map[vcs][name] = config.sc;
}, this);
return map;
},
@ -23842,7 +23836,7 @@ var commands = {
},
loop: function(callback, context) {
_.each(commandConfig, callback);
_.each(commandConfig, function (config, name) { callback(config, name, 'git') });
}
};
@ -28950,12 +28944,14 @@ ParseWaterfall.prototype.expandAllShortcuts = function(commandStr) {
};
ParseWaterfall.prototype.expandShortcut = function(commandStr, shortcutMap) {
_.each(shortcutMap, function(regex, method) {
_.each(shortcutMap, function(map, vcs) {
_.each(map, function(regex, method) {
var results = regex.exec(commandStr);
if (results) {
commandStr = method + ' ' + commandStr.slice(results[0].length);
commandStr = vcs + ' ' + method + ' ' + commandStr.slice(results[0].length);
}
});
});
return commandStr;
};

File diff suppressed because one or more lines are too long

1
build/bundle.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -439,7 +439,7 @@
For a much easier time perusing the source, see the individual files at:
https://github.com/pcottle/learnGitBranching
-->
<script src="build/bundle.min.d1bd189f.js"></script>
<script src="build/bundle.js"></script>
<!-- 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

View file

@ -25,12 +25,12 @@ var commands = {
},
getShortcutMap: function() {
var map = {};
this.loop(function(config, name) {
var map = {'git': {}};
this.loop(function(config, name, vcs) {
if (!config.sc) {
return;
}
map['git ' + name] = config.sc;
map[vcs][name] = config.sc;
}, this);
return map;
},
@ -73,7 +73,7 @@ var commands = {
},
loop: function(callback, context) {
_.each(commandConfig, callback);
_.each(commandConfig, function (config, name) { callback(config, name, 'git') });
}
};

View file

@ -74,12 +74,14 @@ ParseWaterfall.prototype.expandAllShortcuts = function(commandStr) {
};
ParseWaterfall.prototype.expandShortcut = function(commandStr, shortcutMap) {
_.each(shortcutMap, function(regex, method) {
_.each(shortcutMap, function(map, vcs) {
_.each(map, function(regex, method) {
var results = regex.exec(commandStr);
if (results) {
commandStr = method + ' ' + commandStr.slice(results[0].length);
commandStr = vcs + ' ' + method + ' ' + commandStr.slice(results[0].length);
}
});
});
return commandStr;
};