diff options
author | wm4 <wm4@nowhere> | 2019-10-31 17:32:57 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-10-31 17:32:57 +0100 |
commit | 706e708d2f17c68ceb13443fffd25053020da126 (patch) | |
tree | 86b2bc20869c596fb5ef55f52325d1afa014bddc /options | |
parent | e96ab5becb3afda9683bb4779937b94d27ac8fda (diff) | |
download | mpv-706e708d2f17c68ceb13443fffd25053020da126.tar.bz2 mpv-706e708d2f17c68ceb13443fffd25053020da126.tar.xz |
options: make --show-profile without parameters list all profiles
Diffstat (limited to 'options')
-rw-r--r-- | options/m_config.c | 19 | ||||
-rw-r--r-- | options/options.c | 4 |
2 files changed, 15 insertions, 8 deletions
diff --git a/options/m_config.c b/options/m_config.c index 7085d3d6fa..4be8594fac 100644 --- a/options/m_config.c +++ b/options/m_config.c @@ -129,11 +129,21 @@ static struct m_group_data *m_config_gdata(struct m_config_data *data, return &data->gdata[group_index - data->group_index]; } +static void list_profiles(struct m_config *config) +{ + MP_INFO(config, "Available profiles:\n"); + for (struct m_profile *p = config->profiles; p; p = p->next) + MP_INFO(config, "\t%s\t%s\n", p->name, p->desc ? p->desc : ""); + MP_INFO(config, "\n"); +} + static int show_profile(struct m_config *config, bstr param) { struct m_profile *p; - if (!param.len) - return M_OPT_MISSING_PARAM; + if (!param.len) { + list_profiles(config); + return M_OPT_EXIT; + } if (!(p = m_config_get_profile(config, param))) { MP_ERR(config, "Unknown profile '%.*s'.\n", BSTR_P(param)); return M_OPT_EXIT; @@ -758,10 +768,7 @@ static int m_config_handle_special_options(struct m_config *config, MP_INFO(config, "No profiles have been defined.\n"); return M_OPT_EXIT; } - MP_INFO(config, "Available profiles:\n"); - for (struct m_profile *p = config->profiles; p; p = p->next) - MP_INFO(config, "\t%s\t%s\n", p->name, p->desc ? p->desc : ""); - MP_INFO(config, "\n"); + list_profiles(config); return M_OPT_EXIT; } diff --git a/options/options.c b/options/options.c index 9bac67101c..4fbf9d6401 100644 --- a/options/options.c +++ b/options/options.c @@ -332,8 +332,8 @@ const m_option_t mp_opts[] = { // handled in m_config.c { "include", CONF_TYPE_STRING, M_OPT_FILE, .offset = -1}, { "profile", CONF_TYPE_STRING_LIST, 0, .offset = -1}, - { "show-profile", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_FIXED | M_OPT_NOPROP, - .offset = -1}, + { "show-profile", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_FIXED | + M_OPT_NOPROP | M_OPT_OPTIONAL_PARAM, .offset = -1}, { "list-options", &m_option_type_dummy_flag, CONF_NOCFG | M_OPT_FIXED | M_OPT_NOPROP, .offset = -1}, OPT_FLAG("list-properties", property_print_help, |