From f6fa5107082e72fd19f14030a49fb030c6a64e9f Mon Sep 17 00:00:00 2001 From: Joe Walker Date: Wed, 24 Nov 2010 15:56:42 +0000 Subject: [PATCH] beef up the canon for exec commands and the knowledge of the environment --- plugins/pilot/lib/canon.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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