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

Method create_ignore_file

atomic-cli/src/commands/init.rs:410–436  ·  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

408
409 /// Create the .atomicignore file if a kind is specified.
410 fn create_ignore_file(&self, repo_path: &Path) -> CliResult<bool> {
411 let Some(kind) = &self.kind else {
412 return Ok(false);
413 };
414
415 let Some(template) = get_ignore_template(kind) else {
416 // Unknown kind - warn but don't fail
417 print_hint(&format!(
418 "Unknown project kind '{}'. Supported kinds: {}",
419 kind,
420 supported_kinds().join(", ")
421 ));
422 return Ok(false);
423 };
424
425 let ignore_path = repo_path.join(".atomicignore");
426
427 // Don't overwrite existing ignore file
428 if ignore_path.exists() {
429 print_hint(".atomicignore already exists, skipping");
430 return Ok(false);
431 }
432
433 std::fs::write(&ignore_path, template).map_err(CliError::Io)?;
434
435 Ok(true)
436 }
437
438 /// Validate the view name.
439 fn validate_view_name(&self) -> CliResult<()> {

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected