diff --git a/plugins/pilot/lib/canon.js b/plugins/pilot/lib/canon.js index c9cd67e4..f5bcee2c 100644 --- a/plugins/pilot/lib/canon.js +++ b/plugins/pilot/lib/canon.js @@ -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