net.dpml.cli.option

Class Command

public class Command extends ParentImpl

Represents a cvs "update" style command line option. Like all Parents, Commands can have child options and can be part of Arguments.

Version: @PROJECT-VERSION@

Author: @PUBLISHER-NAME@

Constructor Summary
Command(String preferredName, String description, Set aliases, boolean required, Argument argument, Group children, int id)
Creates a new Command instance.
Method Summary
voidappendUsage(StringBuffer buffer, Set helpSettings, Comparator comp)
Appends usage information to the specified StringBuffer
StringgetPreferredName()
The preferred name of an option is used for generating help and usage information.
SetgetTriggers()
Identifies the argument prefixes that should trigger this option.
voidprocessParent(WriteableCommandLine commandLine, ListIterator arguments)
Process the parent.
voidvalidate(WriteableCommandLine commandLine)
Checks that the supplied CommandLine is valid with respect to this option.

Constructor Detail

Command

public Command(String preferredName, String description, Set aliases, boolean required, Argument argument, Group children, int id)
Creates a new Command instance.

Parameters: preferredName the name normally used to refer to the Command description a description of the Command aliases alternative names for the Command required true if the Command is required argument an Argument that the command takes children the Group of child options for this Command id a unique id for the Command

See Also: ParentImpl

Method Detail

appendUsage

public void appendUsage(StringBuffer buffer, Set helpSettings, Comparator comp)
Appends usage information to the specified StringBuffer

Parameters: buffer the buffer to append to helpSettings a set of display settings @see DisplaySetting comp a comparator used to sort the Options

getPreferredName

public String getPreferredName()
The preferred name of an option is used for generating help and usage information.

Returns: The preferred name of the option

getTriggers

public Set getTriggers()
Identifies the argument prefixes that should trigger this option. This is used to decide which of many Options should be tried when processing a given argument string. The returned Set must not be null.

Returns: The set of triggers for this Option

processParent

public void processParent(WriteableCommandLine commandLine, ListIterator arguments)
Process the parent.

Parameters: commandLine the commandline arguments an iterator of arguments

Throws: OptionException if an error occurs

validate

public void validate(WriteableCommandLine commandLine)
Checks that the supplied CommandLine is valid with respect to this option.

Parameters: commandLine the CommandLine to check.

Throws: OptionException if the CommandLine is not valid.