| 99 | |
| 100 | |
| 101 | void 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 | |
| 129 | bool Help::remove(const string& id, const string& name) |