Graf-Zahl allows you to count the lines of code, or text in a specific directory.
There are several count modes to choose from:
Line
counts the amount of linesWord
counts the amount of wordsChar
counts the amount of charsLOC
counts the amount of lines, but categorized into code, comments, and empty linesLanguage
counts the amount of lines for each language or file type
For each of this mode you have the option to show a summary of the results, or show the results for the entire directory tree.
More information can be found by using the --help
command!
You can either install graf-zahl via the executables in the release assets. Or build the executable yourself on your
system.
For that you need cargo and the rust Toolchain for your system.
You can build the application with the cargo build --release
command to get a standalone executable, you can find
this in the /target/release/
directory.
This binary can then be placed in a folder of your choosing.
Additionally, you need to add a few config files. Where these files should be located is platform dependent:
- Windows:
%localappdata%/graf-zahl
- Linux:
/etc/opt/graf-zahl
This folder should contain two files:
ignore_list.gitingore
for which files and folders should be ignoredlanguages.txt
for defining details of programming languages and file types
ignore_list.txt
is for blacklisting folder names that should not be counted into the final total.
Matched are checked at each directory level, not only at the project root!
The Syntax is similar to a standard gitignore file. The file is parsed with the ignore crate.
languages.txt
is to allow the executable to understand the Syntax of the Language, namely how comments are defined.
Each language definition is a single line. All fields are seperated by a ,
, abd all Strings are enclosed with "
.
All fields are required, but you can leave the array empty, if your language doesn't have one of comment styles.
- the first field is the file extension. Without the separating dot!
- the second field is the Name of the Language, results with equals names are added together
- an array of symbols starting a inline comment, inline comments are which that are automatically terminated by a line break
- an array of symbols starting a block comment, block comments can span several lines and only end when a ending symbol is encountered
- an array of symbols ending a block comment
Example:
"rs", "Rust", [ "//", "///"], ["/*"], ["*/"]
stable-x86_64-pc-windows-msvc
aarch64-unknown-linux-gnu
x86_64-unknown-linux-gnu