summaryrefslogtreecommitdiffstats
path: root/mpvcore
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-23 21:35:03 +0100
committerwm4 <wm4@nowhere>2013-11-23 21:35:03 +0100
commite99ae17a80c64f5f0b758b6aab999fd7cb406dd3 (patch)
treea0606b966eea25503b4bb7db0a4ee96c2418e364 /mpvcore
parentb5ed6148394062fbc8ac101bd1efe918470ac585 (diff)
downloadmpv-e99ae17a80c64f5f0b758b6aab999fd7cb406dd3.tar.bz2
mpv-e99ae17a80c64f5f0b758b6aab999fd7cb406dd3.tar.xz
options: don't prefix sub-options with "--" in help output
Commit 0cb9227a added this to the option list help output, but it looks strange with sub-options.
Diffstat (limited to 'mpvcore')
-rw-r--r--mpvcore/m_config.c3
-rw-r--r--mpvcore/m_config.h1
-rw-r--r--mpvcore/player/main.c1
3 files changed, 4 insertions, 1 deletions
diff --git a/mpvcore/m_config.c b/mpvcore/m_config.c
index 0e23c899fd..7ada99e068 100644
--- a/mpvcore/m_config.c
+++ b/mpvcore/m_config.c
@@ -635,6 +635,7 @@ void m_config_print_option_list(const struct m_config *config)
{
char min[50], max[50];
int count = 0;
+ const char *prefix = config->is_toplevel ? "--" : "";
mp_tmsg(MSGT_CFGPARSER, MSGL_INFO, "Options:\n\n");
for (int i = 0; i < config->num_opts; i++) {
@@ -644,7 +645,7 @@ void m_config_print_option_list(const struct m_config *config)
continue;
if (co->is_generated)
continue;
- mp_msg(MSGT_CFGPARSER, MSGL_INFO, " --%-30.30s", co->name);
+ mp_msg(MSGT_CFGPARSER, MSGL_INFO, " %s%-30.30s", prefix, co->name);
if (opt->type == &m_option_type_choice) {
mp_msg(MSGT_CFGPARSER, MSGL_INFO, " Choices:");
struct m_opt_choice_alternatives *alt = opt->priv;
diff --git a/mpvcore/m_config.h b/mpvcore/m_config.h
index 32ef242481..1098c5635c 100644
--- a/mpvcore/m_config.h
+++ b/mpvcore/m_config.h
@@ -59,6 +59,7 @@ typedef struct m_config {
struct m_opt_backup *backup_opts;
bool use_profiles;
+ bool is_toplevel;
int (*includefunc)(struct m_config *conf, char *filename, int flags);
void *optstruct; // struct mpopts or other
diff --git a/mpvcore/player/main.c b/mpvcore/player/main.c
index 81e724252d..528076bc57 100644
--- a/mpvcore/player/main.c
+++ b/mpvcore/player/main.c
@@ -316,6 +316,7 @@ static int mpv_main(int argc, char *argv[])
mpctx->opts = mpctx->mconfig->optstruct;
mpctx->mconfig->includefunc = cfg_include;
mpctx->mconfig->use_profiles = true;
+ mpctx->mconfig->is_toplevel = true;
struct MPOpts *opts = mpctx->opts;