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.
This commit is contained in:
Maxime Coste 2018-06-03 14:16:19 +10:00
parent 183f32803b
commit 8aba0b3cb4
2 changed files with 6 additions and 5 deletions

View File

@ -239,9 +239,10 @@ but not really useful in that context.
*fail* <text>::
raise an error, uses <text> as its description
*set-register* <name> <content>::
*set-register* <name> <contents>...::
*alias* reg +
set register *name* to *content* (See <<registers#,`:doc registers`>>)
set register *name* to *content*, each content parameter is assigned to
a different string in the register. (See <<registers#,`:doc registers`>>)
*select* <anchor_line>.<anchor_column>,<cursor_line>.<cursor_column>...::
replace the current selections with the ones described in the arguments

View File

@ -2099,14 +2099,14 @@ const CommandDesc rename_client_cmd = {
const CommandDesc set_register_cmd = {
"set-register",
"reg",
"set-register <name> <value>: set register <name> to <value>",
ParameterDesc{{}, ParameterDesc::Flags::SwitchesAsPositional, 2, 2},
"set-register <name> <values>...: set register <name> to <values>",
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));
}
};