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; return commandConfig[name].regex;
}, },
isCommandSupported: function(name) {
return !!commandConfig[name];
},
getShortcutMap: function() { getShortcutMap: function() {
var map = {}; var map = {'git': {}};
this.loop(function(config, name) { this.loop(function(config, name, vcs) {
if (!config.sc) { if (!config.sc) {
return; return;
} }
map['git ' + name] = config.sc; map[vcs][name] = config.sc;
}, this); }, this);
return map; return map;
}, },
@ -9944,7 +9940,7 @@ var commands = {
}, },
loop: function(callback, context) { 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) { 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); var results = regex.exec(commandStr);
if (results) { if (results) {
commandStr = method + ' ' + commandStr.slice(results[0].length); commandStr = vcs + ' ' + method + ' ' + commandStr.slice(results[0].length);
} }
}); });
});
return commandStr; return commandStr;
}; };
@ -23789,17 +23787,13 @@ var commands = {
return commandConfig[name].regex; return commandConfig[name].regex;
}, },
isCommandSupported: function(name) {
return !!commandConfig[name];
},
getShortcutMap: function() { getShortcutMap: function() {
var map = {}; var map = {'git': {}};
this.loop(function(config, name) { this.loop(function(config, name, vcs) {
if (!config.sc) { if (!config.sc) {
return; return;
} }
map['git ' + name] = config.sc; map[vcs][name] = config.sc;
}, this); }, this);
return map; return map;
}, },
@ -23842,7 +23836,7 @@ var commands = {
}, },
loop: function(callback, context) { 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) { 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); var results = regex.exec(commandStr);
if (results) { if (results) {
commandStr = method + ' ' + commandStr.slice(results[0].length); commandStr = vcs + ' ' + method + ' ' + commandStr.slice(results[0].length);
} }
}); });
});
return commandStr; 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: 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.min.d1bd189f.js"></script> <script src="build/bundle.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

View file

@ -25,12 +25,12 @@ var commands = {
}, },
getShortcutMap: function() { getShortcutMap: function() {
var map = {}; var map = {'git': {}};
this.loop(function(config, name) { this.loop(function(config, name, vcs) {
if (!config.sc) { if (!config.sc) {
return; return;
} }
map['git ' + name] = config.sc; map[vcs][name] = config.sc;
}, this); }, this);
return map; return map;
}, },
@ -73,7 +73,7 @@ var commands = {
}, },
loop: function(callback, context) { 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) { 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); var results = regex.exec(commandStr);
if (results) { if (results) {
commandStr = method + ' ' + commandStr.slice(results[0].length); commandStr = vcs + ' ' + method + ' ' + commandStr.slice(results[0].length);
} }
}); });
});
return commandStr; return commandStr;
}; };