I am running following command:
"C:\Software\cloc 1.62\cloc-1.62.exe" "ProjectPath" --xml --exclude-dir=packages,bin,obj >> CodeCounttest.xml
It shows result like below:
100 files
135 text files.
classified 135 files
Duplicate file check 135 files (117 known unique)
Unique: 100 files
119 unique files.
Counting: 100
171 files ignored.
<?xml version="1.0"?><results>
<header>
<cloc_url>http://cloc.sourceforge.net</cloc_url>
<cloc_version>1.62</cloc_version>
<elapsed_seconds>8.29936003684998</elapsed_seconds>
<n_files>93</n_files>
<n_lines>126092</n_lines>
<files_per_second>11.2056832800446</files_per_second>
<lines_per_second>15192.9786682514</lines_per_second>
</header>
<languages>
<language name="XML" files_count="6" blank="51" comment="29" code="38966" />
<language name="Javascript" files_count="16" blank="5633" comment="8243" code="33120" />
<language name="TypeScript" files_count="15" blank="3849" comment="3017" code="17014" />
<language name="C#" files_count="20" blank="542" comment="525" code="3862" />
<language name="CSS" files_count="6" blank="260" comment="128" code="2562" />
<language name="MSBuild script" files_count="10" blank="0" comment="57" code="2197" />
<language name="WiX source" files_count="2" blank="7" comment="17" code="1946" />
<language name="Razor" files_count="5" blank="331" comment="960" code="1331" />
<language name="HTML" files_count="3" blank="76" comment="0" code="844" />
<language name="ASP.Net" files_count="8" blank="12" comment="0" code="327" />
<language name="JSON" files_count="1" blank="3" comment="0" code="29" />
<language name="PowerShell" files_count="1" blank="4" comment="139" code="11" />
<total sum_files="93" blank="10768" comment="13115" code="102209" />
</languages>
</results>
I just need the XML result without having the information before the XML.
How to exclude that? Either by cloc
command or if there is a way in PowerShell to get the XML alone then that is also OK at the least?
Run cloc
with the parameter --quiet
to suppress information messages.
From the man page:
Output Options
[…]
--quiet
Suppress all information messages except for the final report.