Class CommandDescription.Builder

java.lang.Object
org.jline.shell.CommandDescription.Builder
Enclosing class:
CommandDescription

public static class CommandDescription.Builder extends Object
Builder for CommandDescription instances.
Since:
4.0
  • Method Details

    • mainDescription

      public CommandDescription.Builder mainDescription(List<org.jline.utils.AttributedString> mainDescription)
      Sets the main description.
      Parameters:
      mainDescription - the description lines
      Returns:
      this builder
    • argument

      public CommandDescription.Builder argument(ArgumentDescription argument)
      Adds an argument description.
      Parameters:
      argument - the argument description
      Returns:
      this builder
    • arguments

      public CommandDescription.Builder arguments(List<ArgumentDescription> arguments)
      Sets all argument descriptions.
      Parameters:
      arguments - the argument descriptions
      Returns:
      this builder
    • option

      public CommandDescription.Builder option(String key, List<org.jline.utils.AttributedString> description)
      Adds an option with its description.
      Parameters:
      key - the option syntax (e.g., "-l --long")
      description - the option description
      Returns:
      this builder
    • options

      public CommandDescription.Builder options(Map<String,List<org.jline.utils.AttributedString>> options)
      Sets all options.
      Parameters:
      options - the options map
      Returns:
      this builder
    • valid

      public CommandDescription.Builder valid(boolean valid)
      Sets whether this description is valid.
      Parameters:
      valid - true if valid
      Returns:
      this builder
    • command

      public CommandDescription.Builder command(boolean command)
      Sets whether this description represents a command.
      Parameters:
      command - true if this is a command description
      Returns:
      this builder
    • subcommand

      public CommandDescription.Builder subcommand(boolean subcommand)
      Sets whether this description represents a subcommand.
      Parameters:
      subcommand - true if this is a subcommand
      Returns:
      this builder
    • highlighted

      public CommandDescription.Builder highlighted(boolean highlighted)
      Sets whether the command should be highlighted.
      Parameters:
      highlighted - true if highlighted
      Returns:
      this builder
    • errorPattern

      public CommandDescription.Builder errorPattern(Pattern errorPattern)
      Sets the error pattern.
      Parameters:
      errorPattern - the error pattern
      Returns:
      this builder
    • errorIndex

      public CommandDescription.Builder errorIndex(int errorIndex)
      Sets the error index.
      Parameters:
      errorIndex - the error index
      Returns:
      this builder
    • build

      public CommandDescription build()
      Builds the command description.
      Returns:
      the immutable command description