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

Method print_short_format

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

Print the status in short (porcelain) format.

(&self, status: &RepositoryStatus)

Source from the content-addressed store, hash-verified

373
374 /// Print the status in short (porcelain) format.
375 fn print_short_format(&self, status: &RepositoryStatus) -> CliResult<()> {
376 // Print added files and directories
377 for entry in status.added() {
378 let path_str = entry.path().display().to_string();
379 let is_dir = entry.details().map(|d| d == "directory").unwrap_or(false);
380 if is_dir {
381 println!("AD {}", path_str);
382 } else {
383 println!("A {}", path_str);
384 }
385 }
386
387 // Print modified files
388 for entry in status.modified() {
389 let path_str = entry.path().display().to_string();
390 println!("M {}", path_str);
391 }
392
393 // Print deleted files and directories
394 for entry in status.deleted() {
395 let path_str = entry.path().display().to_string();
396 let is_dir = entry.details().map(|d| d == "directory").unwrap_or(false);
397 if is_dir {
398 println!("DD {}", path_str);
399 } else {
400 println!("D {}", path_str);
401 }
402 }
403
404 // Print conflicted files
405 for entry in status.conflicted() {
406 let path_str = entry.path().display().to_string();
407 println!("C {}", path_str);
408 }
409
410 // Print untracked files
411 if !self.no_untracked {
412 for entry in status.untracked() {
413 let path_str = entry.path().display().to_string();
414 println!("?? {}", path_str);
415 }
416 }
417
418 Ok(())
419 }
420}
421
422impl Default for Status {

Calls 8

displayMethod · 0.80
detailsMethod · 0.80
conflictedMethod · 0.80
untrackedMethod · 0.80
addedMethod · 0.45
pathMethod · 0.45
modifiedMethod · 0.45
deletedMethod · 0.45