|
@ -23,4 +23,23 @@ public class Cli { |
|
|
public Scanner getScanner(){ |
|
|
public Scanner getScanner(){ |
|
|
return this.scanner; |
|
|
return this.scanner; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void clearConsole(){ |
|
|
|
|
|
try{ |
|
|
|
|
|
String operatingSystem = System.getProperty("os.name");//Check the current operating system |
|
|
|
|
|
|
|
|
|
|
|
if(operatingSystem.contains("Windows")){ |
|
|
|
|
|
ProcessBuilder pb = new ProcessBuilder("cmd", "/c", "cls"); |
|
|
|
|
|
Process startProcess = pb.inheritIO().start(); |
|
|
|
|
|
startProcess.waitFor(); |
|
|
|
|
|
} else { |
|
|
|
|
|
ProcessBuilder pb = new ProcessBuilder("clear"); |
|
|
|
|
|
Process startProcess = pb.inheritIO().start(); |
|
|
|
|
|
|
|
|
|
|
|
startProcess.waitFor(); |
|
|
|
|
|
} |
|
|
|
|
|
}catch(Exception e){ |
|
|
|
|
|
this.getPrintStream().println(e); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |