Interface CommandRegistry

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      static org.jline.reader.impl.completer.SystemCompleter aggregateCompleters​(CommandRegistry... commandRegistries)
      Aggregate SystemCompleters of commandRegisteries
      java.util.Map<java.lang.String,​java.lang.String> commandAliases()
      Returns a map of alias-to-command names known by this registry.
      CmdDesc commandDescription​(java.util.List<java.lang.String> args)
      Returns a command description for use in the JLine Widgets framework.
      java.util.List<java.lang.String> commandInfo​(java.lang.String command)
      Returns a short info about command known by this registry.
      java.util.Set<java.lang.String> commandNames()
      Returns the command names known by this registry.
      org.jline.reader.impl.completer.SystemCompleter compileCompleters()
      Returns a SystemCompleter that can provide detailed completion information for all registered commands.
      static org.jline.reader.impl.completer.SystemCompleter compileCompleters​(CommandRegistry... commandRegistries)
      Aggregate and compile SystemCompleters of commandRegisteries
      static org.jline.reader.Candidate createCandidate​(CommandRegistry[] commandRegistries, java.lang.String command)  
      boolean hasCommand​(java.lang.String command)
      Returns whether a command with the specified name is known to this registry.
      default java.lang.Object invoke​(CommandRegistry.CommandSession session, java.lang.String command, java.lang.Object... args)
      Execute a command.
      default java.lang.String name()
      Returns the name of this registry.
    • Method Detail

      • aggregateCompleters

        static org.jline.reader.impl.completer.SystemCompleter aggregateCompleters​(CommandRegistry... commandRegistries)
        Aggregate SystemCompleters of commandRegisteries
        Parameters:
        commandRegistries - command registeries which completers is to be aggregated
        Returns:
        uncompiled SystemCompleter
      • compileCompleters

        static org.jline.reader.impl.completer.SystemCompleter compileCompleters​(CommandRegistry... commandRegistries)
        Aggregate and compile SystemCompleters of commandRegisteries
        Parameters:
        commandRegistries - command registeries which completers is to be aggregated and compile
        Returns:
        compiled SystemCompleter
      • createCandidate

        static org.jline.reader.Candidate createCandidate​(CommandRegistry[] commandRegistries,
                                                          java.lang.String command)
      • name

        default java.lang.String name()
        Returns the name of this registry.
        Returns:
        the name of the registry
      • commandNames

        java.util.Set<java.lang.String> commandNames()
        Returns the command names known by this registry.
        Returns:
        the set of known command names, excluding aliases
      • commandAliases

        java.util.Map<java.lang.String,​java.lang.String> commandAliases()
        Returns a map of alias-to-command names known by this registry.
        Returns:
        a map with alias keys and command name values
      • commandInfo

        java.util.List<java.lang.String> commandInfo​(java.lang.String command)
        Returns a short info about command known by this registry.
        Parameters:
        command - the command name
        Returns:
        a short info about command
      • hasCommand

        boolean hasCommand​(java.lang.String command)
        Returns whether a command with the specified name is known to this registry.
        Parameters:
        command - the command name to test
        Returns:
        true if the specified command is registered
      • compileCompleters

        org.jline.reader.impl.completer.SystemCompleter compileCompleters()
        Returns a SystemCompleter that can provide detailed completion information for all registered commands.
        Returns:
        a SystemCompleter that can provide command completion for all registered commands
      • commandDescription

        CmdDesc commandDescription​(java.util.List<java.lang.String> args)
        Returns a command description for use in the JLine Widgets framework. Default method must be overridden to return sub command descriptions.
        Parameters:
        args - command (args[0]) and its arguments
        Returns:
        command description for JLine TailTipWidgets to be displayed in the terminal status bar.
      • invoke

        default java.lang.Object invoke​(CommandRegistry.CommandSession session,
                                        java.lang.String command,
                                        java.lang.Object... args)
                                 throws java.lang.Exception
        Execute a command.
        Parameters:
        session - the data of the current command session
        command - the name of the command
        args - arguments of the command
        Returns:
        result of the command execution
        Throws:
        java.lang.Exception - in case of error