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

Method run

atomic-cli/src/commands/tag/delete.rs:62–90  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

60
61impl Command for Delete {
62 fn run(&self) -> CliResult<()> {
63 // Get the tag name
64 let name = self
65 .name
66 .as_ref()
67 .ok_or_else(|| CliError::InvalidArgument {
68 message: "Tag name is required".to_string(),
69 })?;
70
71 // Find the repository
72 let repo_root = find_repository_root()?;
73 let repo = Repository::open(&repo_root).map_err(|e| match e {
74 atomic_repository::RepositoryError::NotFound { path } => CliError::RepositoryNotFound {
75 searched_path: path.into(),
76 },
77 other => CliError::Repository(other),
78 })?;
79
80 // Delete the tag
81 let deleted = repo.delete_tag(name).map_err(CliError::Repository)?;
82
83 if deleted {
84 print_success(&format!("Deleted tag: {}", emphasis(name)));
85 } else {
86 println!("{}", hint(&format!("Tag '{}' does not exist", name)));
87 }
88
89 Ok(())
90 }
91}
92
93// Tests

Callers 4

test_run_without_nameFunction · 0.45
test_delete_existing_tagFunction · 0.45

Calls 5

find_repository_rootFunction · 0.85
RepositoryClass · 0.85
print_successFunction · 0.85
as_refMethod · 0.80
delete_tagMethod · 0.80

Tested by 4

test_run_without_nameFunction · 0.36
test_delete_existing_tagFunction · 0.36