From 8aba0b3cb4e5fe758328eba9eeba0401b4e77e52 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 3 Jun 2018 14:16:19 +1000 Subject: [PATCH] Change set-register command to take a list of values Registers are lists of strings, so this make it possible to set the whole list instead of forcing registers to a single element when going through the set-register command. --- doc/pages/commands.asciidoc | 5 +++-- src/commands.cc | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/pages/commands.asciidoc b/doc/pages/commands.asciidoc index 6a8b241b..3e8ad480 100644 --- a/doc/pages/commands.asciidoc +++ b/doc/pages/commands.asciidoc @@ -239,9 +239,10 @@ but not really useful in that context. *fail* :: raise an error, uses as its description -*set-register* :: +*set-register* ...:: *alias* reg + - set register *name* to *content* (See <>) + set register *name* to *content*, each content parameter is assigned to + a different string in the register. (See <>) *select* .,....:: replace the current selections with the ones described in the arguments diff --git a/src/commands.cc b/src/commands.cc index 233c8f89..d06c050a 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -2099,14 +2099,14 @@ const CommandDesc rename_client_cmd = { const CommandDesc set_register_cmd = { "set-register", "reg", - "set-register : set register to ", - ParameterDesc{{}, ParameterDesc::Flags::SwitchesAsPositional, 2, 2}, + "set-register ...: set register to ", + ParameterDesc{{}, ParameterDesc::Flags::SwitchesAsPositional, 2}, CommandFlags::None, CommandHelper{}, CommandCompleter{}, [](const ParametersParser& parser, Context& context, const ShellContext&) { - RegisterManager::instance()[parser[0]].set(context, {parser[1]}); + RegisterManager::instance()[parser[0]].set(context, parser.positionals_from(1)); } };