Add $env.CURRENT_FILE variable (#8861)

Co-authored-by: Jelle Besseling <jelle@bigbridge.nl>
This commit is contained in:
Jelle Besseling
2023-04-13 22:33:29 +02:00
committed by GitHub
parent b2d7427d2d
commit 8ddebcb932
7 changed files with 48 additions and 22 deletions

View File

@ -134,6 +134,11 @@ impl Command for OverlayUse {
callee_stack.add_env_var("FILE_PWD".to_string(), file_pwd);
}
if let Some(file_path) = &maybe_path {
let file_path = Value::string(file_path.to_string_lossy(), call.head);
callee_stack.add_env_var("CURRENT_FILE".to_string(), file_path);
}
let _ = eval_block(
engine_state,
&mut callee_stack,