Class GogoCommandGroup

  • All Implemented Interfaces:
    org.jline.shell.CommandGroup

    public class GogoCommandGroup
    extends java.lang.Object
    implements org.jline.shell.CommandGroup
    A CommandGroup that wraps a legacy CommandRegistry's commands as shell Commands.

    This provides a migration path from the console module's CommandRegistry API to the shell module's CommandGroup API. Each command in the registry is wrapped as a shell Command that delegates to the registry's CommandRegistry.invoke(CommandRegistry.CommandSession, String, Object...) method.

    Example:

     CommandRegistry registry = ...; // existing Gogo/console registry
     dispatcher.addGroup(new GogoCommandGroup("Gogo", registry));
     
    Since:
    4.0
    • Constructor Summary

      Constructors 
      Constructor Description
      GogoCommandGroup​(java.lang.String name, CommandRegistry registry)
      Creates a new GogoCommandGroup wrapping the given registry.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Collection<org.jline.shell.Command> commands()  
      java.lang.String name()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.jline.shell.CommandGroup

        command, hasCommand
    • Constructor Detail

      • GogoCommandGroup

        public GogoCommandGroup​(java.lang.String name,
                                CommandRegistry registry)
        Creates a new GogoCommandGroup wrapping the given registry.
        Parameters:
        name - the group name
        registry - the command registry to wrap
    • Method Detail

      • name

        public java.lang.String name()
        Specified by:
        name in interface org.jline.shell.CommandGroup
      • commands

        public java.util.Collection<org.jline.shell.Command> commands()
        Specified by:
        commands in interface org.jline.shell.CommandGroup