From ce53fbc8487b41a1dc350d720d93da2ae14d23d0 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 20 May 2014 07:18:51 -0400 Subject: [PATCH] refactor(console) onCloudCmd --- lib/server/console.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/server/console.js b/lib/server/console.js index 192658b0..31caff48 100644 --- a/lib/server/console.js +++ b/lib/server/console.js @@ -241,20 +241,19 @@ } } - function onCloudCmd(pCommand, callback) { - var lRet; + function onCloudCmd(cmd, callback) { + var is; - pCommand = Util.rmStr(pCommand, CLOUDCMD); + cmd = Util.rmStr(cmd, CLOUDCMD); + is = !equalPart(cmd, ' '); - if (!equalPart(pCommand, ' ')) { - lRet = true; + if (is) { Util.exec(callback, HELP); - } - else { - pCommand = Util.rmStr(pCommand, ' '); + } else { + cmd = Util.rmStr(cmd, ' '); + is = update && equalPart(cmd, 'update'); - if (equalPart(pCommand, 'update') && update) { - lRet = true; + if (is) { update.get(); Util.exec(callback, { @@ -262,11 +261,13 @@ }); } - if (Util.strCmp(pCommand, 'exit')) + is = Util.strCmp(cmd, 'exit'); + + if (is) process.exit(); } - return lRet; + return is; } function onCD(cmd, currDir, callback) {