Merge remote-tracking branch 'krobelus/write-autoinfo'

This commit is contained in:
Maxime Coste 2022-09-09 15:43:22 +02:00
commit c428d3296d

View File

@ -460,11 +460,19 @@ const CommandDesc force_edit_cmd = {
edit<true> edit<true>
}; };
const ParameterDesc write_params{ const ParameterDesc write_params = {
{
{ "sync", { false, "force the synchronization of the file onto the filesystem" } },
{ "method", { true, "explicit writemethod (replace|overwrite)" } },
{ "force", { false, "Allow overwriting existing file with explicit filename" } }
},
ParameterDesc::Flags::SwitchesOnlyAtStart, 0, 1
};
const ParameterDesc write_params_except_force = {
{ {
{ "sync", { false, "force the synchronization of the file onto the filesystem" } }, { "sync", { false, "force the synchronization of the file onto the filesystem" } },
{ "method", { true, "explicit writemethod (replace|overwrite)" } }, { "method", { true, "explicit writemethod (replace|overwrite)" } },
{ "force", { false, "Allow overwriting existing file with explicit filename" } },
}, },
ParameterDesc::Flags::SwitchesOnlyAtStart, 0, 1 ParameterDesc::Flags::SwitchesOnlyAtStart, 0, 1
}; };
@ -533,7 +541,7 @@ const CommandDesc force_write_cmd = {
"w!", "w!",
"write! [<switches>] [<filename>]: write the current buffer to its file " "write! [<switches>] [<filename>]: write the current buffer to its file "
"or to <filename> if specified, even when the file is write protected", "or to <filename> if specified, even when the file is write protected",
write_params, write_params_except_force,
CommandFlags::None, CommandFlags::None,
CommandHelper{}, CommandHelper{},
filename_completer<false>, filename_completer<false>,
@ -568,7 +576,7 @@ const CommandDesc write_all_cmd = {
"wa", "wa",
"write-all [<switches>]: write all changed buffers that are associated to a file", "write-all [<switches>]: write all changed buffers that are associated to a file",
ParameterDesc{ ParameterDesc{
write_params.switches, write_params_except_force.switches,
ParameterDesc::Flags::None, 0, 0 ParameterDesc::Flags::None, 0, 0
}, },
CommandFlags::None, CommandFlags::None,
@ -693,9 +701,9 @@ void write_quit(const ParametersParser& parser, Context& context,
const CommandDesc write_quit_cmd = { const CommandDesc write_quit_cmd = {
"write-quit", "write-quit",
"wq", "wq",
"write-quit [-sync] [<exit status>]: write current buffer and quit current client. " "write-quit [<switches>] [<exit status>]: write current buffer and quit current client. "
"An optional integer parameter can set the client exit status", "An optional integer parameter can set the client exit status",
write_params, write_params_except_force,
CommandFlags::None, CommandFlags::None,
CommandHelper{}, CommandHelper{},
CommandCompleter{}, CommandCompleter{},
@ -705,9 +713,9 @@ const CommandDesc write_quit_cmd = {
const CommandDesc force_write_quit_cmd = { const CommandDesc force_write_quit_cmd = {
"write-quit!", "write-quit!",
"wq!", "wq!",
"write-quit! [-sync] [<exit status>] write: current buffer and quit current client, even if other buffers are not saved. " "write-quit! [<switches>] [<exit status>] write: current buffer and quit current client, even if other buffers are not saved. "
"An optional integer parameter can set the client exit status", "An optional integer parameter can set the client exit status",
write_params, write_params_except_force,
CommandFlags::None, CommandFlags::None,
CommandHelper{}, CommandHelper{},
CommandCompleter{}, CommandCompleter{},
@ -717,9 +725,9 @@ const CommandDesc force_write_quit_cmd = {
const CommandDesc write_all_quit_cmd = { const CommandDesc write_all_quit_cmd = {
"write-all-quit", "write-all-quit",
"waq", "waq",
"write-all-quit [-sync] [<exit status>]: write all buffers associated to a file and quit current client. " "write-all-quit [<switches>] [<exit status>]: write all buffers associated to a file and quit current client. "
"An optional integer parameter can set the client exit status.", "An optional integer parameter can set the client exit status.",
write_params, write_params_except_force,
CommandFlags::None, CommandFlags::None,
CommandHelper{}, CommandHelper{},
CommandCompleter{}, CommandCompleter{},