jcmdline
Interface UsageFormatter

All Known Implementing Classes:
TextUsageFormatter

public interface UsageFormatter

Used to format a command's usage.

Version:
jcmdline Rel. 2.0.0 $Id: UsageFormatter.java,v 1.2 2002/12/07 14:22:06 lglawrence Exp $
Author:
Lynne Lawrence
See Also:
CmdLineHandler

Method Summary
 java.lang.String formatErrorMsg(java.lang.String msg)
          Gets an error message, reformatted in a manner to "go well with" the usage statement.
 java.lang.String formatUsage(java.lang.String cmdName, java.lang.String cmdDesc, java.util.Map<java.lang.String,Parameter<?>> opts, java.util.List<Parameter<?>> args, boolean showHidden)
          gets the usage for the command
 int getLineLength()
          Gets the maximum line length to use for usage display.
 void setLineLength(int lineLength)
          Sets the maximum line length to use for usage display.
 

Method Detail

formatErrorMsg

java.lang.String formatErrorMsg(java.lang.String msg)
Gets an error message, reformatted in a manner to "go well with" the usage statement. For instance,
 formatErrorMsg("invalid filename")
 
Might return:
    <b>ERROR:</b> invalid filename
 

Parameters:
msg - the text of the error message
Returns:
the reformatted error message

formatUsage

java.lang.String formatUsage(java.lang.String cmdName,
                             java.lang.String cmdDesc,
                             java.util.Map<java.lang.String,Parameter<?>> opts,
                             java.util.List<Parameter<?>> args,
                             boolean showHidden)
gets the usage for the command

Parameters:
showHidden - if true, hidden parameters will be displayed
Returns:
the usage for the command

getLineLength

int getLineLength()
Gets the maximum line length to use for usage display.

Returns:
the maximum line length to use for usage display
See Also:
setLineLength()

setLineLength

void setLineLength(int lineLength)
Sets the maximum line length to use for usage display. The maximum line length defaults to 80 if this method is not called to set it otherwise.

Parameters:
lineLength - the maximum line length to use for usage display
See Also:
getLineLength()