Class CommandDetector


  • public class CommandDetector
    extends Object
    • Method Detail

      • searchWithoutSplit

        public List<CommandDetector.Command> searchWithoutSplit​(List<ArgumentResolution> resolvedArguments)
        Perform the same operation as search(List), but it doesn't split arguments at the beginning.

        Implementation details:

        A stack is formed on the basis of the arguments provided by a command instruction. This stack is processed until there are no more usable elements. The foremost element is taken from the stack and checked to see if it matches the command to be searched for.

      • search

        public List<CommandDetector.Command> search​(List<ArgumentResolution> resolvedArguments)
        Search for the defined command in resolved arguments. Example:
         
           List<ArgumentResolution> arguments = buildArgumentList("echo", "foo", "bar");
           CommandDetector detector = CommandDetector.builder()
             .with("echo")
             .with("foo")
             .build();
           detector.search(arguments);
         
         
        It will find only echo and foo and return as result.

        This method split arguments at the beginning i.e.: echo foo && echo bar will be searched individually.