Read a value from disk when it starts with `@`. The leading `@` is stripped; the rest is treated as a path (relative to cwd). Plain values pass through unchanged. To pass a literal `@` as the first character, use `--args` instead.
(raw: &str, read_stdin: &mut impl FnMut() -> Result<String>)
| 718 | /// pass through unchanged. To pass a literal `@` as the first character, use |
| 719 | /// `--args` instead. |
| 720 | fn resolve_at_file(raw: &str, read_stdin: &mut impl FnMut() -> Result<String>) -> Result<String> { |
| 721 | if let Some(path) = raw.strip_prefix('@') { |
| 722 | if path == "-" { |
| 723 | return read_stdin(); |
| 724 | } |
| 725 | let buf = PathBuf::from(path); |
| 726 | std::fs::read_to_string(&buf).map_err(|e| TraceDecayError::Config { |
| 727 | message: format!( |
| 728 | "failed to read @{path}: {e} — the path is resolved relative to the current \ |
| 729 | directory; for a literal value that begins with `@`, use --args instead" |
| 730 | ), |
| 731 | }) |
| 732 | } else { |
| 733 | Ok(raw.to_string()) |
| 734 | } |
| 735 | } |
no outgoing calls
no test coverage detected