jarro2783 / cxxopts

Lightweight C++ command line option parser
MIT License
4.17k stars 582 forks source link

Introduce a format file #341

Closed eyalroz closed 2 years ago

eyalroz commented 2 years ago

For people working on this repository, it would be nice to have a clang-format file, or some other format, which defines indentation and format so that we don't mess them up.

randydu commented 10 months ago

It is better to provide a "complete" .clang-format file to avoid incompatibility of clang-format versions.

The complete format settings can be generated as following:

clang-format --style=file --dump-config > .clang-format.all

The current ".clang-format" relies on the default settings of clang-format version:

---
Language:        Cpp
BasedOnStyle:  LLVM
AccessModifierOffset: 0
...

As a result, after I've cloned the source code and reformat it in my own IDE (VSCode) with different clang-format version installed, the source code is reformatted with huge difference. I cannot find a correct .clang-format file to exactly match the original file format settings because the inherited clang-format settings (BasedOnStyle: LLVM) is unknown (version dependent).

jarro2783 commented 10 months ago

That's probably because I never formatted the whole thing.