diff options
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java b/BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java new file mode 100644 index 0000000..99951cc --- /dev/null +++ b/BJC-Utils2/src/main/java/bjc/utils/cli/GenericCommand.java @@ -0,0 +1,59 @@ +package bjc.utils.cli; + +/** + * Generic command implementation + * + * @author ben + * + */ +public class GenericCommand implements ICommand { + private static class GenericHelp implements ICommandHelp { + private String summary; + private String description; + + public GenericHelp(String summary, String description) { + this.summary = summary; + this.description = description; + } + + @Override + public String getSummary() { + return summary; + } + + @Override + public String getDescription() { + return description; + } + + } + + private ICommandHandler handler; + private ICommandHelp help; + + /** + * Create a new generic command + * + * @param handler + * The handler to use for the command + * @param description + * The description of the command + * @param help + * The detailed help message for the command + */ + public GenericCommand(ICommandHandler handler, String description, + String help) { + this.handler = handler; + this.help = new GenericHelp(description, help); + } + + @Override + public ICommandHandler getHandler() { + return handler; + } + + @Override + public ICommandHelp getHelp() { + return help; + } +} |
