forked from AlexAsplund/PSGraylog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildhelpindex.ps1
53 lines (35 loc) · 981 Bytes
/
buildhelpindex.ps1
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
param(
[switch]$Debug
)
$files = ls $PSScriptRoot\src\Public\*
$Text = cat $PSScriptRoot\HelpIndexDescripton.txt
foreach($file in $files){
$description = ((cat $file.fullname)[2] + "`n") -replace "^\s+",""
$cmdletname = $file.name -replace "\.ps1",""
$NextRowIsExample = $False
$NextRowIsDescription = $False
$Example = "`n"
$Descr = ""
(cat $file.FullName) | foreach {
if($NextRowIsExample){
$Example += "`n$_"
$NextRowIsExample = $false
}
if($_ -eq ".Example"){
$NextRowIsExample = $True
}
}
$Example += "`n"
$Text+= "### [$cmdletname]($cmdletname.md)"
$Text += "`n`n#### Description:`n`n"
$Text += "$Description"
$Text += "`n#### Example:"
$text += $Example+"`n"
$text += $cmdletinfo
}
if(!$Debug) {
$Text | Out-File -FilePath $PSScriptRoot\docs\en-us\PSGraylog.md -Force
}
else {
$Text
}