This commit is contained in:
JOLIMAITRE Matthieu 2024-03-27 02:21:34 +01:00
commit 02515c9675
17 changed files with 1653 additions and 0 deletions

33
README.md Normal file
View file

@ -0,0 +1,33 @@
# 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
- [deno](https://deno.land/)
- [clang-format](https://clang.llvm.org/docs/ClangFormat.html) (comes with most distribution of clang)
```sh
./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`