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
ConstructorsModifierConstructorDescriptionprotected
AbstractSimpleCommand
(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 void
printUsage
(ConsoleSession<?, ?> session, String name) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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
- ifsummary
ordetail
is null
-
-
Method Details
-
getUsage
Description copied from interface:SimpleCommand
Get 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:
getUsage
in interfaceSimpleCommand
- Parameters:
name
- the name under which this command is registered- Returns:
- command usage string
-
getHelpSummary
Description copied from interface:SimpleCommand
Get 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:
getHelpSummary
in interfaceSimpleCommand
- Parameters:
name
- the name under which this command is registered- Returns:
- one line command summary
-
getHelpDetail
Description copied from interface:SimpleCommand
Get expanded help. This is typically multiple lines of text; lines should be separated by newline characters.- Specified by:
getHelpDetail
in interfaceSimpleCommand
- Parameters:
name
- the name under which this command is registered- Returns:
- detailed command description
-
printUsage
-