clang-format seems to make a big mess out of blocks like this:
desc.add_options()("help", "output usage")
("inputDirectory", po::value<boost::filesystem::path>()->required(), "The input path")
("outputDirectory", po::value<boost::filesystem::path>()->required(), "The output path");
I know about // clang-format off to explicitly not format a block, but is there a set of configuration rules to make it do something reasonable with this?
Not sure if you can handle it by only configuring
.clang-formatoptions. However, there is still something that you can do aboutboost::program_optionssyntax. Instead of chainingoperator()you could createprogram_options::options_descriptionobject and add options in multiple lines:Now even if clang-format breaks your formatting, I believe this will look a bit better than before. If it is not good enough for you and formatting is your pain in the neck, I'd suggest defining some function or whatever to shorten these lines (in our project we've got vector of ConfigField structures that contain value_semantic, names etc. and we iterate it calling add_options - it looks shorter).
No other way I'm afraid.
BTW: Yea, it's kinda old question, but there's no answer and we had similar problem recently.