From 50ac6eec06c4eef3f1c205dfd32a04350b9e3b48 Mon Sep 17 00:00:00 2001 From: Emmanuel Bigeon Date: Sun, 14 Oct 2018 09:28:04 -0400 Subject: [PATCH] Moved out increments Signed-off-by: Emmanuel Bigeon --- .../main/java/net/bigeon/gclc/prompt/CLIPrompter.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gclc/src/main/java/net/bigeon/gclc/prompt/CLIPrompter.java b/gclc/src/main/java/net/bigeon/gclc/prompt/CLIPrompter.java index ee3634f..62b896b 100644 --- a/gclc/src/main/java/net/bigeon/gclc/prompt/CLIPrompter.java +++ b/gclc/src/main/java/net/bigeon/gclc/prompt/CLIPrompter.java @@ -137,17 +137,18 @@ public final class CLIPrompter { * @param output the manager * @param choices the choices * @param cancel the cancel option if it exists - * @return the number of choices plus one (or the number of choices if there is - * a cancel) + * @return the index of last choice * @throws IOException if the manager was closed */ private static Integer listChoices(final ConsoleOutput output, final List choices, final String cancel) throws IOException { int index = 0; for (final U u : choices) { - output.println(index++ + ") " + u); //$NON-NLS-1$ + output.println(index + ") " + u); //$NON-NLS-1$ + index++; } if (cancel != null) { - output.println(index++ + ") " + cancel); //$NON-NLS-1$ + output.println(index + ") " + cancel); //$NON-NLS-1$ + index++; } return Integer.valueOf(index - 1); }