MCPcopy Create free account
hub / github.com/3rdparty/libprocess / add

Method add

src/help.cpp:101–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99
100
101void Help::add(
102 const string& id,
103 const string& name,
104 const Option<string>& help)
105{
106 // TODO(benh): Enable help for help.
107 if (id != "help" && id != "__processes__") {
108 // Remove tail slash in usage information.
109 const string path = "/" + getUsagePath(id, name);
110
111 if (help.isSome()) {
112 string usage = "### USAGE ###\n";
113 // If a delegate is set, we have 2 valid endpoints we could hit.
114 // /name *and* /id/name. Add it in.
115 if (delegate == id) {
116 usage += USAGE(getUsagePath("", name));
117 }
118 usage += USAGE(path) + "\n";
119 helps[id][name] = usage + help.get();
120 } else {
121 helps[id][name] = "## No help page for `" + path + "`\n";
122 }
123
124 route("/" + id, "Help for " + id, &Help::help);
125 }
126}
127
128
129bool Help::remove(const string& id, const string& name)

Callers

nothing calls this directly

Calls 2

USAGEFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected