summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/cli
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2018-04-07 15:20:50 -0400
committerbculkin2442 <bjculkin@mix.wvu.edu>2018-04-07 15:20:50 -0400
commit4e1a13330028b57818ece6741e029ebdbc9c7572 (patch)
treea9ce7ea5912d736f7c3c06bf59680f0483a7fe61 /base/src/main/java/bjc/utils/cli
parente51542d6c5f0db3717c91dae77458445bc01094c (diff)
Documentation
Diffstat (limited to 'base/src/main/java/bjc/utils/cli')
-rw-r--r--base/src/main/java/bjc/utils/cli/objects/BlockReaderCLI.java11
-rw-r--r--base/src/main/java/bjc/utils/cli/objects/Command.java2
2 files changed, 13 insertions, 0 deletions
diff --git a/base/src/main/java/bjc/utils/cli/objects/BlockReaderCLI.java b/base/src/main/java/bjc/utils/cli/objects/BlockReaderCLI.java
index 8c29d8c..64b56fc 100644
--- a/base/src/main/java/bjc/utils/cli/objects/BlockReaderCLI.java
+++ b/base/src/main/java/bjc/utils/cli/objects/BlockReaderCLI.java
@@ -87,6 +87,7 @@ public class BlockReaderCLI {
if(interactive) {
System.out.printf("reader-conf(%d)>", lno);
}
+
while(input.hasNextLine()) {
/* Read a line. */
String ln = input.nextLine();
@@ -123,6 +124,7 @@ public class BlockReaderCLI {
* @return The status of the executed command.
*/
public CommandStatus handleCommand(Command com, boolean interactive) {
+ /* Handle each command. */
switch(com.nameCommand) {
case "def-filtered":
return defFiltered(com);
@@ -155,6 +157,11 @@ public class BlockReaderCLI {
/*
* Get the block name.
*/
+ /*
+ * @TODO 02/17/18 Ben Culkin :StringHandling
+ * This slicing up strings by indexed characters should be abstracted into some
+ * sort of class.
+ */
int idx = remn.indexOf(' ');
if(idx == -1) {
LOGGER.severe(com.error("No name argument for def-filtered.\n"));
@@ -173,6 +180,7 @@ public class BlockReaderCLI {
/*
* Get the reader name.
*/
+ /* :StringHandling */
idx = remn.indexOf(' ');
if(idx == -1) {
LOGGER.severe(com.error("No reader-name argument for def-filtered.\n"));
@@ -370,6 +378,7 @@ public class BlockReaderCLI {
/*
* Get the block name.
*/
+ /* :StringHandling */
int idx = remn.indexOf(' ');
if(idx == -1) {
LOGGER.severe(com.error("No name argument for def-simple.\n"));
@@ -388,6 +397,7 @@ public class BlockReaderCLI {
/*
* Get the source name.
*/
+ /* :StringHandling */
idx = remn.indexOf(' ');
if(idx == -1) {
LOGGER.severe(com.error("No source-name argument for def-simple.\n"));
@@ -414,6 +424,7 @@ public class BlockReaderCLI {
String delim = remn;
+ /* Get the delimiter, and create the reader. */
try {
BlockReader reader = new SimpleBlockReader(delim, stat.sources.get(sourceName));
diff --git a/base/src/main/java/bjc/utils/cli/objects/Command.java b/base/src/main/java/bjc/utils/cli/objects/Command.java
index c4b2a48..a48eef7 100644
--- a/base/src/main/java/bjc/utils/cli/objects/Command.java
+++ b/base/src/main/java/bjc/utils/cli/objects/Command.java
@@ -66,10 +66,12 @@ public class Command {
* The name of where the I/O came from.
*/
public Command(String ln, int lno, String ioSrc) {
+ /* :StringHandling */
int idx = ln.indexOf(' ');
if(idx == -1) idx = ln.length();
+ /* Grab command parts. */
fullCommand = ln;
nameCommand = ln.substring(0, idx).trim();
remnCommand = ln.substring(idx).trim();