- usable with jdk 17 and above
- usable via Jvm hotspot and java9
-
command system
- references to CommandArguments
- no command register, it will be registered by Reflection
-
custom exception
- references to RuntimeException
-
log system
- references to FileWriter
- can be activated or deactivated
- log path
- log filename
-
event system
- input
- thread able - by set thread size
- period - set as long
- messages will be written into log file
- output
- output stream will be written into log file
- error
- error stream will be written into log file
- input
-
builder system
- terminal can be created by builder principle
-
string color system
- native Jline3 AttributedStringBuilder , AttributedStyle integration
public class Test {
public static void main(final String[] args) {
final JlineExecutor jlineExecutor =
JlineBuilder.getJlineBuilder()
.setThreadSize(3)
.setPrompt(Test.prompt())
.setCommandArgumentNotAvailable("The arguments are not available")
.setCommandNotAvailable("The command is not available")
.setPrefix("de.mint.consoleline")
.setLog(true)
.build();
jlineExecutor.buildTerminal();
}
private static String prompt() {
return new AttributedStringBuilder()
.style(AttributedStyle.DEFAULT.foreground(AttributedStyle.CYAN))
.append("@prompt")
.style(AttributedStyle.DEFAULT)
.append("> ")
.toAnsi();
}
}
public static void main(final String[]args){
final JlineExecutor jlineExecutor=
JlineBuilder.getJlineBuilder()
.setThreadSize(3)
.setPrompt("@prompt> ")
.setCommandArgumentNotAvailable("The arguments are not available")
.setCommandNotAvailable("The command is not available")
.setPrefix("de.mint.consoleline")
.setLog(true)
.setLogFilename("Sample.txt")
.setLogPath("sample/")
.build();
jlineExecutor.buildTerminal();
}
public class TestCommand implements CommandArguments {
public TestCommand() {
}
@Override
public @NotNull String commandName() {
return "test";
}
@Override
public void onCommand(final String[] arguments) {
switch (arguments[0]) {
case "print":
if (arguments.length > 1) {
final String[] message = Arrays.copyOfRange(arguments, 1, arguments.length);
System.out.println("TestCommand: " + String.join(" ", message));
} else {
System.out.println("Test output");
}
}
}
}