diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-06 13:50:00 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-06 13:50:00 -0400 |
| commit | 79d3a4a47cbc1fcf17c77c6fc12ff826a3077bac (patch) | |
| tree | a69e533c558326d583b3aee891fc815208c7b650 /BJC-Utils2/src/main/java/bjc/utils/cli/ICommandMode.java | |
| parent | 4355418164c44170cfb329fcbb7e6f1358c0e314 (diff) | |
Minor bugfixes/changes, as well as beginnings of CLI systems
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/cli/ICommandMode.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/cli/ICommandMode.java | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/cli/ICommandMode.java b/BJC-Utils2/src/main/java/bjc/utils/cli/ICommandMode.java new file mode 100644 index 0000000..5208657 --- /dev/null +++ b/BJC-Utils2/src/main/java/bjc/utils/cli/ICommandMode.java @@ -0,0 +1,68 @@ +package bjc.utils.cli; + +/** + * A mode for determining the commands that are valid to enter, and then + * handling those commands + * + * @author ben + * + */ +public interface ICommandMode { + /** + * Process a command in this mode + * + * @param command + * 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 + */ + public default ICommandMode processCommand(String command, + String[] args) { + return this; + }; + + /** + * 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 + */ + public default boolean canHandleCommand(String command) { + return false; + } + + /** + * Get the name of this command mode + * + * @return The name of this command mode, which is "crawler" by default + */ + public default String getName() { + return "crawler"; + } + + /** + * Check if this mode uses a custom prompt + * + * @return Whether or not this mode uses a custom prompt + */ + public default boolean useCustomPrompt() { + return false; + } + + /** + * Get the custom prompt for this mode + * + * @return the custom prompt for this mode + * + * @throws UnsupportedOperationException + * if this mode doesn't support a custom prompt + */ + public default String getCustomPrompt() { + throw new UnsupportedOperationException( + "This mode doesn't support a custom prompt"); + } +} |
