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

Method run

atomic-cli/src/commands/status.rs:491–542  ·  view source on GitHub ↗

Execute the status command. This method: 1. Finds and opens the repository 2. Computes the working copy status 3. Displays the status in the requested format # Errors Returns an error if: - No repository is found - The repository cannot be opened - Status computation fails

(&self)

Source from the content-addressed store, hash-verified

489 /// - The repository cannot be opened
490 /// - Status computation fails
491 fn run(&self) -> CliResult<()> {
492 // Find the repository root
493 let repo_root = find_repository_root()?;
494
495 // Reindex first if requested (needs read-write access)
496 if self.reindex {
497 let rw_repo =
498 Repository::open(&repo_root).map_err(|e| CliError::InvalidRepository {
499 reason: e.to_string(),
500 })?;
501 let start = std::time::Instant::now();
502 match rw_repo.reindex_working_copy() {
503 Ok(count) => {
504 print_info(&format!(
505 "Reindexed {} files in {:.1}s",
506 count,
507 start.elapsed().as_secs_f64()
508 ));
509 }
510 Err(e) => {
511 print_warning(&format!("Reindex failed: {}", e));
512 }
513 }
514 drop(rw_repo);
515 }
516
517 // Open the repository
518 let repo =
519 Repository::open_readonly(&repo_root).map_err(|e| CliError::InvalidRepository {
520 reason: e.to_string(),
521 })?;
522
523 // Debug ignore patterns if requested
524 if self.debug_ignore {
525 self.print_ignore_debug(&repo)?;
526 }
527
528 // Get status options
529 let options = self.get_status_options();
530
531 // Compute status
532 let status = repo
533 .status(options)
534 .map_err(|e| CliError::Internal(e.into()))?;
535
536 // Print in appropriate format
537 if self.short {
538 self.print_short_format(&status)
539 } else {
540 self.print_long_format(&status)
541 }
542 }
543}
544
545// Helper Types

Calls 9

find_repository_rootFunction · 0.85
print_infoFunction · 0.85
print_warningFunction · 0.85
reindex_working_copyMethod · 0.80
print_ignore_debugMethod · 0.80
get_status_optionsMethod · 0.80
print_short_formatMethod · 0.80
print_long_formatMethod · 0.80
statusMethod · 0.45