| 12 | } |
| 13 | |
| 14 | static void write_table_entry(std::ofstream & file, const common_arg & opt) { |
| 15 | file << "| `"; |
| 16 | // args |
| 17 | for (const auto & arg : opt.args) { |
| 18 | if (arg == opt.args.front()) { |
| 19 | file << arg; |
| 20 | if (opt.args.size() > 1) file << ", "; |
| 21 | } else { |
| 22 | file << arg << (arg != opt.args.back() ? ", " : ""); |
| 23 | } |
| 24 | } |
| 25 | // value hint |
| 26 | if (opt.value_hint) { |
| 27 | std::string md_value_hint(opt.value_hint); |
| 28 | string_replace_all(md_value_hint, "|", "\\|"); |
| 29 | file << " " << md_value_hint; |
| 30 | } |
| 31 | if (opt.value_hint_2) { |
| 32 | std::string md_value_hint_2(opt.value_hint_2); |
| 33 | string_replace_all(md_value_hint_2, "|", "\\|"); |
| 34 | file << " " << md_value_hint_2; |
| 35 | } |
| 36 | // help text |
| 37 | std::string md_help(opt.help); |
| 38 | string_replace_all(md_help, "\n", "<br/>"); |
| 39 | string_replace_all(md_help, "|", "\\|"); |
| 40 | file << "` | " << md_help << " |\n"; |
| 41 | } |
| 42 | |
| 43 | static void write_table(std::ofstream & file, std::vector<common_arg *> & opts) { |
| 44 | write_table_header(file); |
no test coverage detected