Class Command

    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.util.Map<java.lang.String,​Command> childCommands
      List of available subcommands
    • Constructor Summary

      Constructors 
      Constructor Description
      Command()  
      Command​(java.util.Map<java.lang.String,​Command> childCommands)  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      org.jline.reader.Candidate buildCandidate​(CommandHandler.Category category, java.lang.String commandName)
      Creates a JLine candidate that appears in the list of available options when you press TAB
      java.util.List<org.jline.reader.Candidate> complete​(java.util.List<java.lang.String> words, int wordIndex, java.lang.String word)
      Returns a list of available options for the next word for the current command.
      abstract java.lang.String getArgsDescription()  
      abstract java.lang.String getUsageDescription()  
      abstract void invoke​(java.lang.String... args)
      Run current command
      void invokeSubcommands​(java.lang.String... args)
      Transfer control to subcommands
      protected static java.lang.String parseUsername​(java.lang.String username)  
      protected static java.util.UUID parseUUID​(java.lang.String s)  
      protected void verifyArgs​(java.lang.String[] args, int min)  
      • Methods inherited from class java.lang.Object

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

      • childCommands

        public final java.util.Map<java.lang.String,​Command> childCommands
        List of available subcommands
    • Constructor Detail

      • Command

        public Command()
      • Command

        public Command​(java.util.Map<java.lang.String,​Command> childCommands)
    • Method Detail

      • getArgsDescription

        public abstract java.lang.String getArgsDescription()
      • getUsageDescription

        public abstract java.lang.String getUsageDescription()
      • buildCandidate

        public org.jline.reader.Candidate buildCandidate​(CommandHandler.Category category,
                                                         java.lang.String commandName)
        Creates a JLine candidate that appears in the list of available options when you press TAB
        Parameters:
        category - this command category
        commandName - this command name
        Returns:
        JLine Candidate
      • complete

        public java.util.List<org.jline.reader.Candidate> complete​(java.util.List<java.lang.String> words,
                                                                   int wordIndex,
                                                                   java.lang.String word)
        Returns a list of available options for the next word for the current command.
        Parameters:
        words - list all user words
        wordIndex - current word index
        word - current word
        Returns:
        list of available Candidate
      • invokeSubcommands

        public void invokeSubcommands​(java.lang.String... args)
                               throws java.lang.Exception
        Transfer control to subcommands
        Parameters:
        args - command arguments(includes subcommand name)
        Throws:
        java.lang.Exception - Error executing command
      • invoke

        public abstract void invoke​(java.lang.String... args)
                             throws java.lang.Exception
        Run current command
        Parameters:
        args - command arguments
        Throws:
        java.lang.Exception - Error executing command