Skip to content

Commit

Permalink
Try force order of columns
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaunLawrie committed Aug 31, 2024
1 parent 89d00fc commit 2e46fe1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions PwshSpectreConsole/public/demo/Get-SpectreDemoFeatures.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -91,7 +91,7 @@ function Get-SpectreDemoFeatures {

# Tables and trees
$embeddedTable = @(
@{
([ordered]@{
Foo = "Baz "
Bar = @(
(Write-SpectreHost "`n[grey]Overview[/]" -PassThru),
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 2e46fe1

Please sign in to comment.