From 43f1fcf6166de6b99d011f9b9969d594ede5faa1 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 27 Dec 2015 23:09:32 +0000 Subject: [PATCH] Slight refactor --- src/commands.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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 = {