beef up the canon for exec commands and the knowledge of the environment

This commit is contained in:
Joe Walker 2010-11-24 15:56:42 +00:00
commit f6fa510708

View file

@ -68,7 +68,11 @@ var commandExtensionSpec = {
indexOn: "name"
};
var env;
exports.startup = function(data, reason) {
// TODO: this is probably all kinds of evil, but we need something working
env = data.env;
catalog.addExtensionSpec(commandExtensionSpec);
};
@ -105,6 +109,16 @@ exports.getCommands = function() {
return Object.keys(commands);
};
exports.exec = function(name) {
var command = commands[name];
if (command) {
env.selection = env.editor.getSelection();
command.exec(env);
return true;
}
return false;
};
/**
* We publish a 'addedRequestOutput' event whenever new command begins output
* TODO: make this more obvious