From 2e46fe13b71a89671a341701b8cf908ca3141882 Mon Sep 17 00:00:00 2001 From: Shaun Lawrie Date: Sun, 1 Sep 2024 02:50:01 +1200 Subject: [PATCH] Try force order of columns --- .../Convert-HashtableToRenderSafePSObject.ps1 | 2 +- .../public/demo/Get-SpectreDemoFeatures.ps1 | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/PwshSpectreConsole/private/Convert-HashtableToRenderSafePSObject.ps1 b/PwshSpectreConsole/private/Convert-HashtableToRenderSafePSObject.ps1 index 47c95568..8b9a6502 100644 --- a/PwshSpectreConsole/private/Convert-HashtableToRenderSafePSObject.ps1 +++ b/PwshSpectreConsole/private/Convert-HashtableToRenderSafePSObject.ps1 @@ -3,7 +3,7 @@ function Convert-HashtableToRenderSafePSObject { [object] $Hashtable, [hashtable] $Renderables ) - $customObject = @{} + $customObject = [ordered]@{} foreach ($item in $Hashtable.GetEnumerator()) { if ($item.Value -is [hashtable] -or $item.Value -is [ordered]) { $item.Value = Convert-HashtableToRenderSafePSObject -Hashtable $item.Value diff --git a/PwshSpectreConsole/public/demo/Get-SpectreDemoFeatures.ps1 b/PwshSpectreConsole/public/demo/Get-SpectreDemoFeatures.ps1 index 82d22afa..ee3deb53 100644 --- a/PwshSpectreConsole/public/demo/Get-SpectreDemoFeatures.ps1 +++ b/PwshSpectreConsole/public/demo/Get-SpectreDemoFeatures.ps1 @@ -53,10 +53,10 @@ function Get-SpectreDemoFeatures { ) # Start the table creation - $table = Format-SpectreTable -Data @{ + $table = Format-SpectreTable -Data ([ordered]@{ Feature = (Write-SpectreHost "[red]Colors[/] " -PassThru) # Force column width to be wide enough for the longest line Demo = $colorColumns - } -HideHeaders -Border None -Width $demoWidth + }) -HideHeaders -Border None -Width $demoWidth $table = Add-SpectreTableRow -Table $table -Columns @("", "") # OS @@ -91,7 +91,7 @@ function Get-SpectreDemoFeatures { # Tables and trees $embeddedTable = @( - @{ + ([ordered]@{ Foo = "Baz " Bar = @( (Write-SpectreHost "`n[grey]Overview[/]" -PassThru), @@ -128,15 +128,15 @@ function Get-SpectreDemoFeatures { (Write-SpectreRule -Color Silver -PassThru), (Write-SpectreHost "[grey]3 Files, 225 KiB[/]" -PassThru) ) | Format-SpectreRows - }, - @{ + }), + ([ordered]@{ Foo = "" Bar = "" - } - @{ + }) + ([ordered]@{ Foo = "Qux" Bar = "Corgi" - } + }) ) | Format-SpectreTable -Color Yellow -Width ($demoWidth - 22) $table = Add-SpectreTableRow -Table $table -Columns @((Write-SpectreHost "[red]Tables and Trees[/]" -PassThru), $embeddedTable)