Class EditModeBuilder

java.lang.Object
org.aesh.readline.editing.EditModeBuilder

public class EditModeBuilder extends Object
Builder for creating and configuring EditMode instances with key bindings and variables.
Author:
Ståle W. Pedersen
  • Method Details

    • builder

      public static EditModeBuilder builder()
      Creates a new EditModeBuilder instance with default settings.
      Returns:
      a new EditModeBuilder instance
    • builder

      public static EditModeBuilder builder(EditMode.Mode mode)
      Creates a new EditModeBuilder instance with the specified editing mode.
      Parameters:
      mode - the editing mode (EMACS or VI)
      Returns:
      a new EditModeBuilder instance configured with the specified mode
    • addAction

      public EditModeBuilder addAction(int[] input, String action)
      Adds a key binding action to the builder.
      Parameters:
      input - the key input sequence
      action - the action name to bind to the input
      Returns:
      this builder instance for method chaining
    • addVariable

      public EditModeBuilder addVariable(Variable variable, String value)
      Adds a variable with its value to the builder.
      Parameters:
      variable - the variable to set
      value - the value for the variable
      Returns:
      this builder instance for method chaining
    • parseInputrc

      public EditModeBuilder parseInputrc(InputStream inputStream)
      Parses an inputrc file from the given input stream and applies the settings to this builder.
      Parameters:
      inputStream - the input stream containing inputrc configuration
      Returns:
      this builder instance for method chaining
    • device

      public EditModeBuilder device(Device device)
      Sets the terminal device for the builder.
      Parameters:
      device - the terminal device
      Returns:
      this builder instance for method chaining
    • getVariableValue

      public String getVariableValue(Variable variable)
      Gets the value of a variable.
      Parameters:
      variable - the variable to retrieve
      Returns:
      the value of the variable, or null if not set
    • createSimple

      public EditMode createSimple()
      Creates a simple EditMode with minimal key bindings (only accept-line).
      Returns:
      a simple EditMode instance
    • create

      public EditMode create()
      Creates an EditMode instance with all configured actions, variables, and device mappings.
      Returns:
      a fully configured EditMode instance (either Emacs or Vi based on the editing-mode variable)