MCPcopy Index your code
hub / github.com/cargo-lambda/cargo-lambda / render_path_with_variables

Function render_path_with_variables

crates/cargo-lambda-new/src/lib.rs:500–512  ·  view source on GitHub ↗
(path: &Path, parser: &Parser, variables: &Object)

Source from the content-addressed store, hash-verified

498}
499
500fn render_path_with_variables(path: &Path, parser: &Parser, variables: &Object) -> Option<PathBuf> {
501 let re = regex::Regex::new(r"\{\{[^/]*\}\}").ok()?;
502
503 let path_str = path.to_string_lossy();
504 if !re.is_match(&path_str) {
505 return None;
506 }
507
508 let template = parser.parse(&path_str).ok()?;
509 let path_str = template.render(&variables).ok()?;
510
511 Some(PathBuf::from(path_str))
512}
513
514#[cfg(target_os = "windows")]
515fn convert_to_unix_path(path: &Path) -> Option<String> {

Callers 1

create_projectFunction · 0.85

Calls 1

newFunction · 0.85

Tested by

no test coverage detected