fr.umlv.tatoo.cc.common.main
Class UsageFormatter

java.lang.Object
  extended by fr.umlv.tatoo.cc.common.main.UsageFormatter

public class UsageFormatter
extends Object

Format the usage of a CommandLineParser.

Author:
remi
See Also:
CommandLineParser, CommandLineParser.Option

Field Summary
static int DEFAULT_DEPTH
           
static int DEFAULT_OPTION_LENGTH
           
 
Constructor Summary
UsageFormatter()
           
 
Method Summary
protected  StringBuilder optionText(StringBuilder optBuilder, Command<?> command, String option, int numberOfArgument)
           
 String usage(String comment, Map<? extends Command<?>,? extends Set<? extends CommandLineParser.Option>> commands, int depth, int optionLength)
          returns the usage of a set of command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_OPTION_LENGTH

public static final int DEFAULT_OPTION_LENGTH
See Also:
Constant Field Values

DEFAULT_DEPTH

public static final int DEFAULT_DEPTH
See Also:
Constant Field Values
Constructor Detail

UsageFormatter

public UsageFormatter()
Method Detail

usage

public String usage(String comment,
                    Map<? extends Command<?>,? extends Set<? extends CommandLineParser.Option>> commands,
                    int depth,
                    int optionLength)
returns the usage of a set of command.

Parameters:
comment - general comment of the program.
commands - map that associate options informations Info to a command.
depth - shift in character for each line of the usage
optionLength - size in caracter reserved for printing option information
Returns:
the formatted usage

optionText

protected StringBuilder optionText(StringBuilder optBuilder,
                                   Command<?> command,
                                   String option,
                                   int numberOfArgument)