diff --git a/convex-cli/src/main/java/convex/cli/ACommand.java b/convex-cli/src/main/java/convex/cli/ACommand.java index 3e0c051b1..ba1737253 100644 --- a/convex-cli/src/main/java/convex/cli/ACommand.java +++ b/convex-cli/src/main/java/convex/cli/ACommand.java @@ -1,5 +1,6 @@ package convex.cli; +import java.io.Console; import java.util.Scanner; import convex.cli.output.Coloured; @@ -94,6 +95,17 @@ public String prompt(String string) { return s; } } + + public char[] readPassword(String prompt) { + Console c = System.console(); + if (c == null) { + throw new CLIError( + "Unable to request password because console is unavaiable. Consider passing a password parameter, or running in interactive mode."); + } + + if (isColoured()) prompt = Coloured.blue(prompt); + return c.readPassword(prompt); + } /** * Checks if the CLI should output ANSI colours diff --git a/convex-cli/src/main/java/convex/cli/Main.java b/convex-cli/src/main/java/convex/cli/Main.java index f012ca7f2..3f9f1129e 100644 --- a/convex-cli/src/main/java/convex/cli/Main.java +++ b/convex-cli/src/main/java/convex/cli/Main.java @@ -1,6 +1,5 @@ package convex.cli; -import java.io.Console; import java.io.File; import java.io.IOException; import java.io.PrintWriter; @@ -334,16 +333,7 @@ public boolean isInteractive() { return !nonInteractive; } - public char[] readPassword(String prompt) { - Console c = System.console(); - if (c == null) { - throw new CLIError( - "Unable to request password because console is unavaiable. Consider passing a password parameter, or running in interactive mode."); - } - - if (!noColour) prompt = Coloured.blue(prompt); - return c.readPassword(prompt); - } + public void informSuccess(String message) { inform(1, noColour?message:Coloured.green(message));