You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add Format-PowerShellDataFile function for normalization #13
Hand-written PSD1 files often have inconsistent indentation, key alignment, and value formatting. A Format-PowerShellDataFile function normalizes the text without changing semantics — equivalent to ConvertFrom-PowerShellDataFile | ConvertTo-PowerShellDataFile but expressed as a single ergonomic call.
Sister modules already follow this pattern: Format-Json and Format-Hashtable. PSD1 is the natural place to land canonical-form module manifests in CI workflows.
Output round-trips: ConvertFrom-PowerShellDataFile produces equivalent objects from input and formatted output
Output passes Test-ModuleManifest when the input is a valid module manifest
-Indent controls spacing between nested table levels
-AlignValues produces aligned-column output (matches the New-ModuleManifest style)
Technical decisions
Implementation: Parses input with ConvertFrom-PowerShellDataFile and re-emits with ConvertTo-PowerShellDataFile using the requested indentation and alignment. Reuses existing logic — no new parser or emitter.
Function placement:src/functions/public/Format-PowerShellDataFile.ps1.
Parameter sets:InputObject (default, pipeline) and Path / LiteralPath for file input.
Indent default: 4 spaces — matches the convention used by New-ModuleManifest output.
Alias:Format-Psd1.
Implementation plan
Add Format-PowerShellDataFile in src/functions/public/Format-PowerShellDataFile.ps1 with Format-Psd1 alias
Add Pester tests — basic format, custom -Indent, -AlignValues, idempotent round-trip, manifest validation after format
Update README and examples/General.ps1
Related
ConvertFrom/ConvertTo-PowerShellDataFile (prerequisite — separate issue)
Activity