MCPcopy Create free account
hub / github.com/ElementsProject/lightning / json_listconfigs

Function json_listconfigs

lightningd/configs.c:261–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261static struct command_result *json_listconfigs(struct command *cmd,
262 const char *buffer,
263 const jsmntok_t *obj UNNEEDED,
264 const jsmntok_t *params)
265{
266 struct json_stream *response = NULL;
267 const struct opt_table *config;
268
269 if (!param(cmd, buffer, params,
270 p_opt("config", param_opt_config, &config),
271 NULL))
272 return command_param_failed();
273
274 response = json_stream_success(cmd);
275 json_object_start(response, "configs");
276 for (size_t i = 0; i < opt_count; i++) {
277 const char **names;
278
279 /* FIXME: Print out comment somehow? */
280 if (opt_table[i].type == OPT_SUBTABLE)
281 continue;
282
283 if (config && config != &opt_table[i])
284 continue;
285
286 names = opt_names_arr(tmpctx, &opt_table[i]);
287 /* We don't usually print dev or deprecated options, unless
288 * they explicitly ask, or they're set. */
289 json_add_config(cmd->ld, response, config != NULL, true,
290 &opt_table[i], names);
291 }
292 json_object_end(response);
293
294 return command_success(cmd, response);
295}
296
297static const struct json_command listconfigs_command = {
298 "listconfigs",

Callers

nothing calls this directly

Calls 8

json_object_startFunction · 0.85
opt_names_arrFunction · 0.85
json_add_configFunction · 0.85
json_object_endFunction · 0.85
command_param_failedFunction · 0.70
json_stream_successFunction · 0.70
command_successFunction · 0.70
paramFunction · 0.50

Tested by

no test coverage detected