2023-10-01 17:17:14 -07:00
|
|
|
# format_cpp.psm1
|
|
|
|
|
|
|
|
function format-cpp
|
|
|
|
{
|
|
|
|
param( $path, $include, $exclude )
|
|
|
|
|
|
|
|
# Format generated gencpp
|
|
|
|
Write-Host "Beginning format"
|
|
|
|
$formatParams = @(
|
|
|
|
'-i' # In-place
|
2023-10-06 10:06:40 -07:00
|
|
|
'-style=file:.clang-format'
|
2023-10-01 17:17:14 -07:00
|
|
|
'-verbose'
|
|
|
|
)
|
|
|
|
|
|
|
|
$targetFiles = @(
|
|
|
|
Get-ChildItem -Recurse -Path $path -Include $include -Exclude $exclude
|
|
|
|
| Select-Object -ExpandProperty FullName
|
|
|
|
)
|
|
|
|
|
|
|
|
$time_taken = Measure-Command {
|
|
|
|
clang-format $formatParams $targetFiles
|
|
|
|
}
|
|
|
|
Write-Host "Formatting complete in $($time_taken.TotalMilliseconds) ms`n"
|
|
|
|
}
|
|
|
|
|
|
|
|
Export-ModuleMember -Function format-cpp
|