Class BaseTerminal
- All Implemented Interfaces:
Consumer<nz.org.riskscape.problem.Problem>
,nz.org.riskscape.cli.Terminal
,nz.org.riskscape.problem.ProblemSink
- Direct Known Subclasses:
JlineTerminal
Wraps all of the user-facing parts of the CLI
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static nz.org.riskscape.picocli.CommandLine.Help.Ansi
A defaultCommandLine.Help.Ansi
object to use when buildingCommandLine.Help.Ansi.Text
objects fromString
s.boolean
Whether to include stack traces in problems when printed XXX this is currently broken, as the stack traces get filled lazilystatic final int
Fields inherited from interface nz.org.riskscape.problem.ProblemSink
DEVNULL
Fields inherited from interface nz.org.riskscape.cli.Terminal
ELLIPSIS, EMPTY_TEXT, NO_STYLES
-
Constructor Summary
ConstructorDescriptionBaseTerminal
(nz.org.riskscape.engine.i18n.Messages messages) BaseTerminal
(nz.org.riskscape.engine.i18n.Messages messages, Locale locale) -
Method Summary
Modifier and TypeMethodDescriptionnz.org.riskscape.picocli.CommandLine.Help.Ansi
getAnsi()
nz.org.riskscape.cli.InterruptHandler
The locale for this terminal.boolean
isTTY()
void
log
(nz.org.riskscape.problem.Problem problem) Allows thisTerminal
to act as aProblemSink
- dumps any messages out to stderr along with some basic formatting to make them stick out a bitnz.org.riskscape.cli.InterruptHandler
setFallbackHandler
(nz.org.riskscape.cli.InterruptHandler newFallbackHandler) static PrintStream
wrapAsUncloseable
(PrintStream toWrap) Wraps a PrintStream in one that will inhibit the auto closing of the underlying output stream.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface nz.org.riskscape.problem.ProblemSink
accept
Methods inherited from interface nz.org.riskscape.cli.Terminal
getAnsiErr, getAnsiOut, getDisplayHeight, getDisplayWidth, getErr, getIn, getOut, println, printProblems, printProblems, readline, updateStatus
-
Field Details
-
DEFAULT_TTY_WIDTH
public static final int DEFAULT_TTY_WIDTH- See Also:
-
TERMINAL_HEIGHT_UNLIMITED
public static final int TERMINAL_HEIGHT_UNLIMITED- See Also:
-
defaultAnsi
public static nz.org.riskscape.picocli.CommandLine.Help.Ansi defaultAnsiA default
CommandLine.Help.Ansi
object to use when buildingCommandLine.Help.Ansi.Text
objects fromString
s. -
showStackTrace
public boolean showStackTraceWhether to include stack traces in problems when printed XXX this is currently broken, as the stack traces get filled lazily
-
-
Constructor Details
-
BaseTerminal
public BaseTerminal(nz.org.riskscape.engine.i18n.Messages messages) -
BaseTerminal
-
-
Method Details
-
wrapAsUncloseable
Wraps a PrintStream in one that will inhibit the auto closing of the underlying output stream.
- Parameters:
toWrap
-- Returns:
- a print stream wrapping toWrap
-
log
public void log(nz.org.riskscape.problem.Problem problem) Allows this
Terminal
to act as aProblemSink
- dumps any messages out to stderr along with some basic formatting to make them stick out a bit- Specified by:
log
in interfacenz.org.riskscape.problem.ProblemSink
-
setFallbackHandler
public nz.org.riskscape.cli.InterruptHandler setFallbackHandler(nz.org.riskscape.cli.InterruptHandler newFallbackHandler) - Specified by:
setFallbackHandler
in interfacenz.org.riskscape.cli.Terminal
-
isTTY
public boolean isTTY()- Specified by:
isTTY
in interfacenz.org.riskscape.cli.Terminal
- Returns:
- true if this terminal is connected to a TTY.
-
getAnsi
public nz.org.riskscape.picocli.CommandLine.Help.Ansi getAnsi()- Specified by:
getAnsi
in interfacenz.org.riskscape.cli.Terminal
-
getLocale
The locale for this terminal. Note that while the terminal has a locale (typically read/setup from an environment variable), the terminal itself does not want to deal with internationalization issues, so don't start adding i18n code in here, please!
- Specified by:
getLocale
in interfacenz.org.riskscape.cli.Terminal
-
getFallbackHandler
public nz.org.riskscape.cli.InterruptHandler getFallbackHandler()
-