diff options
Diffstat (limited to 'src/command_manager.cc')
| -rw-r--r-- | src/command_manager.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/command_manager.cc b/src/command_manager.cc index f777eeda..5e8c8196 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -5,6 +5,7 @@ #include "buffer_utils.hh" #include "context.hh" #include "flags.hh" +#include "file.hh" #include "optional.hh" #include "option_types.hh" #include "ranges.hh" @@ -168,6 +169,8 @@ Token::Type token_type(StringView type_name, bool throw_on_invalid) return Token::Type::ValExpand; else if (type_name == "arg") return Token::Type::ArgExpand; + else if (type_name == "file") + return Token::Type::FileExpand; else if (throw_on_invalid) throw parse_error{format("unknown expand '{}'", type_name)}; else @@ -327,6 +330,8 @@ expand_token(const Token& token, const Context& context, const ShellContext& she throw runtime_error("invalid argument index"); return {arg < params.size() ? params[arg] : String{}}; } + case Token::Type::FileExpand: + return {read_file(content)}; case Token::Type::RawEval: return {expand(content, context, shell_context)}; case Token::Type::Raw: |
