function Get-CommandDefinitionHtml {
# this tells powershell to allow advanced features,
# like the [validatenotnullorempty()] attribute below.
[CmdletBinding()]
param(
[ValidateNotNullOrEmpty()]
[string]$name
)
$command = get-command $name
# Look mom! I'm a cmdlet!
$PSCmdlet.WriteVerbose("Dumping HTML for " + $command)
@"
$($command.name)
$(
$command.parametersets | % {
@"
$($_.name) |
Parameters |
$(
$count = 0
$_.parameters | % {
if (0 -eq ($count % 8)) {
@'
'@
}
@"
$($_.name) |
"@
$count++
}
)
|
"@
}
)
"@
}
Get-CommandDefinitionHtml get-item > out.html
# show in browser
invoke-item out.html