mirror of
https://github.com/Ed94/HandmadeHero.git
synced 2024-12-22 14:24:43 -08:00
27 lines
567 B
PowerShell
27 lines
567 B
PowerShell
# format_cpp.psm1
|
|
|
|
function format-cpp
|
|
{
|
|
param( $path, $include, $exclude )
|
|
|
|
# Format generated gencpp
|
|
Write-Host "Beginning format"
|
|
$formatParams = @(
|
|
'-i' # In-place
|
|
'-style=file:.clang-format'
|
|
'-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
|