Slight refactor

This commit is contained in:
Maxime Coste 2015-12-27 23:09:32 +00:00
parent a5dcca6f78
commit 43f1fcf616

View File

@ -315,6 +315,14 @@ const CommandDesc force_quit_cmd = {
[](const ParametersParser&, Context&, const ShellContext&){ quit<true>(); } [](const ParametersParser&, Context&, const ShellContext&){ quit<true>(); }
}; };
template<bool force>
void write_quit(const ParametersParser& parser, Context& context,
const ShellContext& shell_context)
{
write_buffer(parser, context, shell_context);
quit<force>();
}
const CommandDesc write_quit_cmd = { const CommandDesc write_quit_cmd = {
"wq", "wq",
nullptr, nullptr,
@ -323,11 +331,7 @@ const CommandDesc write_quit_cmd = {
CommandFlags::None, CommandFlags::None,
CommandHelper{}, CommandHelper{},
CommandCompleter{}, CommandCompleter{},
[](const ParametersParser& parser, Context& context, const ShellContext& shell_context) write_quit<false>
{
write_buffer(parser, context, shell_context);
quit<false>();
}
}; };
const CommandDesc force_write_quit_cmd = { const CommandDesc force_write_quit_cmd = {
@ -339,11 +343,7 @@ const CommandDesc force_write_quit_cmd = {
CommandFlags::None, CommandFlags::None,
CommandHelper{}, CommandHelper{},
CommandCompleter{}, CommandCompleter{},
[](const ParametersParser& parser, Context& context, const ShellContext& shell_context) write_quit<true>
{
write_buffer(parser, context, shell_context);
quit<true>();
}
}; };
const CommandDesc writeall_quit_cmd = { const CommandDesc writeall_quit_cmd = {