Skip to content

Commit aea7530

Browse files
authored
Merge pull request #49 from JamesWTruher/documentation1
Add type documentation markdown
2 parents 17d60a5 + 8fea321 commit aea7530

File tree

7 files changed

+2832
-0
lines changed

7 files changed

+2832
-0
lines changed

doc/TypeDocumentation.md

Lines changed: 436 additions & 0 deletions
Large diffs are not rendered by default.

doc/assets/PS51.txt

87.1 KB
Binary file not shown.

doc/assets/PS6.txt

Lines changed: 756 additions & 0 deletions
Large diffs are not rendered by default.

doc/assets/PSS5.txt

Lines changed: 704 additions & 0 deletions
Large diffs are not rendered by default.

doc/assets/TypeComparison.csv

Lines changed: 849 additions & 0 deletions
Large diffs are not rendered by default.

doc/assets/export-TypeDoc.ps1

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
$tlist = Import-CSV TypeComparison.csv
2+
@'
3+
# PowerShell Standard Library 5
4+
5+
'@
6+
7+
$unavailableHeader = @'
8+
## Unavailable Types
9+
10+
There are a number of types which while exist in both PowerShell 5.1 and PowerShell 6, have been excluded from PowerShell Standard 5.
11+
The following lists the reason for exclusion and types excluded from PowerShell Standard 5.
12+
13+
'@
14+
15+
$unavailableTypes = $tlist |Where-Object {$_.PowerShell51 -eq "True" -and $_.PowerShell61 -eq "True" -and $_.PSStandard5 -eq "False"}
16+
17+
$unavailableHeader
18+
$unavailableTypes | Sort-Object ExclusionReason | Group-Object ExclusionReason | %{
19+
" - {0}" -f $_.Name
20+
$_.Group | %{ " - {0}" -f $_.FullName }
21+
}
22+
23+
$urlBase = "https://docs.microsoft.com/en-us/dotnet/api/"
24+
$view = "view=pscore-6.0.0"
25+
$command = "Microsoft.PowerShell.Commands.DisablePSRemotingCommand"
26+
27+
$availableTypes = $tlist |Where-Object {$_.PSStandard5 -eq "True"}
28+
$groupedTypes = $availableTypes | group { $fragments = $_.fullname.split("."); $fragments[0..($fragments.count - 2)] -join "." }
29+
30+
$typelistHeader = @'
31+
32+
## Available Types
33+
34+
The following table is a table of available types in PowerShell Standard by Namespace with links to online documentation.
35+
36+
'@
37+
38+
$ColumnCount = 2
39+
$emptyCell = "<td>&nbsp;</td>"
40+
$typelistHeader
41+
"<table>"
42+
$groupedTypes | %{
43+
$name = $_.name
44+
# Sigh - no way to span columns in markdown
45+
""
46+
"<tr><th valign='bottom' height='50' align='left' colspan='${ColumnCount}'>${name}</th></tr>"
47+
$group = $_.group
48+
# $gTypes = @($_.group | %{$_.fullname.split(".")[-1] })
49+
for($i = 0; $i -lt $group.Count; $i += ${ColumnCount} ) {
50+
$t = $group[$i..($i+${columnCount}-1)] | %{
51+
$fullname = $_.fullname -replace "``","-" # "
52+
$name = $fullname.split(".")[-1]
53+
"<td><a href='${urlBase}${fullname}?${view}'>${name}</a></td>"
54+
}
55+
# pad the collection
56+
$addlCellCount = ${ColumnCount} - @($t).Count
57+
if ( $addlCellCount -gt 0 ) {
58+
$t += @($emptyCell) * $addlCellCount
59+
}
60+
"<tr>" + ($t -join "") + "</tr>"
61+
}
62+
}
63+
"</table>"
64+
""

doc/assets/export-typecompare.ps1

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
class CommonType {
2+
[string]$Fullname
3+
[bool]$PowerShell51
4+
[bool]$PowerShell61
5+
[bool]$PSStandard5
6+
[string]$ExclusionReason
7+
CommonType([string]$n) {
8+
$this.Fullname = $n
9+
}
10+
}
11+
12+
$PS51 = Get-Content PS51.txt
13+
$PS61 = Get-Content PS6.txt
14+
$PSSA = Get-Content PSS5.txt
15+
$ALL = .{ $PS51; $PS61; $PSSA } |Sort-Object -Unique
16+
$ALL | %{
17+
$ct = [CommonType]::new($_)
18+
$ct.PowerShell51 = $PS51 -contains $_
19+
$ct.PowerShell61 = $PS61 -contains $_
20+
$ct.PSStandard5 = $PSSA -contains $_
21+
$ct
22+
} | export-csv TypeComparison.csv
23+

0 commit comments

Comments
 (0)