diff options
| author | Kostya <mail@sartin.in> | 2026-08-18 07:37:50 +0000 |
|---|---|---|
| committer | Kostya <mail@sartin.in> | 2026-08-18 07:37:50 +0000 |
| commit | 06edeec70b59357657fab0da144e79a96671c749 (patch) | |
| tree | 02851f95554510c3730516fe3a1389e4536ba896 /ui-console/src/main/java/market/guess/ui | |
| parent | df265dea8b0ddf3ce073f5654229f41e6240e2cb (diff) | |
| download | guess-market-06edeec70b59357657fab0da144e79a96671c749.tar.gz guess-market-06edeec70b59357657fab0da144e79a96671c749.tar.xz guess-market-06edeec70b59357657fab0da144e79a96671c749.zip | |
Fix menu wording and reprint prompt on retry
Rename "option"/"but order" wording to "market"/"buy order", add a
blank line before the command prompt, and reprint the prompt text on
readInt() retries instead of leaving the user without context.
Diffstat (limited to 'ui-console/src/main/java/market/guess/ui')
4 files changed, 5 insertions, 4 deletions
diff --git a/ui-console/src/main/java/market/guess/ui/console/Menu.java b/ui-console/src/main/java/market/guess/ui/console/Menu.java index 9041590..b18d6fb 100644 --- a/ui-console/src/main/java/market/guess/ui/console/Menu.java +++ b/ui-console/src/main/java/market/guess/ui/console/Menu.java | |||
| @@ -26,6 +26,7 @@ public final class Menu implements Startable { | |||
| 26 | for (var command : commands) { | 26 | for (var command : commands) { |
| 27 | io.println(" [%d]->> %s".formatted(command.getIndex(), command.getName())); | 27 | io.println(" [%d]->> %s".formatted(command.getIndex(), command.getName())); |
| 28 | } | 28 | } |
| 29 | io.newLine(); | ||
| 29 | var selection = io.readInt("Choose a command: ", 1, max); | 30 | var selection = io.readInt("Choose a command: ", 1, max); |
| 30 | var commandOptional = commands.stream().filter(c -> c.getIndex() == selection).findFirst(); | 31 | var commandOptional = commands.stream().filter(c -> c.getIndex() == selection).findFirst(); |
| 31 | 32 | ||
diff --git a/ui-console/src/main/java/market/guess/ui/console/command/PlaceOrderMenuCommand.java b/ui-console/src/main/java/market/guess/ui/console/command/PlaceOrderMenuCommand.java index 6c2e674..a03f757 100644 --- a/ui-console/src/main/java/market/guess/ui/console/command/PlaceOrderMenuCommand.java +++ b/ui-console/src/main/java/market/guess/ui/console/command/PlaceOrderMenuCommand.java | |||
| @@ -26,7 +26,7 @@ public final class PlaceOrderMenuCommand implements MenuCommand { | |||
| 26 | 26 | ||
| 27 | @Override | 27 | @Override |
| 28 | public String getName() { | 28 | public String getName() { |
| 29 | return "Create a but order on an event"; | 29 | return "Place a buy order on an event"; |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | @Override | 32 | @Override |
diff --git a/ui-console/src/main/java/market/guess/ui/console/command/SettleEventMenuCommand.java b/ui-console/src/main/java/market/guess/ui/console/command/SettleEventMenuCommand.java index 8cc7b02..3ab28a7 100644 --- a/ui-console/src/main/java/market/guess/ui/console/command/SettleEventMenuCommand.java +++ b/ui-console/src/main/java/market/guess/ui/console/command/SettleEventMenuCommand.java | |||
| @@ -56,12 +56,12 @@ public final class SettleEventMenuCommand implements MenuCommand { | |||
| 56 | io.printState(event.state()); | 56 | io.printState(event.state()); |
| 57 | 57 | ||
| 58 | var winner = | 58 | var winner = |
| 59 | io.readSelect("Which option won? ", event.state().markets(), o -> "%s".formatted(o.name())); | 59 | io.readSelect("Which market won? ", event.state().markets(), o -> "%s".formatted(o.name())); |
| 60 | 60 | ||
| 61 | var settleResult = context.settleEvent("Tester", event.summary().key(), winner.key()); | 61 | var settleResult = context.settleEvent("Tester", event.summary().key(), winner.key()); |
| 62 | if (settleResult.isSuccess()) { | 62 | if (settleResult.isSuccess()) { |
| 63 | io.newLine(); | 63 | io.newLine(); |
| 64 | io.println("Settled. Winning option: %s".formatted(settleResult.getData().winningOption())); | 64 | io.println("Settled. Winning market: %s".formatted(settleResult.getData().winningOption())); |
| 65 | return; | 65 | return; |
| 66 | } | 66 | } |
| 67 | io.newLine(); | 67 | io.newLine(); |
diff --git a/ui-console/src/main/java/market/guess/ui/console/io/InputProcessor.java b/ui-console/src/main/java/market/guess/ui/console/io/InputProcessor.java index 512fdfe..721cf8b 100644 --- a/ui-console/src/main/java/market/guess/ui/console/io/InputProcessor.java +++ b/ui-console/src/main/java/market/guess/ui/console/io/InputProcessor.java | |||
| @@ -73,7 +73,7 @@ public final class InputProcessor { | |||
| 73 | 73 | ||
| 74 | public int readInt(String prompt, int min, int max) { | 74 | public int readInt(String prompt, int min, int max) { |
| 75 | while (true) { | 75 | while (true) { |
| 76 | var raw = nextLine(); | 76 | var raw = readLine(prompt); |
| 77 | if (raw.isBlank()) { | 77 | if (raw.isBlank()) { |
| 78 | println("Please enter a number between %d and %d.".formatted(min, max)); | 78 | println("Please enter a number between %d and %d.".formatted(min, max)); |
| 79 | continue; | 79 | continue; |