summaryrefslogtreecommitdiffstats
path: root/options/m_config.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-10-31 17:32:57 +0100
committerwm4 <wm4@nowhere>2019-10-31 17:32:57 +0100
commit706e708d2f17c68ceb13443fffd25053020da126 (patch)
tree86b2bc20869c596fb5ef55f52325d1afa014bddc /options/m_config.c
parente96ab5becb3afda9683bb4779937b94d27ac8fda (diff)
downloadmpv-706e708d2f17c68ceb13443fffd25053020da126.tar.bz2
mpv-706e708d2f17c68ceb13443fffd25053020da126.tar.xz
options: make --show-profile without parameters list all profiles
Diffstat (limited to 'options/m_config.c')
-rw-r--r--options/m_config.c19
1 files changed, 13 insertions, 6 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;
}