Script to find a clang-format configuration similar to the one used to format a specific source file.
Find a file
2024-03-27 02:21:34 +01:00
.vscode Init. 2024-03-27 02:21:34 +01:00
src Init. 2024-03-27 02:21:34 +01:00
.gitignore Init. 2024-03-27 02:21:34 +01:00
build.sh Init. 2024-03-27 02:21:34 +01:00
deno.json Init. 2024-03-27 02:21:34 +01:00
README.md Init. 2024-03-27 02:21:34 +01:00

CF Guesser

Clang Format guesser.

Description

This is a script to find a clang-format configuration similar to the one used to format a specific source file.

It works by formatting copies of the provided source file with each variant of each properties and keeping the variant that least modifies the source.

Usage

Dependencies

./bin/cfguesser --help
# [cfguesser.ts] Usage: cfguesser <source_file> <config_output>

./bin/cfguesser source.c clang-format
# [cfguesser.ts] reading input from 'source.c'.
# [cfguesser.ts] scoring properties.
# [cfguesser.ts] Filtering guesses.
# [cfguesser.ts] Certainty 100 %
# [cfguesser.ts] writing config to 'clang-format'

Building

./build.sh