Pierwsza funkcja już jest:
function Get-Loc
{
param($location="."
)
$commandLine = "$location --csv"
$clocResult = & $clocPath $location --csv
$indexOfLineCsvToParse = [array]::IndexOf($clocResult, "")
if($indexOfLineCsvToParse -lt 0)
{
throw "cant get empty line in cloc result"
}
$csvToparse = $clocResult[$indexOfLineCsvToParse..($clocResult.Length)]
$csvFeed = ConvertFrom-Csv $csvToparse -Delimiter ',' | select files,language,blank,comment,code
return $csvFeed | %{
return New-Object PSObject -prop @{
Files = [int]($_.files);
Language = $_.language;
Blank = [int]($_.blank);
Comment = [int]($_.comment);
Code = [int]($_.code);
}
}
}
Aby wyświetlić statystykę projektów to wystarczy wywołać:Get-Loc "C:\ProjectDir"Skrypt jest dostępny w github'a.
Brak komentarzy:
Prześlij komentarz