views:

138

answers:

2

I'm looking for a source code beautifyer for PowerShell programs. Ideally, it would be CLI based, but any solution is acceptable. I would like to avoid configuring a generic pretty printer tool; I'd like a solution that works for PowerShell out of the box. Is there such a thing?

A: 

Hi Sleepless,

I think there is no this kind of solution for PowerShell now. Cuz PowerShell is a pretty new language compared with other more mature languages.

Yousui
Thanks for the reply - I though as much since nobody replied until now. Then I'll modify my question: Which generic source code formatter could I bend into shape with the least effort?
Sleepless
Better ask new question, because nobody will see it here. You will get likely more answers.
stej
A: 

I don't know of any. However, PowerShell V2 exposes a PowerShell tokenizer you could build on: System.Management.Automation.PsParser

It might be interesting to do some "lint"-like checks, too.

For example, I think scripts should avoid using aliases that aren't marked ReadOnly, as users may have changed them. See http://stackoverflow.com/questions/2770526/where-are-the-default-aliases-defined-in-powershell/2816523#2816523 for some discussion.

Jay Bazuzi