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 e6671d5ae3516c..5c5ede777a4fc5 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 @@ -26,10 +26,13 @@ import java.util.logging.Level; import java.util.stream.Collectors; +import org.jboss.logging.Logger; import org.jboss.logmanager.LogManager; import io.quarkus.deployment.dev.RuntimeUpdatesProcessor; +import io.quarkus.deployment.dev.testing.MessageFormat; import io.quarkus.deployment.dev.testing.TestSupport; +import io.quarkus.deployment.util.CommandLineUtil; import io.quarkus.dev.console.QuarkusConsole; import io.quarkus.dev.spi.DevModeType; @@ -97,6 +100,25 @@ void installBuiltins(DevModeType devModeType) { commands.add(new ConsoleCommand('s', "Force restart", null, () -> { 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 + + "')", + 100, new ConsoleCommand.HelpState(() -> BLUE, + () -> String.join(" ", RuntimeUpdatesProcessor.INSTANCE.getCommandLineArgs())), + new Consumer() { + @Override + public void accept(String args) { + try { + RuntimeUpdatesProcessor.INSTANCE.setCommandLineArgs( + CommandLineUtil.translateCommandline(args)); + } catch (Exception e) { + Logger.getLogger(ConsoleStateManager.class).errorf(e, "Failed to parse command line %s", args); + return; + } + RuntimeUpdatesProcessor.INSTANCE.doScan(true, true); + } + })); commands.add(new ConsoleCommand('i', "Toggle instrumentation based reload", new ConsoleCommand.HelpState(() -> RuntimeUpdatesProcessor.INSTANCE.instrumentationEnabled()), () -> { diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java index 2f0a5402a4bc6b..745e6a94317b29 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java @@ -1,7 +1,5 @@ package io.quarkus.deployment.dev; -import static io.quarkus.deployment.dev.testing.MessageFormat.BLUE; - import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.Closeable; @@ -42,10 +40,8 @@ import io.quarkus.deployment.builditem.ApplicationClassPredicateBuildItem; import io.quarkus.deployment.console.ConsoleCommand; import io.quarkus.deployment.console.ConsoleStateManager; -import io.quarkus.deployment.dev.testing.MessageFormat; import io.quarkus.deployment.dev.testing.TestSupport; import io.quarkus.deployment.steps.ClassTransformingBuildStep; -import io.quarkus.deployment.util.CommandLineUtil; import io.quarkus.dev.appstate.ApplicationStartException; import io.quarkus.dev.console.DevConsoleManager; import io.quarkus.dev.spi.DeploymentFailedStartHandler; @@ -110,27 +106,7 @@ public void accept(Integer integer) { () -> { consoleContext.reset(); RuntimeUpdatesProcessor.INSTANCE.doScan(true, true); - }), - new ConsoleCommand('e', "Edits the command line parameters and restarts", - "to edit command line args (currently '" + MessageFormat.GREEN - + String.join(" ", context.getArgs()) + MessageFormat.RESET + "')", - 100, new ConsoleCommand.HelpState(() -> BLUE, - () -> String.join(" ", context.getArgs())), - new Consumer() { - @Override - public void accept(String args) { - try { - context.setArgs( - CommandLineUtil.translateCommandline(args)); - } catch (Exception e) { - log.error("Failed to parse command line", e); - return; - } - consoleContext.reset(); - RuntimeUpdatesProcessor.INSTANCE.doScan(true, true); - } - })); - + })); } }); diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java index 63dad57889b286..d51d8ffcd6d24e 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java @@ -1237,4 +1237,12 @@ public void merge(TimestampSet other) { } } + public String[] getCommandLineArgs() { + return context.getArgs(); + } + + public RuntimeUpdatesProcessor setCommandLineArgs(String[] commandLineArgs) { + this.context.setArgs(commandLineArgs); + return this; + } }