diff options
Diffstat (limited to 'options')
-rw-r--r-- | options/m_option.c | 10 | ||||
-rw-r--r-- | options/m_option.h | 6 |
2 files changed, 14 insertions, 2 deletions
diff --git a/options/m_option.c b/options/m_option.c index 522e771356..e777c5a19e 100644 --- a/options/m_option.c +++ b/options/m_option.c @@ -2940,6 +2940,8 @@ print_help: ; if (desc->print_help) desc->print_help(log); m_config_print_option_list(config, "*"); + } else if (list->print_unknown_entry_help) { + list->print_unknown_entry_help(log, mp_tprintf(80, "%.*s", BSTR_P(name))); } else { mp_warn(log, "Option %.*s: item %.*s doesn't exist.\n", BSTR_P(opt_name), BSTR_P(name)); @@ -3155,11 +3157,17 @@ static int parse_obj_settings_list(struct mp_log *log, const m_option_t *opt, if (!ol->get_desc(&desc, n)) break; if (!desc.hidden) { - mp_info(log, " %-15s: %s\n", + mp_info(log, " %-16s %s\n", desc.name, desc.description); } } mp_info(log, "\n"); + if (ol->print_help_list) + ol->print_help_list(log); + if (!ol->use_global_options) { + mp_info(log, "Get help on individual entries via: --%s=entry=help\n", + opt->name); + } return M_OPT_EXIT; } diff --git a/options/m_option.h b/options/m_option.h index f47dac294e..af082a893d 100644 --- a/options/m_option.h +++ b/options/m_option.h @@ -129,7 +129,7 @@ struct m_obj_desc { const char *init_options; // Don't list entry with "help" bool hidden; - // Callback to print custom help if "help" is passed + // Callback to print custom help if "vf=entry=help" is passed void (*print_help)(struct mp_log *log); // Callback that allows you to override the static default values. The // pointer p points to the struct described by options/priv_size, with @@ -159,6 +159,10 @@ struct m_obj_list { bool disallow_positional_parameters; // Each sub-item is backed by global options (for AOs and VOs). bool use_global_options; + // Callback to print additional custom help if "vf=help" is passed + void (*print_help_list)(struct mp_log *log); + // Callback to print help for _unknown_ entries with "vf=entry=help" + void (*print_unknown_entry_help)(struct mp_log *log, const char *name); }; // Find entry by name |