From 9518f279fb34d444ebb9f26509dfb8ee2a1ddf14 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 19 Mar 2018 03:04:50 +1100 Subject: [PATCH] Tweak option documentation helper to support -add Fixes #1939 --- src/commands.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/commands.cc b/src/commands.cc index b6ba6b36..0f986498 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -1244,10 +1244,11 @@ const CommandDesc source_cmd = { static String option_doc_helper(const Context& context, CommandParameters params) { - if (params.size() < 2) + const bool add = params.size() > 1 and params[0] == "-add"; + if (params.size() < 2 + (add ? 1 : 0)) return ""; - auto desc = GlobalScope::instance().option_registry().option_desc(params[1]); + auto desc = GlobalScope::instance().option_registry().option_desc(params[1 + (add ? 1 : 0)]); if (not desc or desc->docstring().empty()) return "";