MCPcopy Create free account
hub / github.com/crownengine/crown / command_help

Function command_help

src/device/console_server.cpp:142–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140 }
141
142 static void command_help(ConsoleServer &cs, u32 client_id, const JsonArray &args, void * /*user_data*/)
143 {
144 if (array::size(args) != 1) {
145 cs.error(client_id, "Usage: help");
146 return;
147 }
148
149 u32 longest = 0;
150
151 auto cur = hash_map::begin(cs._commands);
152 auto end = hash_map::end(cs._commands);
153 for (; cur != end; ++cur) {
154 HASH_MAP_SKIP_HOLE(cs._commands, cur);
155
156 if (longest < strlen32(cur->second.name))
157 longest = strlen32(cur->second.name);
158 }
159
160 cur = hash_map::begin(cs._commands);
161 end = hash_map::end(cs._commands);
162 for (; cur != end; ++cur) {
163 HASH_MAP_SKIP_HOLE(cs._commands, cur);
164
165 logi(CONSOLE_SERVER, "%s%*s%s"
166 , cur->second.name
167 , longest - strlen32(cur->second.name) + 4
168 , " "
169 , cur->second.brief
170 );
171 }
172 }
173
174 static u32 add_client(ConsoleServer &cs, const TCPSocket &socket)
175 {

Callers

nothing calls this directly

Calls 4

sizeFunction · 0.50
beginFunction · 0.50
endFunction · 0.50
errorMethod · 0.45

Tested by

no test coverage detected