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

Function main

tests/plugins/test_libplugin.c:375–424  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

373};
374
375int main(int argc, char *argv[])
376{
377 setup_locale();
378 /* We allocate now, so we can hand pointers for plugin options,
379 * but by specifying take() to plugin_main, it reparents it to
380 * the plugin */
381 struct test_libplugin *tlp = tal(NULL, struct test_libplugin);
382 tlp->somearg = NULL;
383 tlp->self_disable = false;
384 tlp->dont_shutdown = false;
385 tlp->dynamic_opt = 7;
386 tlp->strarr = tal_arr(tlp, const char *, 0);
387
388 plugin_main(argv, init, take(tlp), PLUGIN_RESTARTABLE, true, NULL,
389 commands, ARRAY_SIZE(commands),
390 notifs, ARRAY_SIZE(notifs), hooks, ARRAY_SIZE(hooks),
391 NULL, 0, /* Notification topics we publish */
392 plugin_option("somearg",
393 "string",
394 "Argument to print at init.",
395 charp_option, charp_jsonfmt, &tlp->somearg),
396 plugin_option_deprecated("somearg-deprecated",
397 "string",
398 "Deprecated arg for init.",
399 CLN_NEXT_VERSION, NULL,
400 charp_option, charp_jsonfmt,
401 &tlp->somearg),
402 plugin_option("selfdisable",
403 "flag",
404 "Whether to disable.",
405 flag_option, flag_jsonfmt,
406 &tlp->self_disable),
407 plugin_option("dont_shutdown",
408 "flag",
409 "Whether to timeout when asked to shutdown.",
410 flag_option, flag_jsonfmt,
411 &tlp->dont_shutdown),
412 plugin_option_dynamic("dynamicopt",
413 "int",
414 "Set me!",
415 set_dynamic, u32_jsonfmt,
416 &tlp->dynamic_opt),
417 plugin_option_multi("multiopt",
418 "string",
419 "Set me multiple times!",
420 multi_string_option,
421 string_array_jsonfmt,
422 &tlp->strarr),
423 NULL);
424}

Callers

nothing calls this directly

Calls 3

setup_localeFunction · 0.85
plugin_mainFunction · 0.50
plugin_optionClass · 0.50

Tested by

no test coverage detected