Skip to content

Format-SpectreTextPath

Description

Formats a path into a Spectre Console Path which supports highlighting and truncating.
See https://spectreconsole.net/widgets/text-path for more information.


Examples

Example 1
This example demonstrates how to format a PowerShell path as a Spectre Console Path with syntax highlighting.

Terminal window
Get-Location | Format-SpectreTextPath | Out-SpectreHost

Parameters

Path

The directory/file path to format

TypeRequiredPositionPipelineInput
[String]true1true (ByValue)

Alignment

The alignment of the path. Defaults to “Left”.

Valid Values:

  • Left
  • Right
  • Center
TypeRequiredPositionPipelineInput
[String]false2false

PathStyle

A hashtable of Spectre Console colors or color names to style the path output. e.g.

@{
RootColor = [Spectre.Console.Color]::Cyan2
SeparatorColor = [Spectre.Console.Color]::Aqua
StemColor = [Spectre.Console.Color]::Orange1
LeafColor = "HotPink"
}
TypeRequiredPositionPipelineInput
[Hashtable]false3false

Syntax

Terminal window
Format-SpectreTextPath [-Path] <String> [[-Alignment] <String>] [[-PathStyle] <Hashtable>] [<CommonParameters>]