Interface IkePrompter
- All Known Implementing Classes:
ConsoleIkePrompter, ScriptedIkePrompter
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 TypeMethodDescriptionbooleanPrompts for a yes/no confirmation.booleanWhether an interactive input channel is available.Prompts for a free-text line of input.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
-
confirm
Prompts for a yes/no confirmation.- Parameters:
label- the questiondefaultYes- the answer assumed on blank input or a non-interactive context- Returns:
- the user's choice, or
defaultYesas the default
-
select
-