Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConvertTo-WikiTable | ConvertTo-WikiStorageFormat issue #1

Closed
jdubbbb opened this issue Aug 30, 2016 · 2 comments
Closed

ConvertTo-WikiTable | ConvertTo-WikiStorageFormat issue #1

jdubbbb opened this issue Aug 30, 2016 · 2 comments

Comments

@jdubbbb
Copy link

jdubbbb commented Aug 30, 2016

It seems like ConvertTo-WikiTable should return a string instead of an array.

Get-Service | select name,status -First 3 | ConvertTo-WikiTable | ConvertTo-WikiStorageFormat

I get multiple tables for each row:

<table><tbody>
<tr>
<th><p>Name</p></th>
<th><p>Status</p></th>
</tr>
</tbody></table>

<table><tbody>
<tr>
<td><p>AdobeARMservice</p></td>
<td><p>Running</p></td>
</tr>
</tbody></table>

<table><tbody>
<tr>
<td><p>AeLookupSvc</p></td>
<td><p>Stopped</p></td>
</tr>
</tbody></table>

<table><tbody>
<tr>
<td><p>ALG</p></td>
<td><p>Stopped</p></td>
</tr>
</tbody></table>

I tried a lot of combinations to try to get one table but finally figured out out-string fixes it:

Get-Service | select name,status -First 3 | ConvertTo-WikiTable | out-string | ConvertTo-WikiStorageFormat

<table><tbody>
<tr>
<th><p>Name</p></th>
<th><p>Status</p></th>
</tr>
<tr>
<td><p>AdobeARMservice</p></td>
<td><p>Running</p></td>
</tr>
<tr>
<td><p>AeLookupSvc</p></td>
<td><p>Stopped</p></td>
</tr>
<tr>
<td><p>ALG</p></td>
<td><p>Stopped</p></td>
</tr>
</tbody></table>

Or maybe ConvertTo-WikiStorage should convert it to string. Or at least somewhere in the help documentation mentioning Out-String for ConvertTo-WikiTable.

@brianbunke
Copy link
Collaborator

Hey, thanks! Those are helpful examples. I'm at VMworld right now, but will definitely review next week.

brianbunke added a commit that referenced this issue Sep 5, 2016
Improve performance of row array generation by using ArrayList.
Out-String the array. Add an example. Improve code readability.
@brianbunke brianbunke self-assigned this Sep 5, 2016
@brianbunke
Copy link
Collaborator

Resolved in a8bef87

Decided to Out-String the output of ConvertTo-WikiTable. The previous output was an array of row strings, which wasn't intended. This way also still allows multiple tables to be piped into ConvertTo-WikiStorageFormat at once, if desired.

Added an example to address this common use case, which I had already referenced in the description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants