1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-29 14:44:56 +03:00

Merge remote-tracking branch 'occivink/source-with-args'

This commit is contained in:
Maxime Coste 2018-08-30 20:04:07 +10:00
commit a0ac3c8c4c
2 changed files with 6 additions and 4 deletions

View File

@ -67,8 +67,9 @@ command *q!* has to be used). Aliases are mentionned below each commands.
*rename-buffer* <name>::
set current buffer name
*source* <filename>::
*source* <filename> <param>...::
execute commands in <filename>
parameters are avilable in the sourced script through the `arg` values
== Clients and Sessions

View File

@ -1285,8 +1285,8 @@ const CommandDesc debug_cmd = {
const CommandDesc source_cmd = {
"source",
nullptr,
"source <filename>: execute commands contained in <filename>",
single_param,
"source <filename> <params>...: execute commands contained in <filename>",
ParameterDesc{ {}, ParameterDesc::Flags::None, 1, (size_t)-1 },
CommandFlags::None,
CommandHelper{},
filename_completer,
@ -1300,8 +1300,9 @@ const CommandDesc source_cmd = {
MappedFile file_content{path};
try
{
auto params = parser | skip(1) | gather<Vector<String>>();
CommandManager::instance().execute(file_content, context,
{{}, {{"source", path}}});
{params, {{"source", path}}});
}
catch (Kakoune::runtime_error& err)
{