This is an automated email from the ASF dual-hosted git repository. yuyuankang pushed a commit to branch kyy in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
commit 7fb21c3d96c27608a38485902f43a5f27dcc300a Author: Ring-k <[email protected]> AuthorDate: Fri May 29 18:09:21 2020 +0800 remove echo --- cli/src/main/java/org/apache/iotdb/cli/Cli.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cli/src/main/java/org/apache/iotdb/cli/Cli.java b/cli/src/main/java/org/apache/iotdb/cli/Cli.java index dc0e967..e3942a5 100644 --- a/cli/src/main/java/org/apache/iotdb/cli/Cli.java +++ b/cli/src/main/java/org/apache/iotdb/cli/Cli.java @@ -21,6 +21,7 @@ package org.apache.iotdb.cli; import java.io.IOException; import java.sql.DriverManager; import java.sql.SQLException; +import java.util.Scanner; import jline.console.ConsoleReader; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; @@ -108,16 +109,15 @@ public class Cli extends AbstractCli { } private static void serve() { - try (ConsoleReader reader = new ConsoleReader()) { - reader.setExpandEvents(false); - + try (Scanner scanner = new Scanner(System.in)) { host = checkRequiredArg(HOST_ARGS, HOST_NAME, commandLine, false, host); port = checkRequiredArg(PORT_ARGS, PORT_NAME, commandLine, false, port); username = checkRequiredArg(USERNAME_ARGS, USERNAME_NAME, commandLine, true, null); password = commandLine.getOptionValue(PASSWORD_ARGS); if (password == null) { - password = reader.readLine("please input your password:", '\0'); + print("please input your password:"); + password = scanner.nextLine(); } if (hasExecuteSQL) { try (IoTDBConnection connection = (IoTDBConnection) DriverManager @@ -131,7 +131,7 @@ public class Cli extends AbstractCli { } } - receiveCommands(reader); + receiveCommands(scanner); } catch (ArgsErrorException e) { println(IOTDB_CLI_PREFIX + "> input params error because" + e.getMessage()); } catch (Exception e) { @@ -139,7 +139,7 @@ public class Cli extends AbstractCli { } } - private static void receiveCommands(ConsoleReader reader) throws TException, IOException { + private static void receiveCommands(Scanner scanner) throws TException, IOException { try (IoTDBConnection connection = (IoTDBConnection) DriverManager .getConnection(Config.IOTDB_URL_PREFIX + host + ":" + port + "/", username, password)) { String s; @@ -151,7 +151,8 @@ public class Cli extends AbstractCli { displayLogo(properties.getVersion()); println(IOTDB_CLI_PREFIX + "> login successfully"); while (true) { - s = reader.readLine(IOTDB_CLI_PREFIX + "> ", null); + print(IOTDB_CLI_PREFIX + "> "); + s = scanner.nextLine(); boolean continues = processCommand(s, connection); if (!continues) { break;
