A simple and configurable program for counting lines in files
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
CMake
fmt @ da55e96
src
yaml-cpp @ b87c76a
.computare.yml
.gitignore
.gitmodules
CMakeLists.txt
LICENSE
README.md
postbuild_clean.py
prebuild_config.py

README.md

computare

Github Releases

A simple and configurable for counting lines in files as an alternative to programs like cloc written in C++. I was becoming bothered with how cloc handled ignoring files, as I'll integrate some libraries directly in my source folder as opposed to an external folder, thus I wanted to mainly ignore specific files. I also wanted something faster and more extensible, so I made this.

Installing

Download the latest binary release in the releases page.

Building

Computare uses CMake for building. Build using your favorite compiler chain and run the executable that results from the build. On my personal development machine, I compile this using Clang 7 on KUbuntu 18.10, which works well.

Dependencies

Computare depends on cxxopts for parsing command line arguments for the program as well as fmt for nice print formatting and yaml-cpp for the config.

Usage

To use computare, you can run the program with a single file using the -f switch and then the path to the file, an example is below:

computare -f main.cpp

Though, the main function of this program is the directory walker for a project's source code, this can be specified with the -d flag with the path to the directory to walk recursively. An example is below to walk the current directory:

computare -d .

You may use the -h or --help flags to see the full list of switches for the program.

Configuration

Computare is meant to be configured to change languages supported or files to ignore. These options are configured with a file named .computare.yml. These are the supported options. A default configuration is placed into your home directory at ~/.computare.yml with language definitions and default settings.

block-size

Changes the size of blocks to be read from a file when counting lines. Default:

block-size: 131072

ignore-hidden

Specifies whether or not hidden files and directories should be ignored. Default:

ignore-hidden: true

languages

An array of language blocks containing information on language name, associated extensions, and comment tokens. Check the root .computare.yml to see how to structure these blocks and add your own.

ignore

An array of files and/or directories to ignore and skip over when counting lines. Default is blank.

License

Computare is licensed under the MIT License, the terms of which can be seen here.