-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGet-HelpTemplate.ps1
More file actions
51 lines (34 loc) · 837 Bytes
/
Get-HelpTemplate.ps1
File metadata and controls
51 lines (34 loc) · 837 Bytes
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
param(
[string] $commandName
)
$c = get-command $commandName
$commonParameters = @("Verbose", "Debug", "ErrorAction", "WarningAction", "ErrorVariable", "WarningVariable", "OutVariable", "OutBuffer", "WhatIf")
$parameters = @()
Write-Output @"
<#
.SYNOPSIS
.DESCRIPTION
"@
$c.Parameters.Keys | %{
if($commonParameters -contains $_) {
return
}
$parameter = $c.Parameters[$_]
$parameters += $c.Parameters[$_]
Write-Output @"
.PARAMETER $($parameter.Name)
"@
}
$parametersString = $parameters | %{
$name = $_.Name
# $value = New-Object ($_.ParameterType.FullName)
"-$($_.Name) "
}
Write-Output @"
.NOTES
Author: $env:USERNAME
Created: $([DateTime]::Today.ToString("dd MMMM yyyy"))
.EXAMPLE
$($c.Name) $parametersString
#>
"@