TerminalTargetExtensions
ConsoleMonster.Output
The Terminal methods for an explicit target, for libraries that take a target through a constructor or options instead of writing to the process console: target.Write(table), target.WriteMarkupLine(...), target.Status(...). Each call runs inside Terminal.Use for that target, so nested writes, prompts and live sessions go to the same place, and nothing global changes.
Inheritance
- object
- TerminalTargetExtensions
Methods
public static RenderContext CreateContext(ITerminalTarget target) #A render context for the target's profile and theme (for measuring or rendering by hand).
Parameters
- target ConsoleMonster.Output.ITerminalTarget
- The target.
public static void Status(ITerminalTarget target, string markup, Action<StatusContext> action) #Runs work under a status (see Terminal.Status).
Parameters
- target ConsoleMonster.Output.ITerminalTarget
- The target.
- markup string
- The first status text.
- action System.Action<ConsoleMonster.Output.StatusContext>
- The work.
public static async Task StatusAsync(ITerminalTarget target, string markup, Func<StatusContext, Task> action) #Runs asynchronous work under a status.
Parameters
- target ConsoleMonster.Output.ITerminalTarget
- The target.
- markup string
- The first status text.
- action System.Func<ConsoleMonster.Output.StatusContext, System.Threading.Tasks.Task>
- The work.
Returns
Task A task that completes when the work has finished.public static void Write(ITerminalTarget target, IWidget widget) #Writes a widget once.
Parameters
- target ConsoleMonster.Output.ITerminalTarget
- The target.
- widget ConsoleMonster.Layout.IWidget
- The widget.
public static void WriteLines(ITerminalTarget target, IReadOnlyList<StyledLine> lines, bool newLine = true) #Writes styled lines; with newLine false the last line is left open.
Parameters
- target ConsoleMonster.Output.ITerminalTarget
- The target.
- lines System.Collections.Generic.IReadOnlyList<ConsoleMonster.Text.StyledLine>
- The lines.
- newLine bool = true
- Whether to end the last line.
public static void WriteMarkup(ITerminalTarget target, string markup) #Writes markup without ending the line.
Parameters
- target ConsoleMonster.Output.ITerminalTarget
- The target.
- markup string
- The markup.
public static void WriteMarkupLine(ITerminalTarget target, string markup) #Writes one line of markup.
Parameters
- target ConsoleMonster.Output.ITerminalTarget
- The target.
- markup string
- The markup.
public static void WriteRich(ITerminalTarget target, RichText text, bool newLine = true) #Writes rich text as lines; with newLine false the last line is left open.
Parameters
- target ConsoleMonster.Output.ITerminalTarget
- The target.
- text ConsoleMonster.Text.RichText
- The rich text.
- newLine bool = true
- Whether to end the last line.