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

Method create_ignore_file

atomic-cli/src/commands/init.rs:435–461  ·  view source on GitHub ↗

Create the .atomicignore file if a kind is specified.

(&self, repo_path: &Path)

Source from the content-addressed store, hash-verified

433
434 /// Create the .atomicignore file if a kind is specified.
435 fn create_ignore_file(&self, repo_path: &Path) -> CliResult<bool> {
436 let Some(kind) = &self.kind else {
437 return Ok(false);
438 };
439
440 let Some(template) = get_ignore_template(kind) else {
441 // Unknown kind - warn but don't fail
442 print_hint(&format!(
443 "Unknown project kind '{}'. Supported kinds: {}",
444 kind,
445 supported_kinds().join(", ")
446 ));
447 return Ok(false);
448 };
449
450 let ignore_path = repo_path.join(".atomicignore");
451
452 // Don't overwrite existing ignore file
453 if ignore_path.exists() {
454 print_hint(".atomicignore already exists, skipping");
455 return Ok(false);
456 }
457
458 std::fs::write(&ignore_path, template).map_err(CliError::Io)?;
459
460 Ok(true)
461 }
462
463 /// Validate the view name.
464 fn validate_view_name(&self) -> CliResult<()> {

Callers

nothing calls this directly

Calls 4

get_ignore_templateFunction · 0.85
print_hintFunction · 0.85
writeFunction · 0.50
existsMethod · 0.45

Tested by

no test coverage detected