@@ -1713,7 +1713,7 @@ static void json_add_opt_subdaemons(struct json_stream *response,
17131713}
17141714
17151715/* Canonicalize value they've given */
1716- static bool canon_bool (const char * val )
1716+ bool opt_canon_bool (const char * val )
17171717{
17181718 bool b ;
17191719 opt_set_bool_arg (val , & b );
@@ -1750,6 +1750,10 @@ static void add_config_deprecated(struct lightningd *ld,
17501750 if (opt -> desc == opt_hidden )
17511751 return ;
17521752
1753+ /* We print plugin options under plugins[] or important-plugins[] */
1754+ if (is_plugin_opt (opt ))
1755+ return ;
1756+
17531757 if (opt -> type & OPT_NOARG ) {
17541758 if (opt -> cb == (void * )opt_clear_plugins ) {
17551759 /* FIXME: we can't recover this. */
@@ -1801,12 +1805,9 @@ static void add_config_deprecated(struct lightningd *ld,
18011805 feature_offered (ld -> our_features
18021806 -> bits [INIT_FEATURE ],
18031807 OPT_QUIESCE ));
1804- } else if (opt -> cb == (void * )plugin_opt_flag_set ) {
1805- /* Noop, they will get added below along with the
1806- * OPT_HASARG options. */
18071808 } else {
18081809 /* Insert more decodes here! */
1809- errx (1 , "Unknown decode for %s" , opt -> names );
1810+ errx (1 , "Unknown nonarg decode for %s" , opt -> names );
18101811 }
18111812 } else if (opt -> type & OPT_HASARG ) {
18121813 if (opt -> show == (void * )opt_show_charp ) {
@@ -1828,7 +1829,7 @@ static void add_config_deprecated(struct lightningd *ld,
18281829 return ;
18291830 } else if (opt -> type & OPT_SHOWBOOL ) {
18301831 /* We allow variants here. Json-ize */
1831- json_add_bool (response , name0 , canon_bool (buf ));
1832+ json_add_bool (response , name0 , opt_canon_bool (buf ));
18321833 return ;
18331834 }
18341835 answer = buf ;
@@ -1889,9 +1890,7 @@ static void add_config_deprecated(struct lightningd *ld,
18891890 } else if (opt -> cb_arg == (void * )opt_important_plugin ) {
18901891 /* Do nothing, this is already handled by
18911892 * opt_add_plugin. */
1892- } else if (opt -> cb_arg == (void * )opt_add_plugin_dir
1893- || opt -> cb_arg == (void * )plugin_opt_set
1894- || opt -> cb_arg == (void * )plugin_opt_flag_set ) {
1893+ } else if (opt -> cb_arg == (void * )opt_add_plugin_dir ) {
18951894 /* FIXME: We actually treat it as if they specified
18961895 * --plugin for each one, so ignore these */
18971896 } else if (opt -> cb_arg == (void * )opt_add_accept_htlc_tlv ) {
@@ -1913,7 +1912,7 @@ static void add_config_deprecated(struct lightningd *ld,
19131912#endif
19141913 } else {
19151914 /* Insert more decodes here! */
1916- errx (1 , "Unknown decode for %s" , opt -> names );
1915+ errx (1 , "Unknown arg decode for %s" , opt -> names );
19171916 }
19181917 }
19191918
@@ -1974,6 +1973,10 @@ static const char *get_opt_val(const struct opt_table *ot,
19741973 return * (char * * )ot -> u .carg ;
19751974 }
19761975 if (ot -> show ) {
1976+ /* Plugins options' show only shows defaults, so show val if
1977+ * we have it */
1978+ if (is_plugin_opt (ot ) && cv )
1979+ return cv -> optarg ;
19771980 strcpy (buf + CONFIG_SHOW_BUFSIZE , "..." );
19781981 if (ot -> show (buf , CONFIG_SHOW_BUFSIZE , ot -> u .carg ))
19791982 return buf ;
@@ -2025,7 +2028,7 @@ static void json_add_configval(struct json_stream *result,
20252028 const char * str )
20262029{
20272030 if (ot -> type & OPT_SHOWBOOL ) {
2028- json_add_bool (result , fieldname , canon_bool (str ));
2031+ json_add_bool (result , fieldname , opt_canon_bool (str ));
20292032 } else if (ot -> type & (OPT_SHOWMSATS |OPT_SHOWINT )) {
20302033 check_literal (ot -> names , str );
20312034 json_add_primitive (result , fieldname , str );
@@ -2068,11 +2071,6 @@ static void json_add_config(struct lightningd *ld,
20682071 }
20692072
20702073 assert (ot -> type & OPT_HASARG );
2071-
2072- /* FIXME: handle plugin options: either the default or what they set */
2073- if (ot -> cb_arg == (void * )plugin_opt_set )
2074- return ;
2075-
20762074 if (ot -> type & OPT_MULTI ) {
20772075 json_object_start (response , names [0 ]);
20782076 json_array_start (response , configval_fieldname (ot ));
0 commit comments