Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaunLawrie committed Feb 25, 2024
1 parent 5184117 commit 3db88f3
Show file tree
Hide file tree
Showing 23 changed files with 497 additions and 99 deletions.
2 changes: 1 addition & 1 deletion PwshSpectreConsole.Docs/UpdateDocs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if($null -eq $module) {

$module | Save-MarkdownHelp -OutputPath "$PSScriptRoot\src\content\docs\reference\" -IncludeYamlHeader -YamlHeaderInformationType Metadata -ExcludeFile "*.gif", "*.png"

$new = @("New-SpectreChartItem.md", "Get-SpectreDemoColors.md", "Get-SpectreDemoEmoji.md", "Format-SpectreJson.md")
$new = @("New-SpectreChartItem.md", "Get-SpectreDemoColors.md", "Get-SpectreDemoEmoji.md", "Format-SpectreJson.md", "Write-SpectreCalendar.md", "Format-SpectreJson.md")
$experimental = @("Get-SpectreImageExperimental.md", "Invoke-SpectreScriptBlockQuietly.md")

$newTag = @"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ The accent color to set. Must be a valid Spectre Console color name. Defaults to



|Type |Required|Position|PipelineInput|
|----------|--------|--------|-------------|
|`[String]`|false |1 |false |
|Type |Required|Position|PipelineInput|
|---------|--------|--------|-------------|
|`[Color]`|false |1 |false |



Expand All @@ -72,9 +72,39 @@ The default value color to set. Must be a valid Spectre Console color name. Defa



|Type |Required|Position|PipelineInput|
|----------|--------|--------|-------------|
|`[String]`|false |2 |false |
|Type |Required|Position|PipelineInput|
|---------|--------|--------|-------------|
|`[Color]`|false |2 |false |



#### **DefaultTableHeaderColor**

The default table header color to set. Must be a valid Spectre Console color name. Defaults to "Default" which will be the standard console foreground color.






|Type |Required|Position|PipelineInput|
|---------|--------|--------|-------------|
|`[Color]`|false |3 |false |



#### **DefaultTableTextColor**

The default table text color to set. Must be a valid Spectre Console color name. Defaults to "Default" which will be the standard console foreground color.






|Type |Required|Position|PipelineInput|
|---------|--------|--------|-------------|
|`[Color]`|false |4 |false |



Expand All @@ -85,5 +115,5 @@ The default value color to set. Must be a valid Spectre Console color name. Defa

### Syntax
```powershell
Set-SpectreColors [[-AccentColor] <String>] [[-DefaultValueColor] <String>] [<CommonParameters>]
Set-SpectreColors [[-AccentColor] <Color>] [[-DefaultValueColor] <Color>] [[-DefaultTableHeaderColor] <Color>] [[-DefaultTableTextColor] <Color>] [<CommonParameters>]
```
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Formats data into a breakdown chart.

### Description

This function takes an array of data and formats it into a breakdown chart using Spectre.Console.BreakdownChart. The chart can be customized with a specified width and color.
This function takes an array of data and formats it into a breakdown chart using BreakdownChart. The chart can be customized with a specified width and color.



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ title: Format-SpectreJson


### Synopsis
Formats an array of objects into a Spectre Console Json.
Formats an array of objects into a Spectre Console Json.
Thanks to [trackd](https://github.com/trackd) for adding this.
![Spectre json example](/json.png)

Expand Down Expand Up @@ -86,6 +86,10 @@ The array of objects to be formatted into Json.

#### **Depth**

The maximum depth of the Json. Default is defined by the version of powershell.






Expand All @@ -110,6 +114,21 @@ The title of the Json.



#### **NoBorder**

If specified, the Json will not be surrounded by a border.






|Type |Required|Position|PipelineInput|
|----------|--------|--------|-------------|
|`[Switch]`|false |named |false |



#### **Border**

The border style of the Json. Default is "Rounded".
Expand Down Expand Up @@ -145,9 +164,9 @@ The color of the Json border. Default is the accent color of the script.



|Type |Required|Position|PipelineInput|
|----------|--------|--------|-------------|
|`[String]`|false |5 |false |
|Type |Required|Position|PipelineInput|
|---------|--------|--------|-------------|
|`[Color]`|false |5 |false |



Expand Down Expand Up @@ -199,5 +218,5 @@ The height of the Json panel.

### Syntax
```powershell
Format-SpectreJson [-Data] <Object> [[-Depth] <Int32>] [[-Title] <String>] [[-Border] <String>] [[-Color] <String>] [[-Width] <Int32>] [[-Height] <Int32>] [-Expand] [<CommonParameters>]
Format-SpectreJson [-Data] <Object> [[-Depth] <Int32>] [[-Title] <String>] [-NoBorder] [[-Border] <String>] [[-Color] <Color>] [[-Width] <Int32>] [[-Height] <Int32>] [-Expand] [<CommonParameters>]
```
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The string to be formatted as a panel.

|Type |Required|Position|PipelineInput |
|----------|--------|--------|--------------|
|`[String]`|true |1 |true (ByValue)|
|`[Object]`|true |1 |true (ByValue)|



Expand Down Expand Up @@ -118,9 +118,9 @@ The color of the panel border.



|Type |Required|Position|PipelineInput|
|----------|--------|--------|-------------|
|`[String]`|false |4 |false |
|Type |Required|Position|PipelineInput|
|---------|--------|--------|-------------|
|`[Color]`|false |4 |false |



Expand Down Expand Up @@ -161,5 +161,5 @@ The height of the panel.

### Syntax
```powershell
Format-SpectrePanel [-Data] <String> [[-Title] <String>] [[-Border] <String>] [-Expand] [[-Color] <String>] [[-Width] <Int32>] [[-Height] <Int32>] [<CommonParameters>]
Format-SpectrePanel [-Data] <Object> [[-Title] <String>] [[-Border] <String>] [-Expand] [[-Color] <Color>] [[-Width] <Int32>] [[-Height] <Int32>] [<CommonParameters>]
```
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,59 @@ $data = @(
)
Format-SpectreTable -Data $data
```
> EXAMPLE 2
```powershell
$Properties = @(
# foreground + background
@{'Name'='FileName'; Expression={ "[orange1 on blue]" + $_.Name + "[/]" }},
# foreground
@{'Name'='Last Updated'; Expression={ "[DeepSkyBlue3_1]" + $_.LastWriteTime.ToString() + "[/]" }},
# background
@{'Name'='Drive'; Expression={ "[default on orange1]" + (Split-Path $_.Fullname -Qualifier) + "[/]" }}
)
Get-ChildItem | Format-SpectreTable -Property $Properties -AllowMarkup
```
> EXAMPLE 3
```powershell
1..10 | Format-SpectreTable -Title Numbers
```


---


### Parameters
#### **Data**

The array of objects to be formatted into a table.
Takes pipeline input.






|Type |Required|Position|PipelineInput |Aliases |
|----------|--------|--------|--------------|-----------|
|`[Object]`|true |named |true (ByValue)|InputObject|



#### **Property**

The list of properties to select for the table from the input data.
Specifies the object properties that appear in the display and the order in which they appear.
Type one or more property names, separated by commas, or use a hash table to display a calculated property.
Wildcards are permitted.
The Property parameter is optional. You can't use the Property and View parameters in the same command.
The value of the Property parameter can be a new calculated property.
The calculated property can be a script block or a hash table. Valid key-value pairs are:
* Name (or Label) `<string>`
* Expression - `<string>` or `<script block>`
* FormatString - `<string>`
* Width - `<int32>` - must be greater than `0`
* Alignment - value can be `Left`, `Center`, or `Right`



Expand All @@ -53,22 +97,38 @@ The list of properties to select for the table from the input data.

|Type |Required|Position|PipelineInput|
|------------|--------|--------|-------------|
|`[String[]]`|false |1 |false |
|`[Object[]]`|false |1 |false |



#### **Data**
#### **Wrap**

Displays text that exceeds the column width on the next line. By default, text that exceeds the column width is truncated
Currently there is a bug with this, spectre.console/issues/1185


The array of objects to be formatted into a table.




|Type |Required|Position|PipelineInput|
|----------|--------|--------|-------------|
|`[Switch]`|false |named |false |



|Type |Required|Position|PipelineInput |
|----------|--------|--------|--------------|
|`[Object]`|true |named |true (ByValue)|
#### **View**

The View parameter lets you specify an alternate format or custom view for the table.






|Type |Required|Position|PipelineInput|
|----------|--------|--------|-------------|
|`[String]`|false |named |false |



Expand Down Expand Up @@ -119,9 +179,39 @@ The color of the table border. Default is the accent color of the script.



|Type |Required|Position|PipelineInput|
|----------|--------|--------|-------------|
|`[String]`|false |named |false |
|Type |Required|Position|PipelineInput|
|---------|--------|--------|-------------|
|`[Color]`|false |named |false |



#### **HeaderColor**

The color of the table header text. Default is the DefaultTableHeaderColor.






|Type |Required|Position|PipelineInput|
|---------|--------|--------|-------------|
|`[Color]`|false |named |false |



#### **TextColor**

The color of the table text. Default is the DefaultTableTextColor.






|Type |Required|Position|PipelineInput|
|---------|--------|--------|-------------|
|`[Color]`|false |named |false |



Expand Down Expand Up @@ -192,5 +282,11 @@ Allow Spectre markup in the table elements e.g. [green]message[/].

### Syntax
```powershell
Format-SpectreTable [[-Property] <String[]>] -Data <Object> [-Border <String>] [-Color <String>] [-Width <Int32>] [-HideHeaders] [-Title <String>] [-AllowMarkup] [<CommonParameters>]
Format-SpectreTable -Data <Object> [-Wrap] [-Border <String>] [-Color <Color>] [-HeaderColor <Color>] [-TextColor <Color>] [-Width <Int32>] [-HideHeaders] [-Title <String>] [-AllowMarkup] [<CommonParameters>]
```
```powershell
Format-SpectreTable -Data <Object> [[-Property] <Object[]>] [-Wrap] [-Border <String>] [-Color <Color>] [-HeaderColor <Color>] [-TextColor <Color>] [-Width <Int32>] [-HideHeaders] [-Title <String>] [-AllowMarkup] [<CommonParameters>]
```
```powershell
Format-SpectreTable -Data <Object> [-Wrap] [-View <String>] [-Border <String>] [-Color <Color>] [-HeaderColor <Color>] [-TextColor <Color>] [-Width <Int32>] [-HideHeaders] [-Title <String>] [-AllowMarkup] [<CommonParameters>]
```
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ $data = @{
}
)
}
Format-SpectreTree -Data $data -Border "Heavy" -Color "Green"
Format-SpectreTree -Data $data -Guide BoldLine -Color "Green"
```


Expand Down Expand Up @@ -103,9 +103,9 @@ The color to use for the tree. This can be a Spectre Console color name or a hex



|Type |Required|Position|PipelineInput|
|----------|--------|--------|-------------|
|`[String]`|false |3 |false |
|Type |Required|Position|PipelineInput|
|---------|--------|--------|-------------|
|`[Color]`|false |3 |false |



Expand All @@ -116,5 +116,5 @@ The color to use for the tree. This can be a Spectre Console color name or a hex

### Syntax
```powershell
Format-SpectreTree [-Data] <Hashtable> [[-Guide] <String>] [[-Color] <String>] [<CommonParameters>]
Format-SpectreTree [-Data] <Hashtable> [[-Guide] <String>] [[-Color] <Color>] [<CommonParameters>]
```
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ The New-SpectreChartItem function creates a new SpectreChartItem object with the


### Examples
> EXAMPLE 1
This example creates an array of new SpectreChartItem objects you can pass into the chart functions.

```powershell
New-SpectreChartItem -Label "Sales" -Value 1000 -Color "green"
This example creates a new SpectreChartItem object with a label of "Sales", a value of 1000, and a green color.
$data = @()
$data += New-SpectreChartItem -Label "Sales" -Value 1000 -Color "green"
$data += New-SpectreChartItem -Label "Expenses" -Value 500 -Color "#ff0000"
$data += New-SpectreChartItem -Label "Profit" -Value 500 -Color ([Spectre.Console.Color]::Blue)
```


Expand Down Expand Up @@ -81,9 +83,9 @@ The color for the chart item. Must be a valid Spectre color as name, hex or a Sp



|Type |Required|Position|PipelineInput|
|----------|--------|--------|-------------|
|`[String]`|true |3 |false |
|Type |Required|Position|PipelineInput|
|---------|--------|--------|-------------|
|`[Color]`|true |3 |false |



Expand All @@ -94,5 +96,5 @@ The color for the chart item. Must be a valid Spectre color as name, hex or a Sp

### Syntax
```powershell
New-SpectreChartItem [-Label] <String> [-Value] <Double> [-Color] <String> [<CommonParameters>]
New-SpectreChartItem [-Label] <String> [-Value] <Double> [-Color] <Color> [<CommonParameters>]
```
Loading

0 comments on commit 3db88f3

Please sign in to comment.