mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-15 06:02:49 +03:00
Remove support for %arg{#}, can be added back if we got a use case
It is very unlikely we need %arg{#} without needing a %sh anyway.
This commit is contained in:
parent
a02ad38fb4
commit
2a8a329b83
@ -630,8 +630,7 @@ Supported types are:
|
||||
* `val`: value expansion, gives access to the environment variable available
|
||||
to the Shell expansion. The `kak_` prefix is not used there.
|
||||
* `arg`: argument expansion, gives access to the arguments of the current
|
||||
command, the content can be a number, or `#` for the argument count,
|
||||
or `@` for all arguments concatenated.
|
||||
command, the content can be a number, or `@` for all arguments.
|
||||
|
||||
for example you can display last search pattern with
|
||||
|
||||
|
@ -348,17 +348,14 @@ String expand_token(const Token& token, const Context& context,
|
||||
}
|
||||
case Token::Type::ArgExpand:
|
||||
{
|
||||
if (content == "#")
|
||||
return to_string(shell_context.params.size());
|
||||
else if (content == "@")
|
||||
return join(shell_context.params, ' ');
|
||||
auto& params = shell_context.params;
|
||||
if (content == '@')
|
||||
return join(params, ' ');
|
||||
|
||||
const int arg = str_to_int(content)-1;
|
||||
if (arg < 0)
|
||||
throw runtime_error("invalid argument index");
|
||||
if (arg < shell_context.params.size())
|
||||
return shell_context.params[arg];
|
||||
return {};
|
||||
return arg < params.size() ? params[arg] : String{};
|
||||
}
|
||||
case Token::Type::RawEval:
|
||||
return expand(content, context, shell_context);
|
||||
|
Loading…
Reference in New Issue
Block a user