From 2b851933e013d992069d5a0defce112317ec7625 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 4 Feb 2020 20:10:38 +0100 Subject: options: stop hiding deprecated options I think this was annoying. It shouldn't be dishonest about which options exist. List them as "[deprecated]" instead. --- options/m_config.c | 9 +++------ options/m_config.h | 1 - 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'options') diff --git a/options/m_config.c b/options/m_config.c index 385a02ba81..e38a3b12f6 100644 --- a/options/m_config.c +++ b/options/m_config.c @@ -476,7 +476,6 @@ struct m_config *m_config_new(void *talloc_ctx, struct mp_log *log, .name = talloc_strdup(config, it.full_name), .opt = it.opt, .group_index = it.group_index, - .is_hidden = !!it.opt->deprecation_message, }; struct m_group_data *gdata = config->cache @@ -837,7 +836,7 @@ const char *m_config_get_positional_option(const struct m_config *config, int p) int pos = 0; for (int n = 0; n < config->num_opts; n++) { struct m_config_option *co = &config->opts[n]; - if (!co->is_hidden) { + if (!co->opt->deprecation_message) { if (pos == p) return co->name; pos++; @@ -1253,8 +1252,6 @@ void m_config_print_option_list(const struct m_config *config, const char *name) for (int i = 0; i < config->num_opts; i++) { struct m_config_option *co = &sorted[i]; const struct m_option *opt = co->opt; - if (co->is_hidden) - continue; if (strcmp(name, "*") != 0 && !strstr(co->name, name)) continue; MP_INFO(config, " %s%-30s", prefix, co->name); @@ -1291,6 +1288,8 @@ void m_config_print_option_list(const struct m_config *config, const char *name) MP_INFO(config, " [not in config files]"); if (opt->flags & M_OPT_FILE) MP_INFO(config, " [file]"); + if (opt->deprecation_message) + MP_INFO(config, " [deprecated]"); if (opt->type == &m_option_type_alias) MP_INFO(config, " for %s", (char *)opt->priv); if (opt->type == &m_option_type_cli_alias) @@ -1313,8 +1312,6 @@ char **m_config_list_options(void *ta_parent, const struct m_config *config) int count = 0; for (int i = 0; i < config->num_opts; i++) { struct m_config_option *co = &config->opts[i]; - if (co->is_hidden) - continue; // For use with CONF_TYPE_STRING_LIST, it's important not to set list // as allocation parent. char *s = talloc_strdup(ta_parent, co->name); diff --git a/options/m_config.h b/options/m_config.h index 862d40c3a3..c2783feee3 100644 --- a/options/m_config.h +++ b/options/m_config.h @@ -39,7 +39,6 @@ struct mp_dispatch_queue; // Config option struct m_config_option { - bool is_hidden : 1; // Does not show up in help bool is_set_from_cmdline : 1; // Set by user from command line bool is_set_from_config : 1; // Set by a config file bool is_set_locally : 1; // Has a backup entry -- cgit v1.2.3