MCPcopy Create free account
hub / github.com/TheCyaniteProject/exit_code_java / runCommand

Method runCommand

src/main/java/exitcode/Console.java:207–219  ·  view source on GitHub ↗

"Simply" runs a command. Yep. @param input The command String to parse and run. i.e: "echo Hello world!" @param ps1 The ps1 to be inserted when outputting to the console. i.e: "root@system:~# " @param termArea (Ohh, boy!) A JavaFX label to output to. This serves as the Terminal "log" per-sa

(String input, String ps1, Label termArea)

Source from the content-addressed store, hash-verified

205 * @see exitcode.Console#printText(Label, String)
206 */
207 public void runCommand(String input, String ps1, Label termArea) {
208 ArrayList<String> output = formatCommand(input);
209 String command = output.get(0);
210 String body = output.get(1);
211 printText(termArea, String.format("%n%s%s", ps1, input));
212 if (checkCommand(command)) {
213 exeCommand(command, termArea, body);
214 } else {
215 if (!(command.trim().equals(""))) {
216 printText(termArea, ("\"" + command + "\" is not a valid command."));
217 }
218 }
219 }
220
221 /**
222 * Executes the Command. First, checks if exePrivate() was able to run the command.

Callers

nothing calls this directly

Calls 5

formatCommandMethod · 0.95
printTextMethod · 0.95
checkCommandMethod · 0.95
exeCommandMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected