This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit 6031d7a0b72ecd9daa9cdae22c52874b16b4e1be Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Tue Dec 12 10:39:41 2023 +0100 Echo the SIS command in faint mode. --- .../main/org/apache/sis/console/Command.java | 12 ++++++++++++ .../main/org/apache/sis/console/SIS.java | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/Command.java b/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/Command.java index 530ad9a788..2d9d882e3b 100644 --- a/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/Command.java +++ b/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/Command.java @@ -271,6 +271,18 @@ public final class Command { return error ? command.err : command.out; } + /** + * Turns on or off the faint output, if supported. + * This method does nothing if the terminal does not seem to support X364 sequences. + * + * @param faint whether to turn on the faint output. + */ + final void setFaintOutput(final boolean faint) { + if (command.colors) { + command.out.write((faint ? X364.FAINT : X364.NORMAL).sequence()); + } + } + /** * Runs the command. If an exception occurs, then the exception message is sent to the error output stream * before to be thrown. Callers can map the exception to a {@linkplain System#exit(int) system exit code} diff --git a/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/SIS.java b/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/SIS.java index b6f6d15934..1f864f03d9 100644 --- a/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/SIS.java +++ b/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/SIS.java @@ -178,7 +178,8 @@ public final class SIS extends Static { */ var c = new Command(allArgs); final PrintWriter out = c.writer(false); - out.print("> sis"); + c.setFaintOutput(true); + out.print("command> sis"); for (i=0; i < allArgs.length; i++) { final String arg = allArgs[i].toString(); final int start = arg.startsWith(Option.PREFIX) ? Option.PREFIX.length() : 0; @@ -188,6 +189,7 @@ public final class SIS extends Static { out.print(arg.replace("\"", "\\\"")); if (quote) out.print('"'); } + c.setFaintOutput(false); out.println(); int status = c.run(); if (status != 0) {