@@ -1212,9 +1212,10 @@ static char *opt_set_announce_dns(const char *optarg, struct lightningd *ld)
12121212static void register_opts (struct lightningd * ld )
12131213{
12141214 /* This happens before plugins started */
1215- opt_register_early_noarg ("--test-daemons-only" ,
1216- test_subdaemons_and_exit ,
1217- ld , opt_hidden );
1215+ clnopt_noarg ("--test-daemons-only" , OPT_EARLY |OPT_EXITS ,
1216+ test_subdaemons_and_exit ,
1217+ ld ,
1218+ "Test that subdaemons can be run, then exit immediately" );
12181219 /* Register plugins as an early args, so we can initialize them and have
12191220 * them register more command line options */
12201221 clnopt_witharg ("--plugin" , OPT_MULTI |OPT_EARLY ,
@@ -1283,8 +1284,8 @@ static void register_opts(struct lightningd *ld)
12831284 opt_set_announce_dns , NULL ,
12841285 ld , opt_hidden );
12851286
1286- opt_register_noarg ("--help|-h" , opt_lightningd_usage , ld ,
1287- "Print this message." );
1287+ clnopt_noarg ("--help|-h" , OPT_EXITS ,
1288+ opt_lightningd_usage , ld , "Print this message." );
12881289 opt_register_arg ("--rgb" , opt_set_rgb , opt_show_rgb , ld ,
12891290 "RRGGBB hex color for node" );
12901291 opt_register_arg ("--alias" , opt_set_alias , opt_show_alias , ld ,
@@ -1550,9 +1551,9 @@ void handle_early_opts(struct lightningd *ld, int argc, char *argv[])
15501551 setup_option_allocators ();
15511552
15521553 /*~ List features immediately, before doing anything interesting */
1553- opt_register_early_noarg ("--list-features-only" ,
1554- list_features_and_exit ,
1555- ld , opt_hidden );
1554+ clnopt_noarg ("--list-features-only" , OPT_EARLY | OPT_EXITS ,
1555+ list_features_and_exit ,
1556+ ld , "List the features configured, and exit immediately" );
15561557
15571558 /*~ This does enough parsing to get us the base configuration options */
15581559 ld -> configvars = initial_config_opts (ld , & argc , argv , true,
@@ -1710,17 +1711,19 @@ static void add_config(struct lightningd *ld,
17101711 if (opt -> type & OPT_DEV )
17111712 return ;
17121713
1714+ /* Ignore things which just exit */
1715+ if (opt -> type & OPT_EXITS )
1716+ return ;
1717+
1718+ /* Ignore hidden options (deprecated) */
1719+ if (opt -> desc == opt_hidden )
1720+ return ;
1721+
17131722 if (opt -> type & OPT_NOARG ) {
1714- if (opt -> desc == opt_hidden ) {
1715- /* Ignore hidden options (deprecated) */
1716- } else if (opt -> cb == (void * )opt_usage_and_exit
1717- || opt -> cb == (void * )version_and_exit
1718- || is_restricted_ignored (opt -> cb )
1719- || opt -> cb == (void * )opt_lightningd_usage
1720- || opt -> cb == (void * )test_subdaemons_and_exit
1721- /* FIXME: we can't recover this. */
1722- || opt -> cb == (void * )opt_clear_plugins ) {
1723- /* These are not important */
1723+ if (opt -> cb == (void * )opt_clear_plugins ) {
1724+ /* FIXME: we can't recover this. */
1725+ } else if (is_restricted_ignored (opt -> cb )) {
1726+ /* --testnet etc, turned into --network=. */
17241727 } else if (opt -> cb == (void * )opt_set_bool ) {
17251728 const bool * b = opt -> u .carg ;
17261729 json_add_bool (response , name0 , * b );
@@ -1775,9 +1778,7 @@ static void add_config(struct lightningd *ld,
17751778 errx (1 , "Unknown decode for %s" , opt -> names );
17761779 }
17771780 } else if (opt -> type & OPT_HASARG ) {
1778- if (opt -> desc == opt_hidden ) {
1779- /* Ignore hidden options (deprecated) */
1780- } else if (opt -> show == (void * )opt_show_charp ) {
1781+ if (opt -> show == (void * )opt_show_charp ) {
17811782 if (* (char * * )opt -> u .carg )
17821783 /* Don't truncate or quote! */
17831784 answer = tal_strdup (tmpctx ,
0 commit comments