Skip to content

Commit

Permalink
Minor adjustments
Browse files Browse the repository at this point in the history
Signed-off-by: Maciej Lisowski <[email protected]>
(cherry picked from commit f6671c0)
  • Loading branch information
MaciejDromin authored and gsmet committed Jan 23, 2024
1 parent ccc23f4 commit be0ecce
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,20 @@ 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<ConsoleCommand> commands = new ArrayList<>();
if (devModeType != DevModeType.TEST_ONLY) {
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
+ "')",
editPromptFormat.formatted(String.join(" ",
RuntimeUpdatesProcessor.INSTANCE.getCommandLineArgs())),
100, new ConsoleCommand.HelpState(() -> BLUE,
() -> String.join(" ", RuntimeUpdatesProcessor.INSTANCE.getCommandLineArgs())),
new Consumer<String>() {
Expand All @@ -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);
}
}));
Expand Down

0 comments on commit be0ecce

Please sign in to comment.