summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2022-09-09 15:43:22 +0200
committerMaxime Coste <mawww@kakoune.org>2022-09-09 15:43:22 +0200
commitc428d3296dae8edf6c5bb55a0d3d302bdabadcbc (patch)
treec985873189f5e2ee070ea6265d98a2209802ae90 /src
parent2922b2bc32847118549aff2d84b7b80f7a8c18ce (diff)
parent7ae31b6778fdf8129f4ccc0045e27c8389e53e18 (diff)
Merge remote-tracking branch 'krobelus/write-autoinfo'
Diffstat (limited to 'src')
-rw-r--r--src/commands.cc28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/commands.cc b/src/commands.cc
index 7ef9deac..a9faedb4 100644
--- a/src/commands.cc
+++ b/src/commands.cc
@@ -460,11 +460,19 @@ const CommandDesc force_edit_cmd = {
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" } },
{ "method", { true, "explicit writemethod (replace|overwrite)" } },
- { "force", { false, "Allow overwriting existing file with explicit filename" } },
},
ParameterDesc::Flags::SwitchesOnlyAtStart, 0, 1
};
@@ -533,7 +541,7 @@ const CommandDesc force_write_cmd = {
"w!",
"write! [<switches>] [<filename>]: write the current buffer to its file "
"or to <filename> if specified, even when the file is write protected",
- write_params,
+ write_params_except_force,
CommandFlags::None,
CommandHelper{},
filename_completer<false>,
@@ -568,7 +576,7 @@ const CommandDesc write_all_cmd = {
"wa",
"write-all [<switches>]: write all changed buffers that are associated to a file",
ParameterDesc{
- write_params.switches,
+ write_params_except_force.switches,
ParameterDesc::Flags::None, 0, 0
},
CommandFlags::None,
@@ -693,9 +701,9 @@ void write_quit(const ParametersParser& parser, Context& context,
const CommandDesc write_quit_cmd = {
"write-quit",
"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",
- write_params,
+ write_params_except_force,
CommandFlags::None,
CommandHelper{},
CommandCompleter{},
@@ -705,9 +713,9 @@ const CommandDesc write_quit_cmd = {
const CommandDesc force_write_quit_cmd = {
"write-quit!",
"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",
- write_params,
+ write_params_except_force,
CommandFlags::None,
CommandHelper{},
CommandCompleter{},
@@ -717,9 +725,9 @@ const CommandDesc force_write_quit_cmd = {
const CommandDesc write_all_quit_cmd = {
"write-all-quit",
"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.",
- write_params,
+ write_params_except_force,
CommandFlags::None,
CommandHelper{},
CommandCompleter{},