PowerShell / ConsoleGuiTools

Modules that mix PowerShell and GUIs/CUIs!
https://www.powershellgallery.com/packages/Microsoft.PowerShell.ConsoleGuiTools
MIT License
776 stars 59 forks source link

Column formatting #194

Closed lexiismadd closed 1 year ago

lexiismadd commented 1 year ago

Prerequisites

Steps to reproduce

I've noticed that the column formatting in Out-ConsoleGridView can be off / aligned poorly with the column headings if there are empty values passed to the function.

Expected behavior

> $Object = [PSCustomObject]@{
    Column1 = "blah"
    Column2 = ""
    Column3 = "blah3"
}
> $Object | Out-ConsoleGridView

Columns for each object member in the view are aligned

Actual behavior

> $Object = [PSCustomObject]@{
    Column1 = "blah"
    Column2 = ""
    Column3 = "blah3"
}
> $Object | Out-ConsoleGridView

Columns for each object member in the view are misaligned

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.3.4
PSEdition                      Core
GitCommitId                    7.3.4
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

latest

Visuals

image

tig commented 1 year ago

This is fixed in the master branch via https://github.com/PowerShell/GraphicalTools/pull/185

image

When @andschwa / @SteveL-MSFT can get to it, they'll do a new release.

andyleejordan commented 1 year ago

Working on it!

tig commented 1 year ago

Working on it!

Remind me what needs to happen for Install-Module Microsoft.PowerShell.ConsoleGuiTools to pull down the latest version?

andyleejordan commented 1 year ago

It should just do it:

@andyswokmacbook ~ 
> Install-Module -Name Microsoft.PowerShell.ConsoleGuiTools

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this 
repository, change its InstallationPolicy value by running the Set-PSRepository
 cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help 
(default is "N"):y
@andyswokmacbook ~ 
> Import-Module Microsoft.PowerShell.ConsoleGuiTools                            @andyswokmacbook ~ 
> Get-Module Microsoft.PowerShell.ConsoleGuiTools   

ModuleType Version    PreRelease Name                                ExportedCo
                                                                     mmands
---------- -------    ---------- ----                                ----------
Binary     0.7.3                 Microsoft.PowerShell.ConsoleGuiToo… {Out-Cons…

@andyswokmacbook ~ 
>