Class PicocliCommands.PicocliCommandsFactory

  • All Implemented Interfaces:
    picocli.CommandLine.IFactory
    Enclosing class:
    PicocliCommands

    public static class PicocliCommands.PicocliCommandsFactory
    extends java.lang.Object
    implements picocli.CommandLine.IFactory
    Command factory that is necessary for applications that want the use the ClearScreen subcommand. It can be chained with other factories.

    WARNING: If the application uses the ClearScreen subcommand, construct the CommandLine with a PicocliCommandsFactory, and set the Terminal on that factory. Applications need to call the setTerminal method with a Terminal; this will be passed to the ClearScreen subcommand. For example:

     PicocliCommandsFactory factory = new PicocliCommandsFactory();
     CommandLine cmd = new CommandLine(new MyApp(), factory);
     // create terminal
     factory.setTerminal(terminal);
     
    Other factories can be chained by passing them in to the constructor like this:
     MyCustomFactory customFactory = createCustomFactory(); // your application custom factory
     PicocliCommandsFactory factory = new PicocliCommandsFactory(customFactory); // chain the factories
     
    Since:
    4.6
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <K> K create​(java.lang.Class<K> clazz)  
      void setTerminal​(org.jline.terminal.Terminal terminal)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PicocliCommandsFactory

        public PicocliCommandsFactory()
      • PicocliCommandsFactory

        public PicocliCommandsFactory​(picocli.CommandLine.IFactory nextFactory)
    • Method Detail

      • create

        public <K> K create​(java.lang.Class<K> clazz)
                     throws java.lang.Exception
        Specified by:
        create in interface picocli.CommandLine.IFactory
        Throws:
        java.lang.Exception
      • setTerminal

        public void setTerminal​(org.jline.terminal.Terminal terminal)