summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorpavelxdd <pavel.otchertsov@gmail.com>2017-12-11 21:40:43 +0300
committerJan Ekström <jeebjp@gmail.com>2017-12-11 21:56:20 +0200
commitcdb6cb55e05c05897ee3da91bb8979812fbb4602 (patch)
tree424e070429d98f12909ee538280ad11578bb735b /options
parent3f127448e8f2e85a5063ff5b37487a896fa4f6c7 (diff)
downloadmpv-cdb6cb55e05c05897ee3da91bb8979812fbb4602.tar.bz2
mpv-cdb6cb55e05c05897ee3da91bb8979812fbb4602.tar.xz
options: don't report errors on help value for OPT_COLOR
The same idea as in 3723e61 but for OPT_COLOR now. Added missing closing bracket in the help message.
Diffstat (limited to 'options')
-rw-r--r--options/m_option.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/options/m_option.c b/options/m_option.c
index 8bcd5b4bab..e9ffe5d491 100644
--- a/options/m_option.c
+++ b/options/m_option.c
@@ -1746,6 +1746,10 @@ static int parse_color(struct mp_log *log, const m_option_t *opt,
if (param.len == 0)
return M_OPT_MISSING_PARAM;
+ bool is_help = bstr_equals0(param, "help");
+ if (is_help)
+ goto error;
+
bstr val = param;
struct m_color color = {0};
@@ -1790,12 +1794,14 @@ static int parse_color(struct mp_log *log, const m_option_t *opt,
return 1;
error:
- mp_err(log, "Option %.*s: invalid color: '%.*s'\n",
- BSTR_P(name), BSTR_P(param));
- mp_err(log, "Valid colors must be in the form #RRGGBB or #AARRGGBB (in hex)\n"
- "Or in the form 'r/g/b/a', where each component is a value in the\n"
- "range 0.0-1.0. (Also allowed: 'gray', 'gray/a', 'r/g/b'.\n");
- return M_OPT_INVALID;
+ if (!is_help) {
+ mp_err(log, "Option %.*s: invalid color: '%.*s'\n",
+ BSTR_P(name), BSTR_P(param));
+ }
+ mp_info(log, "Valid colors must be in the form #RRGGBB or #AARRGGBB (in hex)\n"
+ "or in the form 'r/g/b/a', where each component is a value in the\n"
+ "range 0.0-1.0. (Also allowed: 'gray', 'gray/a', 'r/g/b').\n");
+ return is_help ? M_OPT_EXIT : M_OPT_INVALID;
}
const m_option_type_t m_option_type_color = {