MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / dry_run_single_file

Method dry_run_single_file

atomic-cli/src/commands/restore.rs:220–239  ·  view source on GitHub ↗

Execute dry-run for a single file - output pristine content to stdout.

(&self, repo: &Repository, path: &str)

Source from the content-addressed store, hash-verified

218
219 /// Execute dry-run for a single file - output pristine content to stdout.
220 fn dry_run_single_file(&self, repo: &Repository, path: &str) -> CliResult<()> {
221 // Get file content from pristine
222 let content = repo.get_file_content(Path::new(path)).map_err(|e| {
223 CliError::Internal(anyhow::anyhow!("Failed to get file content: {}", e))
224 })?;
225
226 match content {
227 Some(bytes) => {
228 // Output to stdout
229 use std::io::Write;
230 std::io::stdout()
231 .write_all(&bytes)
232 .map_err(|e| CliError::Internal(anyhow::anyhow!("Failed to write: {}", e)))?;
233 Ok(())
234 }
235 None => Err(CliError::FileNotFound {
236 path: PathBuf::from(path),
237 }),
238 }
239 }
240
241 /// Restore a single file according to its status.
242 ///

Callers 1

runMethod · 0.80

Calls 1

get_file_contentMethod · 0.80

Tested by

no test coverage detected