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

Function uninstall_hooks

atomic-cli/src/commands/git/hooks.rs:161–186  ·  view source on GitHub ↗

Remove Atomic sections from all hooks.

()

Source from the content-addressed store, hash-verified

159
160/// Remove Atomic sections from all hooks.
161fn uninstall_hooks() -> CliResult<()> {
162 let hooks_dir = find_hooks_dir()?;
163 let mut removed = 0;
164
165 for hook_name in HOOK_NAMES {
166 let hook_path = hooks_dir.join(hook_name);
167 if !hook_path.exists() {
168 continue;
169 }
170 match remove_atomic_section(&hook_path) {
171 Ok(true) => removed += 1,
172 Ok(false) => {}
173 Err(e) => {
174 print_warning(&format!("Failed to clean {}: {}", hook_name, e));
175 }
176 }
177 }
178
179 if removed > 0 {
180 print_info(&format!("Removed Atomic hooks from {} file(s).", removed));
181 } else {
182 print_info("No Atomic hooks found.");
183 }
184
185 Ok(())
186}
187
188/// Remove the atomic:git:begin..end section from a hook file.
189/// Returns Ok(true) if something was removed.

Callers 1

runMethod · 0.85

Calls 5

find_hooks_dirFunction · 0.85
remove_atomic_sectionFunction · 0.85
print_warningFunction · 0.85
print_infoFunction · 0.85
existsMethod · 0.45

Tested by

no test coverage detected