Skip to content
ConsoleMonster
Class

PromptContext

ConsoleMonster.Prompts

Namespace
ConsoleMonster.Prompts
Assembly
ConsoleMonster
Modifiers
sealed

A snapshot shared by all shell prompt segments in one evaluation.

Inheritance

  • object
  • PromptContext

Usage

Explore 5 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 1

Accepted by parameters 4

Constructors

public PromptContext(string path, TerminalProfile terminal, ITheme theme, DateTimeOffset now, string? providerPath = null, string provider = "FileSystem", string? home = null, bool succeeded = true, int? exitCode = null, string? errorCategory = null, string? errorType = null, string? errorTarget = null, TimeSpan duration = default, long historyId = 0, string? user = null, string? host = null, bool elevated = false, bool ssh = false, int nesting = 0, bool debugging = false, int jobs = 0, string? edition = null, Version? version = null, IReadOnlyDictionary<string, string>? environment = null, string? loginUser = null, bool? isGitWorkTree = null) #

Creates a snapshot. All properties are fixed for the duration of a prompt evaluation.

Parameters

path string required
terminal ConsoleMonster.Capabilities.TerminalProfile required
theme ConsoleMonster.Styling.ITheme required
now System.DateTimeOffset required
providerPath string? = null optional
provider string = "FileSystem" optional
home string? = null optional
succeeded bool = true optional
exitCode int? = null optional
errorCategory string? = null optional
errorType string? = null optional
errorTarget string? = null optional
duration System.TimeSpan = default optional
historyId long = 0 optional
user string? = null optional
host string? = null optional
elevated bool = false optional
ssh bool = false optional
nesting int = 0 optional
debugging bool = false optional
jobs int = 0 optional
edition string? = null optional
version System.Version? = null optional
environment System.Collections.Generic.IReadOnlyDictionary<string, string>? = null optional
loginUser string? = null optional
isGitWorkTree bool? = null optional

Properties

public string Path { get; } #

The display path in the current provider.

public string ProviderPath { get; } #

The provider's resolved path.

public string Provider { get; } #

The location provider name.

public bool IsFileSystem { get; } #

Whether the current path belongs to the filesystem provider.

public bool? IsGitWorkTree { get; } #

The latest recorded Git worktree result, or null until the provider has observed the location.

public string? Home { get; } #

The user's home directory, if known.

public bool Succeeded { get; } #

Whether the last command succeeded.

public int? ExitCode { get; } #

The last command's native exit code, if it was native.

public string? ErrorCategory { get; } #

The category of the last command error.

public string? ErrorType { get; } #

The exception type of the last command error.

public string? ErrorTarget { get; } #

The last command error's target.

public TimeSpan Duration { get; } #

The last completed command's execution time.

public long HistoryId { get; } #

The last completed command's history id.

public string? User { get; } #

The current user.

public string? Host { get; } #

The machine that hosts this shell.

public string? LoginUser { get; } #

The session's login user.

public bool Elevated { get; } #

Whether the shell is elevated or runs as root.

public bool Ssh { get; } #

Whether the shell is an SSH session.

public int Nesting { get; } #

The current nested prompt level.

public bool Debugging { get; } #

Whether the debugger is stopped.

public int Jobs { get; } #

The number of running shell jobs.

public string? Edition { get; } #

The shell edition.

public Version? Version { get; } #

The shell version.

public TerminalProfile Terminal { get; } #

The terminal settings and capabilities.

public ITheme Theme { get; } #

The active palette and styles.

public DateTimeOffset Now { get; } #

The evaluation time, shared by all segments.

public IReadOnlyDictionary<string, string> Environment { get; } #

The environment variables made available to segments by the host.