summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/cli/CommandMode.java
diff options
context:
space:
mode:
authorBenjamin J. Culkin <bjculkin@mix.wvu.edu>2017-10-11 13:41:07 -0300
committerBenjamin J. Culkin <bjculkin@mix.wvu.edu>2017-10-11 13:41:07 -0300
commit946cab444bc301d8a7c756a1bab039558288de89 (patch)
tree419f27c39a509bcd83cae0e6630be8eb7ff95a30 /base/src/main/java/bjc/utils/cli/CommandMode.java
parentc82e3b3b2de0633317ec8fc85925e91422820597 (diff)
Cleanup work
Diffstat (limited to 'base/src/main/java/bjc/utils/cli/CommandMode.java')
-rw-r--r--base/src/main/java/bjc/utils/cli/CommandMode.java47
1 files changed, 27 insertions, 20 deletions
diff --git a/base/src/main/java/bjc/utils/cli/CommandMode.java b/base/src/main/java/bjc/utils/cli/CommandMode.java
index 39c72fc..4107717 100644
--- a/base/src/main/java/bjc/utils/cli/CommandMode.java
+++ b/base/src/main/java/bjc/utils/cli/CommandMode.java
@@ -2,64 +2,71 @@ package bjc.utils.cli;
/**
* A mode for determining the commands that are valid to enter, and then
- * handling those commands
+ * handling those commands.
*
* @author ben
- *
*/
public interface CommandMode extends Comparable<CommandMode> {
/**
- * Check to see if this mode can handle the specified command
+ * Check to see if this mode can handle the specified command.
*
* @param command
- * The command to check
- * @return Whether or not this mode can handle the command. It is
- * assumed not by default
+ * The command to check.
+ *
+ * @return
+ * Whether or not this mode can handle the command. It is
+ * assumed not by default.
*/
default boolean canHandle(final String command) {
return false;
};
/**
- * Get the custom prompt for this mode
+ * Get the custom prompt for this mode.
*
- * @return the custom prompt for this mode
+ * @return
+ * The custom prompt for this mode.
*
* @throws UnsupportedOperationException
- * if this mode doesn't support a custom prompt
+ * If this mode doesn't support a custom prompt.
*/
default String getCustomPrompt() {
throw new UnsupportedOperationException("This mode doesn't support a custom prompt");
}
/**
- * Get the name of this command mode
+ * Get the name of this command mode.
*
- * @return The name of this command mode, which is the empty string by
- * default
+ * @return
+ * The name of this command mode, or a default string if one isn't
+ * specified.
*/
public default String getName() {
- return "";
+ return "(anonymous)";
}
/**
- * Check if this mode uses a custom prompt
+ * Check if this mode uses a custom prompt.
*
- * @return Whether or not this mode uses a custom prompt
+ * @return
+ * Whether or not this mode uses a custom prompt.
*/
default boolean isCustomPromptEnabled() {
return false;
}
/**
- * Process a command in this mode
+ * Process a command in this mode..
*
* @param command
- * The command to process
+ * The command to process.
+ *
* @param args
- * A list of arguments to the command
- * @return The command mode to use for the next command. Defaults to
- * returning this, and doing nothing else
+ * A list of arguments to the command.
+ *
+ * @return
+ * The command mode to use for the next command. Defaults to doing
+ * nothing, and staying in the current mode.
*/
default CommandMode process(final String command, final String[] args) {
return this;