diff --git a/src/commands.cc b/src/commands.cc index fb1fcd90..f6ea2f78 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -315,6 +315,14 @@ const CommandDesc force_quit_cmd = { [](const ParametersParser&, Context&, const ShellContext&){ quit(); } }; +template +void write_quit(const ParametersParser& parser, Context& context, + const ShellContext& shell_context) +{ + write_buffer(parser, context, shell_context); + quit(); +} + const CommandDesc write_quit_cmd = { "wq", nullptr, @@ -323,11 +331,7 @@ const CommandDesc write_quit_cmd = { CommandFlags::None, CommandHelper{}, CommandCompleter{}, - [](const ParametersParser& parser, Context& context, const ShellContext& shell_context) - { - write_buffer(parser, context, shell_context); - quit(); - } + write_quit }; const CommandDesc force_write_quit_cmd = { @@ -339,11 +343,7 @@ const CommandDesc force_write_quit_cmd = { CommandFlags::None, CommandHelper{}, CommandCompleter{}, - [](const ParametersParser& parser, Context& context, const ShellContext& shell_context) - { - write_buffer(parser, context, shell_context); - quit(); - } + write_quit }; const CommandDesc writeall_quit_cmd = {