Show hook installation status.
()
| 224 | |
| 225 | /// Show hook installation status. |
| 226 | fn show_status() -> CliResult<()> { |
| 227 | let hooks_dir = find_hooks_dir()?; |
| 228 | |
| 229 | for hook_name in HOOK_NAMES { |
| 230 | let hook_path = hooks_dir.join(hook_name); |
| 231 | let status = if !hook_path.exists() { |
| 232 | "not installed" |
| 233 | } else { |
| 234 | let content = fs::read_to_string(&hook_path).unwrap_or_default(); |
| 235 | if content.contains(MARKER_BEGIN) { |
| 236 | "installed" |
| 237 | } else { |
| 238 | "exists (no Atomic section)" |
| 239 | } |
| 240 | }; |
| 241 | print_info(&format!(" {}: {}", hook_name, status)); |
| 242 | } |
| 243 | |
| 244 | Ok(()) |
| 245 | } |
| 246 | |
| 247 | #[cfg(test)] |
| 248 | mod tests { |
no test coverage detected