blob: b181955fd9bb0042d871ddbc8038488b7cb53c92 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
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)
@"
<html>
<head>
<title>$($command.name)</title>
</head>
<body>
<table border="1">
$(
$command.parametersets | % {
@"
<tr>
<td>$($_.name)</td>
<td>
<table border="1">
<tr>
<th colspan="8">Parameters</th>
$(
$count = 0
$_.parameters | % {
if (0 -eq ($count % 8)) {
@'
</tr>
<tr>
'@
}
@"
<td>$($_.name)</td>
"@
$count++
}
)
</tr>
</table>
</td>
</tr>
"@
}
)
</table>
</body>
</html>
"@
}
Get-CommandDefinitionHtml get-item > out.html
# show in browser
invoke-item out.html
|