diff options
author | pavelxdd <pavel.otchertsov@gmail.com> | 2017-12-11 21:40:01 +0300 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2017-12-11 21:56:20 +0200 |
commit | 3f127448e8f2e85a5063ff5b37487a896fa4f6c7 (patch) | |
tree | 69fea7b961a2185853c517ca640e0843e75c8d7b /options/m_option.c | |
parent | 6a85f9bf74b76954f5da433087c29ce6640c71d5 (diff) | |
download | mpv-3f127448e8f2e85a5063ff5b37487a896fa4f6c7.tar.bz2 mpv-3f127448e8f2e85a5063ff5b37487a896fa4f6c7.tar.xz |
options: don't report errors on help value for OPT_FLAG
The same idea as in 3723e61 but for OPT_FLAG now.
Diffstat (limited to 'options/m_option.c')
-rw-r--r-- | options/m_option.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/options/m_option.c b/options/m_option.c index 9577c48577..8bcd5b4bab 100644 --- a/options/m_option.c +++ b/options/m_option.c @@ -135,13 +135,18 @@ static int parse_flag(struct mp_log *log, const m_option_t *opt, VAL(dst) = 0; return 1; } - mp_fatal(log, "Invalid parameter for %.*s flag: %.*s\n", - BSTR_P(name), BSTR_P(param)); - mp_info(log, "Valid values are:\n"); + bool is_help = bstr_equals0(param, "help"); + if (is_help) { + mp_info(log, "Valid values for %.*s flag are:\n", BSTR_P(name)); + } else { + mp_fatal(log, "Invalid parameter for %.*s flag: %.*s\n", + BSTR_P(name), BSTR_P(param)); + mp_info(log, "Valid values are:\n"); + } mp_info(log, " yes\n"); mp_info(log, " no\n"); mp_info(log, " (passing nothing)\n"); - return M_OPT_INVALID; + return is_help ? M_OPT_EXIT : M_OPT_INVALID; } static char *print_flag(const m_option_t *opt, const void *val) |