I've been trying to display formatted texts on CLI. I tried the exact same code provided in picocli docs (doc link), but the formatting does not seem to be applied.
Please help me to identify my mistake.
Expected output
My code
import java.util.concurrent.Callable;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Help.Ansi;
@Command(name = "test", mixinStandardHelpOptions = true, version = "test 1.0",
description = "Custom @|bold,underline styles|@ and @|fg(red) colors|@.")
public class Interpreter implements Callable<Integer> {
@Override
public Integer call() throws Exception { // your business logic goes here...
String str = Ansi.AUTO.string("@|red Hello, colored world!|@");
System.out.println(str);
return 0;
}
public static void main (String[] args) {
CommandLine prompt = new CommandLine(new Interpreter());
int exitCode = prompt.execute(args);
System.exit(exitCode);
}
My output (formatting is not getting applied)
PS. Im using picocli v 4.5.2, exporting the project as runnable jar, and building it to .exe using Launch4j. Executing the result exe in command prompt of windows 10.