Package org.dellroad.jct.core.simple
Class AbstractSimpleCommand
java.lang.Object
org.dellroad.jct.core.simple.AbstractSimpleCommand
- All Implemented Interfaces:
SimpleCommand
- Direct Known Subclasses:
DateCommand,EchoCommand,ExitCommand,HelpCommand,SleepCommand,SubshellCommand
Support superclass for
SimpleCommand implementations.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractSimpleCommand(String usage, String summary, String detail) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiongetHelpDetail(String name) Get expanded help.getHelpSummary(String name) Get summarized help.Get this command's usage string.protected voidprintUsage(ConsoleSession<?, ?> session, String name) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.dellroad.jct.core.simple.SimpleCommand
execute
-
Constructor Details
-
AbstractSimpleCommand
Constructor.- Parameters:
usage- usage string, or null if command takes no argumentssummary- help summarydetail- help detail- Throws:
IllegalArgumentException- ifsummaryordetailis null
-
-
Method Details
-
getUsage
Description copied from interface:SimpleCommandGet this command's usage string.The usage string should be a synopsis of the command's arguments. If the command takes no arguments, this can return null or empty string.
- Specified by:
getUsagein interfaceSimpleCommand- Parameters:
name- the name under which this command is registered- Returns:
- command usage string
-
getHelpSummary
Description copied from interface:SimpleCommandGet summarized help. This should be a single line of text, playing a role similar to the first sentence (or sentence fragment) of a Javadoc comment.- Specified by:
getHelpSummaryin interfaceSimpleCommand- Parameters:
name- the name under which this command is registered- Returns:
- one line command summary
-
getHelpDetail
Description copied from interface:SimpleCommandGet expanded help. This is typically multiple lines of text; lines should be separated by newline characters.- Specified by:
getHelpDetailin interfaceSimpleCommand- Parameters:
name- the name under which this command is registered- Returns:
- detailed command description
-
printUsage
-