diff options
author | wm4 <wm4@nowhere> | 2012-11-19 01:19:12 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-11-20 18:00:15 +0100 |
commit | 967e1e829077f859d14b3a9860f8ab9c0ce17031 (patch) | |
tree | 44c8cfd8e543542c2e4304ca11373be4af75cd9c | |
parent | 80270218cb9bda57afbb739fa22f7eb2f3a556ff (diff) | |
download | mpv-967e1e829077f859d14b3a9860f8ab9c0ce17031.tar.bz2 mpv-967e1e829077f859d14b3a9860f8ab9c0ce17031.tar.xz |
m_option: print valid integer range for choices on parsing errors
Only some choices have an additional integer range. For those which
do, printing the choices only would be confusing.
E.g. --cursor-autohide accepts the choices "always", "no", or an
integer value. The help text printed on option parse errors should
print the accepted integer range additional to "always" and "no".
-rw-r--r-- | core/m_option.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/core/m_option.c b/core/m_option.c index 90d8bb0359..7ea25c25b0 100644 --- a/core/m_option.c +++ b/core/m_option.c @@ -382,6 +382,8 @@ static int parse_choice(const struct m_option *opt, struct bstr name, mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Valid values are:"); for (alt = opt->priv; alt->name; alt++) mp_msg(MSGT_CFGPARSER, MSGL_ERR, " %s", alt->name); + if ((opt->flags & M_OPT_MIN) && (opt->flags & M_OPT_MAX)) + mp_msg(MSGT_CFGPARSER, MSGL_ERR, " %g-%g", opt->min, opt->max); mp_msg(MSGT_CFGPARSER, MSGL_ERR, "\n"); return M_OPT_INVALID; } |