Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

Multiline examples with comment-based help?

$
0
0

Anyone tried providing examples consisting of multiple commands through comment-based help? When I try to do this Powershell insists on treating the first line as the example, prepending a prompt and adding a blank line. So if I put:

.EXAMPLE $TheThing = Get-TheThing Frombulate-Thing -Thing $TheThing Gets the thing and frombulates it. 

This is displayed by Get-Help as

PS C:>$TheThing = Get-TheThing Frombulate-Thing -Thing $TheThing Gets the thing and frombulates it. 

It’s a minor issue but it drives me crazy. The only workaround I’ve come up with is to double space the example and insert “PS C:>” before every line except the first, but that seems terribly hacky.

The best practice answer is probably “examples should be one line,” but for some functions it’s much more effective to show how they fit into a process. I’m almost certain I’ve seen cmdlets that have multiline examples, but I can’t find one to check what their output looks like. Any ideas??

submitted by /u/cpcoffin
[link] [comments]

The post Multiline examples with comment-based help? appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Trending Articles