MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / write_table_entry

Function write_table_entry

smallthinker/examples/gen-docs/gen-docs.cpp:14–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12}
13
14static 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
43static void write_table(std::ofstream & file, std::vector<common_arg *> & opts) {
44 write_table_header(file);

Callers 1

write_tableFunction · 0.85

Calls 2

string_replace_allFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected