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); }