Skip to content

Commit

Permalink
Merge branch 'prerelease' of github.com:ShaunLawrie/PwshSpectreConsol…
Browse files Browse the repository at this point in the history
…e into prerelease
  • Loading branch information
ShaunLawrie committed Dec 28, 2023
2 parents 5b46535 + a8f5e62 commit 1337de9
Show file tree
Hide file tree
Showing 60 changed files with 436 additions and 1,210 deletions.
7 changes: 5 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"powershell.codeFormatting.preset": "OTBS"
}
"powershell.codeFormatting.preset": "OTBS",
"editor.formatOnPaste": false,
"editor.formatOnSave": false,
"editor.formatOnType": false
}
8 changes: 7 additions & 1 deletion PwshSpectreConsole.Docs/UpdateDocs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ $ErrorActionPreference = "Stop"
Remove-Module -Name PwshSpectreConsole -ErrorAction SilentlyContinue
Import-Module "$PSScriptRoot\..\PwshSpectreConsole\PwshSpectreConsole.psd1" -Force
Remove-Item -Recurse -Path "$PSScriptRoot\src\content\docs\reference\*" -Force
Get-Module PwshSpectreConsole | Save-MarkdownHelp -OutputPath "$PSScriptRoot\src\content\docs\reference\" -IncludeYamlHeader -YamlHeaderInformationType Metadata -ExcludeFile "*.gif", "*.png"
$module = Get-Module PwshSpectreConsole

if($null -eq $module) {
throw "Failed to import PwshSpectreConsole 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", "New-SpectreTreeItem.md")
$experimental = @("Get-SpectreImageExperimental.md", "Invoke-SpectreScriptBlockQuietly.md")
Expand Down
Binary file added PwshSpectreConsole.Docs/public/accentcolor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PwshSpectreConsole.Docs/public/barchart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PwshSpectreConsole.Docs/public/breakdownchart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PwshSpectreConsole.Docs/public/colors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PwshSpectreConsole.Docs/public/defaultcolor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PwshSpectreConsole.Docs/public/emoji.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PwshSpectreConsole.Docs/public/panel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PwshSpectreConsole.Docs/public/table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PwshSpectreConsole.Docs/public/withsetup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 19 additions & 5 deletions PwshSpectreConsole.Docs/src/content/docs/guides/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,28 @@ description: Get started with PwshSpectre Console.

PwshSpectreConsole is a wrapper for the awesome [Spectre Console](https://spectreconsole.net/) which you can use to make your PowerShell scripts more interesting.

Install PwshSpectreConsole from <a class="not-content" href="https://www.powershellgallery.com/packages/PwshSpectreConsole"><img class="align-middle not-content" src="https://img.shields.io/powershellgallery/v/PwshSpectreConsole" /></a> using the following command in your terminal:
Install PwshSpectreConsole from PSGallery using the following command in your terminal (this requires PowerShell 7+):

```powershell
Install-Module PwshSpectreConsole -Scope CurrentUser
```

To get the best experience, you should also follow the [instructions on the official Spectre Console site to configure Windows Terminal for full Unicode and Emoji support](https://spectreconsole.net/best-practices#configuring-the-windows-terminal-for-unicode-and-emoji-support).
<a class="not-content" href="https://www.powershellgallery.com/packages/PwshSpectreConsole"><img class="not-content" src="https://img.shields.io/powershellgallery/v/PwshSpectreConsole?&color=%238acc00" /></a>
<a class="not-content" href="https://www.powershellgallery.com/packages/PwshSpectreConsole"><img class="not-content" src="https://img.shields.io/powershellgallery/dt/PwshSpectreConsole?&color=%238acc00" /></a>
<a class="not-content" href="https://github.com/ShaunLawrie/PwshSpectreConsole"><img class="not-content" src="https://img.shields.io/github/stars/ShaunLawrie/PwshSpectreConsole?&color=%238acc00" /></a>

:::caution
This requires PowerShell 7.0 or later. You can check your PowerShell version by running `$PSVersionTable.PSVersion` in your terminal.
:::

### 👻 Emoji Support and Line Drawing

With the default configuration Windows Terminal and the older console host don't support the full range of Spectre Console features. It will still work but you will find it doesn't look quite like all the examples.
![Old terminal setup showing missing rendering features](/withoutsetup.png)

To get the full feature set:

1. Use Windows Terminal instead of the old console host.
2. Install a NerdFont, a font with additional visual characters. I use "Cascadia Cove NF" from [https://www.nerdfonts.com/](https://www.nerdfonts.com/)
3. Enable full unicode by adding `$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding` as the **FIRST LINE** in your $PROFILE file.

![New terminal setup showing full rendering features](/withsetup.png)

For more details see the [instructions on the official Spectre Console site to configure Windows Terminal for full Unicode and Emoji support](https://spectreconsole.net/best-practices#configuring-the-windows-terminal-for-unicode-and-emoji-support).
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,23 @@ title: Set-SpectreColors







### Synopsis
Sets the accent color and default value color for Spectre Console.



---


### Description

This function sets the accent color and default value color for Spectre Console. The accent color is used for highlighting important information, while the default value color is used for displaying default values.

An example of the accent color is the highlight used in `Read-SpectreSelection`:
![Accent color example](/accentcolor.png)

An example of the default value color is the default value displayed in `Read-SpectreText`:
![Default value color example](/defaultcolor.png)

---


### Examples
Sets the accent color to Red and the default value color to Yellow.

Expand All @@ -37,46 +33,25 @@ Sets the accent color to Green and keeps the default value color as Grey.
Set-SpectreColors -AccentColor Green
```


---


### Parameters
#### **AccentColor**

The accent color to set. Must be a valid Spectre Console color name. Defaults to "Blue".






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



#### **DefaultValueColor**

The default value color to set. Must be a valid Spectre Console color name. Defaults to "Grey".






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





---


### Syntax
```powershell
Set-SpectreColors [[-AccentColor] <String>] [[-DefaultValueColor] <String>] [<CommonParameters>]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,62 +1,37 @@
---
sidebar:
badge:
text: New
variant: tip
title: Get-SpectreDemoColors
---







### Synopsis

Get-SpectreDemoColors



Retrieves a list of Spectre Console colors and displays them with their corresponding markup.
![Spectre color demo](/colors.png)

---


### Description

The Get-SpectreDemoColors function retrieves a list of Spectre Console colors and displays them with their corresponding markup.
It also provides information on how to use the colors as parameters for commands or in Spectre Console markup.

---

### Examples
Displays a list of Spectre Console colors and their corresponding markup.

### Parameters


---


### Inputs
None




---


### Outputs
* [Object](https://learn.microsoft.com/en-us/dotnet/api/System.Object)





```powershell
PS> Get-SpectreDemoColors
```

---


### Syntax
```powershell
syntaxItem
```

```
```powershell
{@{name=Get-SpectreDemoColors; CommonParameters=False; parameter=System.Object[]}}
Get-SpectreDemoColors [<CommonParameters>]
```

Original file line number Diff line number Diff line change
@@ -1,62 +1,43 @@
---
sidebar:
badge:
text: New
variant: tip
title: Get-SpectreDemoEmoji
---







### Synopsis

Get-SpectreDemoEmoji



Retrieves a collection of emojis available in Spectre Console.
![Example emojis](/emoji.png)

---


### Description

The Get-SpectreDemoEmoji function retrieves a collection of emojis available in Spectre Console. It displays the general emojis, faces, and provides information on how to use emojis in Spectre Console markup.

---

### Examples
Retrieves and displays the collection of emojis available in Spectre Console.

### Parameters


---


### Inputs
None



```powershell
Get-SpectreDemoEmoji
```

---


### Outputs
* [Object](https://learn.microsoft.com/en-us/dotnet/api/System.Object)





### Notes
Emoji support is dependent on the operating system, terminal, and font support. For more information on Spectre Console markup and emojis, refer to the following links:
- Spectre Console Markup: https://spectreconsole.net/markup
- Spectre Console Emojis: https://spectreconsole.net/appendix/emojis

---


### Syntax
```powershell
syntaxItem
```

```
```powershell
{@{name=Get-SpectreDemoEmoji; CommonParameters=False; parameter=System.Object[]}}
Get-SpectreDemoEmoji [<CommonParameters>]
```

Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,27 @@ title: Start-SpectreDemo







### Synopsis
Runs a demo of the PwshSpectreConsole module.


![Spectre demo animation](/demo.gif)

---


### Description

This function runs a demo of the PwshSpectreConsole module, showcasing some of its features. It displays various examples of Spectre.Console functionality wrapped in PowerShell functions, such as text entry, select lists, multi-select lists, and panels.



---


### Examples
Runs the PwshSpectreConsole demo.

```powershell
PS C:\> Start-SpectreDemo
```


---


### Syntax
```powershell
Start-SpectreDemo [<CommonParameters>]
Expand Down
Loading

0 comments on commit 1337de9

Please sign in to comment.