summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-10-17 10:02:11 +0800
committerMaxime Coste <mawww@kakoune.org>2017-10-17 10:25:16 +0800
commit145cf843dd07d579a0e4834665446eba17c96cb5 (patch)
tree867b08826c8d1ab9151f3d2f95f1ac847be6c288 /src
parent431e226fc8a78688887f62161296b7142d6f78a5 (diff)
Add a `fail` command to explicitely raise an error
Diffstat (limited to 'src')
-rw-r--r--src/commands.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/commands.cc b/src/commands.cc
index 466a84dd..1593901e 100644
--- a/src/commands.cc
+++ b/src/commands.cc
@@ -2105,6 +2105,20 @@ const CommandDesc rename_session_cmd = {
}
};
+const CommandDesc fail_cmd = {
+ "fail",
+ nullptr,
+ "fail [<message>]: raise an error with the given message",
+ ParameterDesc{},
+ CommandFlags::None,
+ CommandHelper{},
+ CommandCompleter{},
+ [](const ParametersParser& parser, Context&, const ShellContext&)
+ {
+ throw runtime_error(fix_atom_text(join(parser, ' ', false)));
+ }
+};
+
}
void register_commands()
@@ -2166,6 +2180,7 @@ void register_commands()
register_command(select_cmd);
register_command(change_directory_cmd);
register_command(rename_session_cmd);
+ register_command(fail_cmd);
}
}