Commit c8b23aed authored by Feng Xue's avatar Feng Xue
Browse files

add execution time to help command

parent 77f178cb
...@@ -196,14 +196,11 @@ function CommandExecutor() { ...@@ -196,14 +196,11 @@ function CommandExecutor() {
}); });
}, },
helpCommands = Object.keys(helpTexts); helpCommands = Object.keys(helpTexts).sort();
helpCommands.sort(); /*jslint sub: true */
helpCommands.forEach(function (helpCommand) { helpTexts["help"].description = [helpTexts["help"].description, helpCommands];
/*jslint sub: true */ /*jslint sub: false */
helpTexts["help"].description += " " + helpCommand;
/*jslint sub: false */
});
return { return {
//Eww! This method should not be exported, but it has to be done to //Eww! This method should not be exported, but it has to be done to
...@@ -219,14 +216,19 @@ function CommandExecutor() { ...@@ -219,14 +216,19 @@ function CommandExecutor() {
}, },
execute: function (parserObject, controllerUrl, sessionId, callbackFun, errorFun) { execute: function (parserObject, controllerUrl, sessionId, callbackFun, errorFun) {
var intermediateResult, helpText; var intermediateResult,
helpText,
timeBeforeExecute = (new Date()).getTime();
switch (parserObject.type) { switch (parserObject.type) {
case "help": case "help":
helpText = helpTexts[parserObject.helpTopic || "help"]; helpText = helpTexts[parserObject.helpTopic || "help"];
intermediateResult = new Promise(function (resolve) { intermediateResult = new Promise(function (resolve) {
resolve(helpText ? resolve(helpText ?
{result: helpText} : {
result: helpText,
runTimeMillis: (new Date()).getTime() - timeBeforeExecute || 1
} :
{error: { type: "NO_RESULT", message: "Got no result"}} {error: { type: "NO_RESULT", message: "Got no result"}}
); );
}); });
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment