From 6f6b2197874476fe04b36c2c6be8d791f769c22b Mon Sep 17 00:00:00 2001 From: Delapouite Date: Fri, 1 Nov 2019 18:25:55 +0100 Subject: [PATCH] Use single_param more and add double_params --- src/commands.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/commands.cc b/src/commands.cc index 07abc4ab..bc532660 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -187,6 +187,7 @@ auto make_single_word_completer(std::function func) const ParameterDesc no_params{ {}, ParameterDesc::Flags::None, 0, 0 }; const ParameterDesc single_param{ {}, ParameterDesc::Flags::None, 1, 1 }; const ParameterDesc single_optional_param{ {}, ParameterDesc::Flags::None, 0, 1 }; +const ParameterDesc double_params{ {}, ParameterDesc::Flags::None, 2, 2 }; static constexpr auto scopes = { "global", "buffer", "window" }; @@ -937,7 +938,7 @@ const CommandDesc remove_highlighter_cmd = { "remove-highlighter", "rmhl", "remove-highlighter : remove highlighter identified by ", - { {}, ParameterDesc::Flags::None, 1, 1 }, + single_param, CommandFlags::None, CommandHelper{}, highlighter_cmd_completer, @@ -1013,7 +1014,7 @@ const CommandDesc remove_hook_cmd = { "remove-hooks", "rmhooks", "remove-hooks : remove all hooks whose group matches the regex ", - ParameterDesc{ {}, ParameterDesc::Flags::None, 2, 2 }, + double_params, CommandFlags::None, CommandHelper{}, [](const Context& context, CompletionFlags flags, @@ -1522,7 +1523,7 @@ const CommandDesc unset_option_cmd = { "unset-option : remove option from scope, falling back on parent scope value\n" " can be buffer, window, or current which refers to the narrowest " "scope the option is set in", - ParameterDesc{ {}, ParameterDesc::Flags::None, 2, 2 }, + double_params, CommandFlags::None, option_doc_helper, complete_option, @@ -1542,7 +1543,7 @@ const CommandDesc update_option_cmd = { "some option types, such as line-specs or range-specs can be updated to latest buffer timestamp\n" " can be buffer, window, or current which refers to the narrowest " "scope the option is set in", - ParameterDesc{ {}, ParameterDesc::Flags::None, 2, 2 }, + double_params, CommandFlags::None, option_doc_helper, complete_option, @@ -2274,7 +2275,7 @@ const CommandDesc unset_face_cmd = { "unset-face", nullptr, "unset-face : remove from ", - ParameterDesc{{}, ParameterDesc::Flags::None, 2, 2}, + double_params, CommandFlags::None, face_doc_helper, make_completer(complete_scope, complete_face), @@ -2491,7 +2492,7 @@ const CommandDesc require_module_cmd = { "require-module", nullptr, "require-module : ensures that module has been loaded", - ParameterDesc{ {}, ParameterDesc::Flags::None, 1, 1 }, + single_param, CommandFlags::None, CommandHelper{}, make_completer(