I use clang-format to automatically format the code and in most cases it does it with a bang, but there is a code that it does not format as we would like.
A piece of code from the library example ( file on github ):
int main(int argc, char* argv[]) { options.add_options() ("a,apple", "an apple", cxxopts::value<bool>(apple)) ("b,bob", "Bob") ("f,file", "File", cxxopts::value<std::vector<std::string>>(), "FILE") ("i,input", "Input", cxxopts::value<std::string>()) ("o,output", "Output file", cxxopts::value<std::string>() ->default_value("a.out")->implicit_value("b.def"), "BIN") ("positional", "Positional arguments: these are the arguments that are entered " "without an option", cxxopts::value<std::vector<std::string>>()) ("long-description", "thisisareallylongwordthattakesupthewholelineandcannotbebrokenataspace") ("help", "Print help") ("int", "An integer", cxxopts::value<int>(), "N") ("option_that_is_too_long_for_the_help", "A very long option") ; } turns into something unreadable:
int main(int argc, char *argv[]) { options.add_options()("a,apple", "an apple", cxxopts::value<bool>(apple))("b,bob", "Bob")( "f,file", "File", cxxopts::value<std::vector<std::string>>(), "FILE")("i,input", "Input", cxxopts::value<std::string>())( "o,output", "Output file", cxxopts::value<std::string>()->default_value("a.out")->implicit_value( "b.def"), "BIN")("positional", "Positional arguments: these are the arguments that are entered " "without an option", cxxopts::value<std::vector<std::string>>())( "long-description", "thisisareallylongwordthattakesupthewholelineandcannotbebrokenataspace")( "help", "Print help")("int", "An integer", cxxopts::value<int>(), "N")( "option_that_is_too_long_for_the_help", "A very long option"); } .clang-format :
BasedOnStyle: LLVM IndentWidth: 2 --- Language: Cpp Standard: Cpp11 Is there any way to fix this?