|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjcmdline.TextUsageFormatter
public class TextUsageFormatter
Used to format a command's usage.
CmdLineHandler
Constructor Summary | |
---|---|
TextUsageFormatter()
constructor |
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 |
formatText(java.lang.String text,
int indent,
int lineLen)
|
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 - default is 80. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TextUsageFormatter()
Method Detail |
---|
public java.lang.String formatErrorMsg(java.lang.String msg)
ERROR: invalid filenamewhen called as:
formatErrorMsg("invalid filename")
formatErrorMsg
in interface UsageFormatter
msg
- the text of the error message
public java.lang.String formatText(java.lang.String text, int indent, int lineLen)
public 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)
formatUsage
in interface UsageFormatter
cmdName
- the command namecmdDesc
- the command descriptionopts
- a Map of command options; keys are the option tags, values are
the option objectsargs
- the command argumentsshowHidden
- if true
, hidden parameters will be displayed
public int getLineLength()
getLineLength
in interface UsageFormatter
setLineLength()
public void setLineLength(int lineLength)
setLineLength
in interface UsageFormatter
lineLength
- the maximum line length to use for usage displaygetLineLength()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |