From e99ae17a80c64f5f0b758b6aab999fd7cb406dd3 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 23 Nov 2013 21:35:03 +0100 Subject: 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. --- mpvcore/m_config.c | 3 ++- mpvcore/m_config.h | 1 + mpvcore/player/main.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'mpvcore') 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; -- cgit v1.2.3