Detect when -client, -buffer or -try-client are used at the same time

Fixes #1218
This commit is contained in:
Maxime Coste 2017-02-15 18:59:37 +00:00
parent 0a1cb4b9b1
commit c3af384c70

View File

@ -1522,6 +1522,11 @@ private:
template<typename Func>
void context_wrap(const ParametersParser& parser, Context& context, Func func)
{
if ((int)(bool)parser.get_switch("buffer") +
(int)(bool)parser.get_switch("client") +
(int)(bool)parser.get_switch("try-client") > 1)
throw runtime_error{"Only one of -buffer, -client or -try-client can be specified"};
// Disable these options to avoid costly code paths (and potential screen
// redraws) That are useful only in interactive contexts.
DisableOption<AutoInfo> disable_autoinfo(context, "autoinfo");