Class CommandLine

  extended by laser.util.commandline.CommandLine

public class CommandLine
extends java.lang.Object

Implements a simple (and stupid) command line argument parser. The parser assumes that a command line is a set of "-key value" pairs. Each key is permitted to occur multiple times in the same command. This should probably be improved later on to make is more robust. If args is empty, parse assumes that the args will be read from

NOTE: If the args are read from, then:

  1. Each line is tokenized by white space.
  2. Each argument must be either a quoted or unquoted string.
  3. An argument cannot contain quotes within it.
  4. An argument is not processed for escaped character sequences.

Jamieson M. Cobleigh (

Constructor Summary
Method Summary
static java.util.Map<java.lang.String,java.util.List<java.lang.String>> parse(java.lang.String[] args)
          Parses the command line arguments.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public CommandLine()
Method Detail


public static java.util.Map<java.lang.String,java.util.List<java.lang.String>> parse(java.lang.String[] args)
Parses the command line arguments. They are unmodifiable.

args - The arguments to be parsed
A Map whose keys are the keys on the commandline and whose values are Lists of Strings that go with that key
Throws: - if an I/O error occurs while reading from