Package org.dellroad.jct.core.simple
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 ClassesModifier and TypeInterfaceDescriptionstatic class
Exception thrown by aCommandLineParser
when the line cannot be successfully parsed. -
Method Summary
Modifier and TypeMethodDescriptionparseCommandLine
(String line) Parse the given command line into a command name and parameters.
-
Method Details
-
parseCommandLine
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
- ifline
contains a syntax errorIllegalArgumentException
- ifline
is null
-