0

Is there a method using Windows Powershell to calculate the total line count of code within a GitHub repository?

In a GitHub repository you can see “language statistics”, which displays the percentage of the project that’s written in a language. However, it does not show how many lines of code are in the repository, which is what I'm looking for.

I'm familiar with the git ls-files command, which provides a list of files managed by git. However, my goal is to examine the content of each individual file, determine the number of lines within them, and then aggregate these counts.

The command git ls-files | xargs wc -l works seamlessly on Linux systems, but however, when dealing with Windows, we might need to look for an effective substitute for xargs to achieve a similar outcome.

I'm hoping there is a way to do this using just the Windows Powershell, and not relying on external tools such as cloc

Brian61354270
  • 8,690
  • 4
  • 21
  • 43
  • 1
    The above does not seem like a real duplicate as a question, but there's [an answer](https://stackoverflow.com/a/73102255/1057485) to your question there. – Romain Valeri Aug 18 '23 at 15:31
  • Without re-implementing these tools in PowerShell, no, not really. I use and recommend the `tokei` crate, written in Rust, so it can be installed via `cargo install tokei` or you can grab the binary from [their release page on GitHub](https://github.com/XAMPPRocky/tokei/releases/tag/v12.1.2) – Maximilian Burszley Aug 18 '23 at 17:47

0 Answers0