Merge remote-tracking branch 'occivink/source-with-args'
This commit is contained in:
commit
a0ac3c8c4c
|
@ -67,8 +67,9 @@ command *q!* has to be used). Aliases are mentionned below each commands.
|
||||||
*rename-buffer* <name>::
|
*rename-buffer* <name>::
|
||||||
set current buffer name
|
set current buffer name
|
||||||
|
|
||||||
*source* <filename>::
|
*source* <filename> <param>...::
|
||||||
execute commands in <filename>
|
execute commands in <filename>
|
||||||
|
parameters are avilable in the sourced script through the `arg` values
|
||||||
|
|
||||||
== Clients and Sessions
|
== Clients and Sessions
|
||||||
|
|
||||||
|
|
|
@ -1285,8 +1285,8 @@ const CommandDesc debug_cmd = {
|
||||||
const CommandDesc source_cmd = {
|
const CommandDesc source_cmd = {
|
||||||
"source",
|
"source",
|
||||||
nullptr,
|
nullptr,
|
||||||
"source <filename>: execute commands contained in <filename>",
|
"source <filename> <params>...: execute commands contained in <filename>",
|
||||||
single_param,
|
ParameterDesc{ {}, ParameterDesc::Flags::None, 1, (size_t)-1 },
|
||||||
CommandFlags::None,
|
CommandFlags::None,
|
||||||
CommandHelper{},
|
CommandHelper{},
|
||||||
filename_completer,
|
filename_completer,
|
||||||
|
@ -1300,8 +1300,9 @@ const CommandDesc source_cmd = {
|
||||||
MappedFile file_content{path};
|
MappedFile file_content{path};
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
auto params = parser | skip(1) | gather<Vector<String>>();
|
||||||
CommandManager::instance().execute(file_content, context,
|
CommandManager::instance().execute(file_content, context,
|
||||||
{{}, {{"source", path}}});
|
{params, {{"source", path}}});
|
||||||
}
|
}
|
||||||
catch (Kakoune::runtime_error& err)
|
catch (Kakoune::runtime_error& err)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user