moving around

This commit is contained in:
Peter Cottle 2013-01-02 11:14:46 -08:00
parent a180426cfb
commit 4046916432
8 changed files with 317 additions and 209 deletions

View file

@ -5,20 +5,44 @@ var SandboxCommands = require('../level/SandboxCommands');
// more or less a static class
function ParseWaterfall(options) {
this.shortcutWaterfall = [
this.shortcutWaterfall = options.shortcutWaterfall || [
GitCommands.shortcutMap
];
this.instantWaterfall = [
this.instantWaterfall = options.instantWaterfall || [
GitCommands.instantCommands,
SandboxCommands.instantCommands
];
this.parseWaterfall = [
this.parseWaterfall = options.parseWaterfall || [
GitCommands.parse
];
}
ParseWaterfall.prototype.clone = function() {
return new ParseWaterfall({
shortcutWaterfall: this.shortcutWaterfall.slice(),
instantWaterfall: this.instantWaterfall.slice(),
parseWaterfall: this.parseWaterfall.slice()
});
};
ParseWaterfall.prototype.getWaterfallMap = function() {
return {
shortcutWaterfall: this.shortcutWaterfall,
instantWaterfall: this.instantWaterfall,
parseWaterfall: this.parseWaterfall
};
};
ParseWaterfall.prototype.addFirst = function(which, value) {
this.getWaterfallMap()[which].unshift(value);
};
ParseWaterfall.prototype.addLast = function(which, value) {
this.getWaterfallMap()[which].push(value);
};
ParseWaterfall.prototype.expandAllShortcuts = function(commandStr) {
_.each(this.shortcutWaterfall, function(shortcutMap) {
commandStr = this.expandShortcut(commandStr, shortcutMap);