jdhitsolutions / PSScriptTools

:wrench: :hammer: A set of PowerShell functions you might use to enhance your own functions and scripts or to facilitate working in the console. Most should work in both Windows PowerShell and PowerShell 7, even cross-platform. Any operating system limitations should be handled on a per command basis. The Samples folder contains demonstration script files
MIT License
875 stars 110 forks source link

ConvertTo-Markdown add '-Transpose' option to the -AsTable parameter #114

Closed martincaddick closed 2 years ago

martincaddick commented 2 years ago

Is your feature request related to a problem? Please describe. No problem, feature request

Describe the solution you'd like Running this command produces the desired details however I get a 1 row, very wide table. It would be awesome to be able to pass an additional parameter of -Transpose that would convert the columns to rows Get-SPOTenant | ConvertTo-MDTest -AsTable -Title "SharePoint" -PreContent "url of the SharePoint admin page" | Add-Content -Path .\SharePoint365.md

Describe alternatives you've considered I've previously used PSWriteWord with the -transpose switch that produced the desired outcome but I want to output in markdown tables. https://github.com/EvotecIT/PSWriteWord/blob/master/README.md

Additional context Add any other context or screenshots about the feature request here. image

jdhitsolutions commented 2 years ago

I'll take a look.

jdhitsolutions commented 2 years ago

I finally got a chance to look at this. The default output is a list. The AsTable parameter allows you to force a table if you know it will fit your needs.

image

I think if you run your command without AsTable you'll get the results you are expecting.

jdhitsolutions commented 2 years ago

Markdown lists don't really have any sort of style as a table.

image

jdhitsolutions commented 2 years ago

But maybe...after playing a bit with markdown, this might be what you are after.

Id 37920
Handles 951
WS 206761984
PM 153714688
Name pwsh
Path C:\Program Files\PowerShell\7\pwsh.exe
StartTime 11/30/2021 9:05:28 AM

Although there's no way to suppress that blank column headings.

jdhitsolutions commented 2 years ago

Yet another option, but I don't think there is a way to force alignment.

Id : 37920
Handles : 951
WS : 206761984
PM : 153714688
Name : pwsh
Path : C:\Program Files\PowerShell\7\pwsh.exe
StartTime : 11/30/2021 9:05:28 AM

jdhitsolutions commented 2 years ago

I've added support for this in v2.40.0 of the module,