|
@ -6,6 +6,8 @@ import java.util.Scanner; |
|
|
|
|
|
|
|
|
public class Cli { |
|
|
public class Cli { |
|
|
|
|
|
|
|
|
|
|
|
private boolean isClearConsoleActive = true; |
|
|
|
|
|
|
|
|
private PrintStream printStream; |
|
|
private PrintStream printStream; |
|
|
private InputStream inputStream; |
|
|
private InputStream inputStream; |
|
|
private Scanner scanner; |
|
|
private Scanner scanner; |
|
@ -14,6 +16,7 @@ public class Cli { |
|
|
this.printStream = printStream; |
|
|
this.printStream = printStream; |
|
|
this.inputStream = inputStream; |
|
|
this.inputStream = inputStream; |
|
|
this.scanner = new Scanner(inputStream); |
|
|
this.scanner = new Scanner(inputStream); |
|
|
|
|
|
isClearConsoleActive = true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public PrintStream getPrintStream() { |
|
|
public PrintStream getPrintStream() { |
|
@ -25,6 +28,8 @@ public class Cli { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void clearConsole(){ |
|
|
public void clearConsole(){ |
|
|
|
|
|
if(!isClearConsoleActive) |
|
|
|
|
|
return; |
|
|
try{ |
|
|
try{ |
|
|
String operatingSystem = System.getProperty("os.name");//Check the current operating system |
|
|
String operatingSystem = System.getProperty("os.name");//Check the current operating system |
|
|
|
|
|
|
|
@ -42,4 +47,9 @@ public class Cli { |
|
|
this.getPrintStream().println(e); |
|
|
this.getPrintStream().println(e); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setClearConsoleActive(boolean clearConsoleActive) { |
|
|
|
|
|
isClearConsoleActive = clearConsoleActive; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |