org.apache.commons.cli

Class GnuParser

public class GnuParser extends Parser

The class GnuParser provides an implementation of the (Options,String[],boolean) flatten method.

Version: $Revision: 1.10 $

Author: John Keyes (john at integralsource.com)

See Also: Parser

Field Summary
ArrayListtokens
holder for flattened tokens
Method Summary
protected String[]flatten(Options options, String[] arguments, boolean stopAtNonOption)

This flatten method does so using the following rules:

  1. If an Option exists for the first character of the arguments entry AND an Option does not exist for the whole argument then add the first character as an option to the processed tokens list e.g.
voidinit()

Resets the members to their original state i.e. remove all of tokens entries.

Field Detail

tokens

private ArrayList tokens
holder for flattened tokens

Method Detail

flatten

protected String[] flatten(Options options, String[] arguments, boolean stopAtNonOption)

This flatten method does so using the following rules:

  1. If an Option exists for the first character of the arguments entry AND an Option does not exist for the whole argument then add the first character as an option to the processed tokens list e.g. "-D" and add the rest of the entry to the also.
  2. Otherwise just add the token to the processed tokens list.

init

private void init()

Resets the members to their original state i.e. remove all of tokens entries.