Skip to content

Commit 25e3a67

Browse files
committed
New: RenderReadmeForGroup to build markdown files
1 parent 159b4df commit 25e3a67

3 files changed

Lines changed: 468 additions & 172 deletions

File tree

source/readme.build.ps1

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,27 @@ function FormatPqSourceItem {
1616
build metadata on the objects, making source generation easier
1717
.NOTES
1818
if already is formatted, don't mutate it again, return as a no-op.
19+
20+
now you can pipe directly from native command too
21+
22+
.EXAMPLE
23+
fd inspect.type | gi | FormatPqSourceItem
24+
25+
# auto converts to Item if it's a string
26+
fd inspect.type | FormatPqSourceItem
27+
28+
# and duplicate calls are safe
29+
fd inspect.type | FormatPqSourceItem | FormatPqSourceItem # no-op return
1930
#>
2031
[CmdletBinding()]
21-
param( [Parameter(Mandatory, ValueFromPipeline)] $InObj )
32+
param(
33+
# Pass either file info, or paths as a string
34+
[Parameter(Mandatory, ValueFromPipeline)] $InObj
35+
)
2236
process {
37+
if( $InObj -is [string] ) {
38+
$InObj = Get-Item -ea 'stop' $InObj
39+
}
2340

2441
if( $InObj.pstypenames -contains 'PqLibSourceItem' ) {
2542
return $InObj
@@ -194,7 +211,7 @@ $group_byParent = $find_pq | Group DirectoryBaseName
194211
# $group_byRelPath = $find_pq | Group RelativePath
195212
$group_byDirectory = $find_pq | Group Directory
196213

197-
# RenderReadmeForGroup -GroupedBy $group_byRelpath -PathOutput 'readme.byRelpath.md'
214+
RenderReadmeForGroup -GroupedBy $group_byRelpath -PathOutput 'readme.byRelpath.md'
198215
RenderReadmeForGroup -GroupedBy $group_byDirectory -PathOutput 'readme.byDirectory.md'
199216
RenderReadmeForGroup -GroupedBy $group_byParent -PathOutput 'readme.byParent.md'
200217

0 commit comments

Comments
 (0)