Interface IkePrompter

All Known Implementing Classes:
ConsoleIkePrompter, ScriptedIkePrompter

public interface IkePrompter
Interactive-prompt abstraction for IKE plugin goals (IKE-Network/ike-issues#385).

This interface is the stable seam between goal code and the messy reality of interactive input across environments. Goals depend only on IkePrompter; the implementation is free to change as Maven and IDE Maven runners evolve.

The shipped implementation, ConsoleIkePrompter, is environment-aware: it renders an inline prompt on a real terminal (a shell, or IntelliJ's Terminal tool window — where System.console() is non-null) and an own-line prompt in a piped runner (IntelliJ's Maven tool window — where System.console() is null, established by measurement under #385). The Maven 4 Prompter service is deliberately not used — it writes through JLine to raw file descriptors, uncoordinated with Maven's logger, and misrenders in piped runners.

ScriptedIkePrompter is a deterministic implementation for tests.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    confirm(String label, boolean defaultYes)
    Prompts for a yes/no confirmation.
    boolean
    Whether an interactive input channel is available.
    prompt(String label)
    Prompts for a free-text line of input.
    select(String label, List<String> options)
    Prompts for a numbered selection from a list.
  • Method Details

    • isInteractive

      boolean isInteractive()
      Whether an interactive input channel is available.

      False in genuine non-interactive contexts (Maven batch mode); a goal should then fail with a -D<param>= instruction rather than prompt.

      Returns:
      true when prompting is possible
    • prompt

      String prompt(String label)
      Prompts for a free-text line of input.
      Parameters:
      label - the prompt label, including any trailing separator (e.g. "Commit message: ")
      Returns:
      the entered line (trimmed), or null if input was blank, end-of-stream, or not interactive
    • confirm

      boolean confirm(String label, boolean defaultYes)
      Prompts for a yes/no confirmation.
      Parameters:
      label - the question
      defaultYes - the answer assumed on blank input or a non-interactive context
      Returns:
      the user's choice, or defaultYes as the default
    • select

      String select(String label, List<String> options)
      Prompts for a numbered selection from a list.
      Parameters:
      label - the selection header
      options - the choices, rendered as a numbered list
      Returns:
      the chosen option, or null on invalid, blank, or non-interactive input