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

Method create_ignore_file

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

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