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

[Suggestion] Include a switch to disable the "Category" output #1

Open
Nevember opened this issue Jun 1, 2021 · 1 comment
Open

Comments

@Nevember
Copy link

Nevember commented Jun 1, 2021

First off, I want to say "Thank you" for this invaluable tool. For PS scripting, I don't know how folks can go without having this--it makes everything so much easier! Before finding your tool, I spent hours upon hours trying to find something like this, and had even started to play with idea of making something myself. The beauty of this tool is that it is able to get the folder info without having to be fed anything first.

As you know, this tool provides a wealth of information, especially with the -All parameter. However, because there are just so many special folders, I've found that the Category titles tend to get in the way when I'm trying to find what I'm looking for.

Typically, I pipe your cmdlet's output to Select-Object Name,Path,FolderId | Sort-Object Path; in fact, I keep a profile variable handy with that information. I was super excited to see that you're still working on this (I happened to stumble onto your feedback over in the PowerShell/PowerShell git), so I thought I'd drop off the suggestion to create a switch parameter that would disable the Category output altogether. It's just a small QOL suggestion, and I'd understand if you have bigger fish to fry. :)

Anyway, thanks again for your work!!!

@jberezanski
Copy link
Owner

Thanks for the kind words!

The formatting of the output is not controlled by the cmdlets - Get-KnownFolder simply returns a flat list of objects. But the module includes a .format.ps1xml file, which provides hints to PowerShell on how to format the output by default. (about_Format.ps1xml describes this functionality.)

The easiest way, I believe, to suppress grouping by category is to pass -GroupBy <some_nonexistent_property> to Format-Table, e.g.:

Get-KnownFolder -All | ft -GroupBy none

or, perhaps more useful, with sorting:

Get-KnownFolder -All | sort Name | ft -GroupBy none

I could also add a second view definition to the ps1xml, selectable via -View, for example: Get-KnownFolder -All | ft -View Flat, although I don't think it would provide much improvement over -GroupBy none and it would obviously cost some work.

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

No branches or pull requests

2 participants