ShellPrompt
ConsoleMonster.Widgets
A compact shell prompt. The host supplies status, history duration and optional cached git data.
Inheritance
- object
- ShellPrompt
Usage
Explore 24 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 12
- Extension method ShellPrompt.WithBranch
- Extension method ShellPrompt.WithDirty
- Extension method ShellPrompt.WithDuration
- Extension method ShellPrompt.WithHome
- Extension method ShellPrompt.WithPath
- Extension method ShellPrompt.WithSucceeded
- Method ShellPromptFluent.WithBranch
- Method ShellPromptFluent.WithDirty
- Method ShellPromptFluent.WithDuration
- Method ShellPromptFluent.WithHome
- Method ShellPromptFluent.WithPath
- Method ShellPromptFluent.WithSucceeded
Accepted by parameters 12
- Extension method ShellPrompt.WithBranch
- Extension method ShellPrompt.WithDirty
- Extension method ShellPrompt.WithDuration
- Extension method ShellPrompt.WithHome
- Extension method ShellPrompt.WithPath
- Extension method ShellPrompt.WithSucceeded
- Method ShellPromptFluent.WithBranch
- Method ShellPromptFluent.WithDirty
- Method ShellPromptFluent.WithDuration
- Method ShellPromptFluent.WithHome
- Method ShellPromptFluent.WithPath
- Method ShellPromptFluent.WithSucceeded
Constructors
public ShellPrompt() #Methods
public Size Measure(Constraints constraints, RenderContext context) #Returns the size the widget wants within the constraints.
Parameters
- constraints ConsoleMonster.Layout.Constraints
- The space offered.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
public void Render(Region region, RenderContext context) #Renders into a region. The region may be smaller or larger than the measured size.
Parameters
- region ConsoleMonster.Canvas.Region
- The target region.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
public string ToAnsi(RenderContext context, int width) #Returns the prompt as terminal text without writing or changing terminal state.
Parameters
- context ConsoleMonster.Canvas.RenderContext
- The active theme, glyphs and terminal capabilities.
- width int
- Available terminal cells, including a trailing input space.
Returns
string One prompt line, with SGR only when colour is supported.Inherited Methods
Properties
public string? Home { get; set; } #The home directory, abbreviated only at a complete path boundary.
public string? Branch { get; set; } #The branch name, or a detached commit identifier; null omits git information.
public bool Dirty { get; set; } #Whether git reported working tree or index changes.
public bool Succeeded { get; set; } #Whether PowerShell reported the last command as successful.
public TimeSpan Duration { get; set; } #The last completed command's duration. Only values strictly above two seconds are shown.
Extension Methods
public static ShellPrompt WithBranch(ShellPrompt shellPrompt, string? value) #Sets ShellPrompt.Branch: The branch name, or a detached commit identifier; null omits git information.
Parameters
- shellPrompt ConsoleMonster.Widgets.ShellPrompt
- The instance.
- value string?
- The value.
public static ShellPrompt WithDirty(ShellPrompt shellPrompt, bool value = true) #Sets ShellPrompt.Dirty: Whether git reported working tree or index changes.
Parameters
- shellPrompt ConsoleMonster.Widgets.ShellPrompt
- The instance.
- value bool = true
- The value (default true).
public static ShellPrompt WithDuration(ShellPrompt shellPrompt, TimeSpan value) #Sets ShellPrompt.Duration: The last completed command's duration. Only values strictly above two seconds are shown.
Parameters
- shellPrompt ConsoleMonster.Widgets.ShellPrompt
- The instance.
- value System.TimeSpan
- The value.
public static ShellPrompt WithHome(ShellPrompt shellPrompt, string? value) #Sets ShellPrompt.Home: The home directory, abbreviated only at a complete path boundary.
Parameters
- shellPrompt ConsoleMonster.Widgets.ShellPrompt
- The instance.
- value string?
- The value.
public static ShellPrompt WithPath(ShellPrompt shellPrompt, string value) #Sets ShellPrompt.Path: The current provider path.
Parameters
- shellPrompt ConsoleMonster.Widgets.ShellPrompt
- The instance.
- value string
- The value.
public static ShellPrompt WithSucceeded(ShellPrompt shellPrompt, bool value = true) #Sets ShellPrompt.Succeeded: Whether PowerShell reported the last command as successful.
Parameters
- shellPrompt ConsoleMonster.Widgets.ShellPrompt
- The instance.
- value bool = true
- The value (default true).