Interface PrompterConfig

All Known Implementing Classes:
DefaultPrompterConfig

public interface PrompterConfig
Configuration interface for customizing the visual appearance and behavior of prompts.

The configuration controls various visual elements used in the prompt display, including indicators, checkbox symbols, and interaction behavior. The API provides platform-specific defaults that work well on different operating systems.

Default Configurations:

  • Windows: ">", "( )", "(x)", "( )"
  • Unix/Linux/macOS: "?", "? ", "? ", "? "

Example Custom Configuration:


 Prompter.Config config = new DefaultPrompter.DefaultConfig(
     "?",     // indicator
     "? ",    // unchecked box
     "? ",    // checked box
     "? "     // unavailable item
 );

 Prompter prompter = PrompterFactory.create(terminal, config);
 
Since:
3.30.0
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Answer text style
    static final String
    Box disabled style
    static final String
    Box enabled style
    static final String
    Checkbox style
    static final String
    Cursor/selection indicator style
    static final String
    Error message style
    static final String
    Footer/description text style (dimmed)
    static final String
    Message text style
    static final String
    Prompt text style
    static final String
    Selected item style
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Whether the first prompt can be cancelled.
    Get the checked box character/string.
    custom(String indicator, String uncheckedBox, String checkedBox, String unavailable, org.jline.utils.StyleResolver styleResolver, boolean cancellableFirstPrompt)
    Create a custom configuration with style resolver support.
    Create a configuration with platform-specific defaults.
    default int
    Maximum height, in rows, of the dimmed footer pane shown below list and checkbox prompts.
    Get the indicator character/string.
    default org.jline.utils.AttributedStyle
    style(String style)
     
    default org.jline.utils.StyleResolver
    Get the style resolver for this configuration.
    Get the unavailable item character/string.
    Get the unchecked box character/string.
    Create a configuration with Unix/Linux-specific defaults.
    Create a configuration with Windows-specific defaults.
    withCancellableFirstPrompt(boolean cancellable)
     
  • Field Details

  • Method Details

    • indicator

      String indicator()
      Get the indicator character/string.
      Returns:
      the indicator
    • uncheckedBox

      String uncheckedBox()
      Get the unchecked box character/string.
      Returns:
      the unchecked box
    • checkedBox

      String checkedBox()
      Get the checked box character/string.
      Returns:
      the checked box
    • unavailable

      String unavailable()
      Get the unavailable item character/string.
      Returns:
      the unavailable item
    • styleResolver

      default org.jline.utils.StyleResolver styleResolver()
      Get the style resolver for this configuration.
      Returns:
      the style resolver, or null if not available
    • cancellableFirstPrompt

      boolean cancellableFirstPrompt()
      Whether the first prompt can be cancelled.
      Returns:
      true if the first prompt can be cancelled
    • withCancellableFirstPrompt

      default PrompterConfig withCancellableFirstPrompt(boolean cancellable)
    • defaults

      static PrompterConfig defaults()
      Create a configuration with platform-specific defaults.
      Returns:
      a configuration with platform defaults
    • windows

      static PrompterConfig windows()
      Create a configuration with Windows-specific defaults.
      Returns:
      a configuration with Windows defaults
    • unix

      static PrompterConfig unix()
      Create a configuration with Unix/Linux-specific defaults.
      Returns:
      a configuration with Unix defaults
    • custom

      static PrompterConfig custom(String indicator, String uncheckedBox, String checkedBox, String unavailable, org.jline.utils.StyleResolver styleResolver, boolean cancellableFirstPrompt)
      Create a custom configuration with style resolver support.
      Parameters:
      indicator - the indicator character/string
      uncheckedBox - the unchecked box character/string
      checkedBox - the checked box character/string
      unavailable - the unavailable item character/string
      styleResolver - the style resolver for applying styles
      Returns:
      a custom configuration with styling support
    • style

      default org.jline.utils.AttributedStyle style(String style)
    • footerMaxRows

      default int footerMaxRows()
      Maximum height, in rows, of the dimmed footer pane shown below list and checkbox prompts.
      Returns:
      the maximum footer pane height in rows