Commit f8d541e6 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

help: print the boolean default once and on a separate line

This avoids wrapping in the middle of it and having a parenthesis after
a full point.
parent 331b0d20
...@@ -351,7 +351,7 @@ static void print_item(const module_t *m, const module_config_t *item, ...@@ -351,7 +351,7 @@ static void print_item(const module_t *m, const module_config_t *item,
# define OPTION_VALUE_SEP "=" # define OPTION_VALUE_SEP "="
#endif #endif
const char *bra = OPTION_VALUE_SEP "<", *type, *ket = ">"; const char *bra = OPTION_VALUE_SEP "<", *type, *ket = ">";
const char *prefix = NULL, *suffix = ""; const char *prefix = NULL, *suffix = NULL;
char psz_buffer[10000]; // XXX char psz_buffer[10000]; // XXX
switch (CONFIG_CLASS(item->i_type)) switch (CONFIG_CLASS(item->i_type))
...@@ -432,8 +432,8 @@ static void print_item(const module_t *m, const module_config_t *item, ...@@ -432,8 +432,8 @@ static void print_item(const module_t *m, const module_config_t *item,
case CONFIG_ITEM_BOOL: case CONFIG_ITEM_BOOL:
bra = type = ket = ""; bra = type = ket = "";
prefix = ", --no-"; prefix = ", --no-";
suffix = item->value.i ? _(" (default enabled)") suffix = item->value.i ? _("(default enabled)")
: _(" (default disabled)"); : _("(default disabled)");
break; break;
default: default:
return; return;
...@@ -467,17 +467,22 @@ static void print_item(const module_t *m, const module_config_t *item, ...@@ -467,17 +467,22 @@ static void print_item(const module_t *m, const module_config_t *item,
putchar('\n'); putchar('\n');
offset = PADDING_SPACES + LINE_START; offset = PADDING_SPACES + LINE_START;
} }
printf("%*s", offset, ""); printf("%*s", offset, "");
print_desc(module_gettext(m, item->psz_longtext),
PADDING_SPACES + LINE_START, color);
sprintf(psz_buffer, "%s%s", module_gettext(m, item->psz_text), suffix); if (suffix != NULL)
print_desc(psz_buffer, PADDING_SPACES + LINE_START, color); {
printf("%*s", offset, "");
print_desc(suffix, PADDING_SPACES + LINE_START, color);
}
if (desc && (item->psz_longtext != NULL && item->psz_longtext[0])) if (desc && (item->psz_longtext != NULL && item->psz_longtext[0]))
{ /* Wrap long description */ { /* Wrap long description */
printf("%*s", LINE_START + 2, ""); printf("%*s", LINE_START + 2, "");
sprintf(psz_buffer, "%s%s", module_gettext(m, item->psz_longtext), print_desc(module_gettext(m, item->psz_longtext),
suffix); LINE_START + 2, false);
print_desc(psz_buffer, LINE_START + 2, false);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment