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() {
});
},
helpCommands = Object.keys(helpTexts);
helpCommands = Object.keys(helpTexts).sort();
helpCommands.sort();
helpCommands.forEach(function (helpCommand) {
/*jslint sub: true */
helpTexts["help"].description += " " + helpCommand;
/*jslint sub: false */
});
/*jslint sub: true */
helpTexts["help"].description = [helpTexts["help"].description, helpCommands];
/*jslint sub: false */
return {
//Eww! This method should not be exported, but it has to be done to
......@@ -219,14 +216,19 @@ function CommandExecutor() {
},
execute: function (parserObject, controllerUrl, sessionId, callbackFun, errorFun) {
var intermediateResult, helpText;
var intermediateResult,
helpText,
timeBeforeExecute = (new Date()).getTime();
switch (parserObject.type) {
case "help":
helpText = helpTexts[parserObject.helpTopic || "help"];
intermediateResult = new Promise(function (resolve) {
resolve(helpText ?
{result: helpText} :
{
result: helpText,
runTimeMillis: (new Date()).getTime() - timeBeforeExecute || 1
} :
{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