Interface CommandLineParser

All Known Implementing Classes:
SimpleCommandLineParser

public interface CommandLineParser
Parses a command line string into a command name and parameters.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    Exception thrown by a CommandLineParser when the line cannot be successfully parsed.
  • Method Summary

    Modifier and Type
    Method
    Description
    Parse the given command line into a command name and parameters.
  • Method Details

    • parseCommandLine

      List<String> parseCommandLine(String line) throws CommandLineParser.SyntaxException
      Parse the given command line into a command name and parameters.

      If the line contains a syntax error, then a CommandLineParser.SyntaxException should be thrown.

      If the line does not contain even a command name, for example is pure whitespace, then an empty list should be returned.

      If the line contains ends with an incomplete parse (e.g., with a backslash continuation character), then null should be returned. In this case the caller should read another line of input, append it to the original (after adding a line terminator), and then invoke this method again.

      Parameters:
      line - command line
      Returns:
      parsed command line
      Throws:
      CommandLineParser.SyntaxException - if line contains a syntax error
      IllegalArgumentException - if line is null