diff options
| author | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2021-07-12 15:58:34 -0300 |
|---|---|---|
| committer | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2021-07-12 15:58:34 -0300 |
| commit | a732ae9404c0b7ba446d40bffb246ec43aad603c (patch) | |
| tree | 931a49908e951471e751e352c8baa3142019bb6b /clformat/src/example/java/bjc/utils/ioutils/format | |
| parent | a24c1042499f76ff2d442ae133ef165011a7af4c (diff) | |
| parent | aba8e262d0e89ebef4229ad807b67660fc9bef35 (diff) | |
Merge & Update
Diffstat (limited to 'clformat/src/example/java/bjc/utils/ioutils/format')
| -rw-r--r-- | clformat/src/example/java/bjc/utils/ioutils/format/examples/CLFormatCLI.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/clformat/src/example/java/bjc/utils/ioutils/format/examples/CLFormatCLI.java b/clformat/src/example/java/bjc/utils/ioutils/format/examples/CLFormatCLI.java new file mode 100644 index 0000000..71e6b92 --- /dev/null +++ b/clformat/src/example/java/bjc/utils/ioutils/format/examples/CLFormatCLI.java @@ -0,0 +1,40 @@ +package bjc.utils.ioutils.format.examples; + +import java.io.*; +import java.util.*; + +public class CLFormatCLI { + public static void main(String[] args) { + Scanner scn = new Scanner(System.in); + PrintStream output = System.out; + + runCLI(scn, output); + } + + private static void runCLI(Scanner input, PrintStream output) { + output.println("CLFormat CLI v0.1"); + output.println("Enter a command (m for help)"); + + String inp = input.nextLine().trim(); + + boolean verboseErrors = false; + + while (!inp.equals("q")) { + String[] args = inp.split("\\S+"); + + String command = args[0]; + switch(command) { + default: + if (verboseErrors) { + output.printf("! Error: %s is not a recognizable command\n", inp); + } else { + output.println("! UC"); + } + } + + output.println("Enter a command (m for help)"); + + String inp = input.nextLine().trim(); + } + } +} |
