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.
Get-Location | Format-SpectreTextPath | Out-SpectreHost
Parameters
Path
The directory/file path to format
Type | Required | Position | PipelineInput |
---|---|---|---|
[String] | true | 1 | true (ByValue) |
Alignment
The alignment of the path. Defaults to “Left”.
Valid Values:
- Left
- Right
- Center
Type | Required | Position | PipelineInput |
---|---|---|---|
[String] | false | 2 | false |
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"}
Type | Required | Position | PipelineInput |
---|---|---|---|
[Hashtable] | false | 3 | false |
Syntax
Format-SpectreTextPath [-Path] <String> [[-Alignment] <String>] [[-PathStyle] <Hashtable>] [<CommonParameters>]