Updated Branches: refs/heads/master 3d27c14d4 -> 313523d49
STRATOS-414 - [CLI] A Tenant can see the command history of super admin and other tenants Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/313523d4 Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/313523d4 Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/313523d4 Branch: refs/heads/master Commit: 313523d49d11cd32d67a821c9677d891b59b16ed Parents: 3d27c14 Author: Manula Thantriwatte <[email protected]> Authored: Mon Feb 10 17:06:33 2014 +0530 Committer: Manula Thantriwatte <[email protected]> Committed: Mon Feb 10 17:06:33 2014 +0530 ---------------------------------------------------------------------- .../apache/stratos/cli/commands/ExitCommand.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/313523d4/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ExitCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ExitCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ExitCommand.java index 646b685..412b125 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ExitCommand.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ExitCommand.java @@ -19,13 +19,18 @@ package org.apache.stratos.cli.commands; import org.apache.commons.cli.Options; -import org.slf4j.Logger; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.stratos.cli.Command; import org.apache.stratos.cli.StratosCommandContext; import org.apache.stratos.cli.exception.CommandException; import org.apache.stratos.cli.utils.CliConstants; +import java.io.File; + +import static org.apache.stratos.cli.utils.CliConstants.STRATOS_DIR; +import static org.apache.stratos.cli.utils.CliConstants.STRATOS_HISTORY_DIR; + public class ExitCommand implements Command<StratosCommandContext> { private static final Logger logger = LoggerFactory.getLogger(ExitCommand.class); @@ -55,6 +60,18 @@ public class ExitCommand implements Command<StratosCommandContext> { logger.debug("Executing {} command...", getName()); } if (args == null || args.length == 0) { + // Delete the command history file on exit + File stratosFile = new File(System.getProperty("user.home"), STRATOS_DIR); + File historyFile = new File(stratosFile, STRATOS_HISTORY_DIR); + + historyFile.deleteOnExit(); + + if(historyFile.delete()){ + logger.debug(historyFile.getName() + " is deleted!"); + }else{ + logger.debug("Delete operation is failed."); + } + return CliConstants.SUCCESSFUL_CODE; } else { context.getStratosApplication().printUsage(getName());
