Class Console
java.lang.Object
com.codename1.cli.Console
What a command needs to know about the terminal it writes to.
Answered from the environment, the conventions command-line tools share:
COLUMNS for the width, NO_COLOR and CLICOLOR_FORCE for color, and
TERM for whether the output is a terminal that understands color at all.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe stylesstyle(String, Console.Style...)can apply. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanWhetherstyle(String, Console.Style...)adds color: never whenNO_COLORis set, always whenCLICOLOR_FORCEis set to anything but0, and otherwise whenTERMnames a terminal other thandumband standard output is a terminal, so output piped to a file or another program carries no escape codes.static booleanWhether standard output is a terminal rather than a pipe or a file.static Stringstyle(String text, Console.Style... styles) static intwidth()The width help text is wrapped to:COLUMNSwhen it holds a number, otherwise 80.
-
Method Details
-
width
public static int width()The width help text is wrapped to:COLUMNSwhen it holds a number, otherwise 80. -
colorEnabled
public static boolean colorEnabled()Whetherstyle(String, Console.Style...)adds color: never whenNO_COLORis set, always whenCLICOLOR_FORCEis set to anything but0, and otherwise whenTERMnames a terminal other thandumband standard output is a terminal, so output piped to a file or another program carries no escape codes. -
isTerminal
public static boolean isTerminal()Whether standard output is a terminal rather than a pipe or a file. -
style
-