diff --git a/core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleStateManager.java b/core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleStateManager.java index 0caa94cc7417b..6b891851e5ddc 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleStateManager.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleStateManager.java @@ -100,6 +100,11 @@ public static void init(QuarkusConsole console, DevModeType devModeType) { } void installBuiltins(DevModeType devModeType) { + final String editPromptFormat = "to edit command line args (currently '" + + MessageFormat.GREEN + + "%s" + + MessageFormat.RESET + + "')"; ConsoleContext context = createContext("System"); List commands = new ArrayList<>(); if (devModeType != DevModeType.TEST_ONLY) { @@ -107,9 +112,8 @@ void installBuiltins(DevModeType devModeType) { forceRestart(); })); commands.add(new ConsoleCommand('e', "Edits the command line parameters and restarts", - "to edit command line args (currently '" + MessageFormat.GREEN - + String.join(" ", RuntimeUpdatesProcessor.INSTANCE.getCommandLineArgs()) + MessageFormat.RESET - + "')", + editPromptFormat.formatted(String.join(" ", + RuntimeUpdatesProcessor.INSTANCE.getCommandLineArgs())), 100, new ConsoleCommand.HelpState(() -> BLUE, () -> String.join(" ", RuntimeUpdatesProcessor.INSTANCE.getCommandLineArgs())), new Consumer() { @@ -122,12 +126,10 @@ public void accept(String args) { Logger.getLogger(ConsoleStateManager.class).errorf(e, "Failed to parse command line %s", args); return; } - // Reload command + // Reload command prompt string context.reset(ConsoleCommand.duplicateCommandWithNewPromptString(context.getCommandByKey('e'), - "to edit command line args (currently '" + MessageFormat.GREEN - + String.join(" ", RuntimeUpdatesProcessor.INSTANCE.getCommandLineArgs()) - + MessageFormat.RESET - + "')")); + editPromptFormat.formatted(String.join(" ", + RuntimeUpdatesProcessor.INSTANCE.getCommandLineArgs())))); RuntimeUpdatesProcessor.INSTANCE.doScan(true, true); } }));