Is there a PowerShell code formatter / pretty printer? [closed] - powershell

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
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?

UPDATE: it's now on GitHub: https://github.com/DTW-DanWard/PowerShell-Beautifier
I wrote a PowerShell pretty printer / code cleaner in PowerShell. It cleans white space, indents code groups, replaces aliases with commands, fixes casing on commands, parameters, types, etc. You can use it to reformat a file in place or read a source file and output the result in a different file.
More info:
http://danspowershellstuff.blogspot.com/2012/03/powershell-pretty-printer-code-cleaner.html
Download page:
http://www.dtwconsulting.com/PS/Module_PrettyPrinterV1.htm
Let me know what you'd like to see changed/configurable/etc.

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 Where are the default aliases defined in powershell? for some discussion.

Take a look at ScriptCop.
Props to Mike Shepard - I found this from his answer here.

Related

Where can I find an official complete list of scopes to go with textMateRules for C#/.NET core in Visual Studio Code? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
So far I checked out a request at https://github.com/Microsoft/vscode/issues/6056 which was closed based on Complete list of theme elements to colorize?. This in turn send to https://code.visualstudio.com/docs/getstarted/themes and https://code.visualstudio.com/docs/getstarted/theme-color-reference but there's no information on scopes.
The closest inspiration source I could found was https://github.com/Microsoft/vscode/blob/master/extensions/theme-defaults/themes/hc_black.json but it's far from a Microsoft issued official complete, systematic list/tree of C# specific scopes.
If it matters, it started from the need to color-differentiate variables by scope i.e. local vs. outer scope, or by access modifier i.e. private protected etc.
Scope names are arbitrary. You can use whatever names you want when writing a language grammar.
Because of that, there is no way to get a complete list of those names.
The official conventions for naming scopes can be found here. This page offers only the most basic guidance, so you'll need to look at some popular themes and grammars and figure out what conventions they use.
EDIT:
If you're interested specifically in C# scope names, you can get them from the corresponding grammar file at C:\Users\<username>\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\csharp\syntaxes\csharp.tmLanguage.json.

Looking for a patch utility can generate exe file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I need a patch utility which generates an exe file from the differences of 2 binaries. Then, end-users only need to run that exe file, point to the old version and apply patch.
I finally found it on my own. It's diablo2oo2's Universal Patcher - [dUP]
I've used xdelta or bsdiff before for very similar purposes. Unlike the standard diff tool, these tools will work properly with binary files. (As your post implies Windows, there are Windows ports available for each of these - or you can use Cygwin.)
These tools won't create a patching exe for you, however. You could still use these tools to get the difference of the binary files, then package everything into an exe to your requirements. I'm not personally and specifically aware of any tool that does all of what you're looking for - but I believe they exist, and most of them are probably commercial products - and giving specific product recommendations is off-topic for SO.

Powershell online interpreter? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Is there online Powershell interpreter available on the Internet? I mean like trypython for Python programming language.
Full disclosure: I am the owner of Try It Online.
TIO Nexus has a Powershell interpreter as of a few days ago. It uses Powershell v6.0.0-alpha.13, which is the latest release of Powershell for Linux.
I've re-enabled these aliases – which conflict with POSIX utilities of the same name on *nix – to make the online interpreter more similar to Powershell on Windows. Powershell Core has only the aliases the developers deem fit for *nix.
Not that I know of, but PowerShell 3.0 has an installable web-based console that is a component of Windows Server. Full intellisense, the works. Very similar to the try* series. Download v3 and try it yourself.
Tutorialspoint offer an online PowerShell interpreter (amongst dozens of other programming environments) on their CodingGround site.
In reality, it's not a true PowerShell interpreter but a PASH shell, which is the Mono adaptation of Microsoft's scripting tool. Still, the syntax and standard cmdlets should be the same. However, you'll find it lacks or has different environment variables and other implementation-specific elements.

Document Generator for library iphone [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I have created one library, and now I want to have its documentation, so Is there any document generator available? If yes, What I have to keep in mind while generating documents.
http://www.doxygen.nl/
Doxygen is probably the most widely used option. Because it's not just for ObjC (doxygen supports many other languages), the development is lively and the community quite strong. HeaderDoc (now an open source project), by comparison appears to have largely stagnated. HeaderDoc only produces HTML output, while doxygen also produces PDF, LaTeX and many other output forms besides HTML. Even seems to recommend doxygen, with this guide to automatically producing documentation sets, compatible with 's help viewer, from within your build process.
It's worth noting that doxygen can read HeaderDoc-style comments, so you can write your documentation in HeaderDoc style and decide later whether to produce the final output using doxygen or HeaderDoc.

Which is the recommended groovy plugin for Emacs? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
When looking for a simple groovy mode plugin for emacs to get indenting and some form of syntax highlighting, I found 3 version on the groovy website.
This page is excellent at giving the overview and some down in the weeds details, however is a bit skimpy on why to choose one over the other.
There is Jeremy Rayner's groovy-mode.el which isn't painful
There is Russel Winder's identically named groovy-mode.el which is based on cc-mode.
There Stuart Clayman inferioir groovy mode inf-groovy.el
Currently I am drawn toward Jeremy's plugin, but I feel that being not painful is a poor reason to choose one over the others.
I'd like to know which ones are recommended or which ones are to be avoided?
Things changed a bit since ataylor's answer: now (March 2017) the official Groovy website links to Emacs-Groovy-Mode which combines Russel Winder's and Stuart Clayman's work.
As we may expect, the repo is available on Github.
I use Jeremy Ranyer's groovy-mode.el for the sole reason that it worked better with my code then Russel Winder's version, at the time I tested them.
Here's a small modification I've added to Rayner's that fixes some problems (the elvis operator, if I recall correctly):
(defconst groovy-block-mid-re
"need something here or it blows up"
)