Show hook installation status.
()
| 245 | |
| 246 | /// Show hook installation status. |
| 247 | fn show_status() -> CliResult<()> { |
| 248 | let hooks_dir = find_hooks_dir()?; |
| 249 | |
| 250 | for hook_name in HOOK_NAMES { |
| 251 | let hook_path = hooks_dir.join(hook_name); |
| 252 | let status = if !hook_path.exists() { |
| 253 | "not installed" |
| 254 | } else { |
| 255 | let content = fs::read_to_string(&hook_path).unwrap_or_default(); |
| 256 | if content.contains(MARKER_BEGIN) { |
| 257 | "installed" |
| 258 | } else { |
| 259 | "exists (no Atomic section)" |
| 260 | } |
| 261 | }; |
| 262 | print_info(&format!(" {}: {}", hook_name, status)); |
| 263 | } |
| 264 | |
| 265 | Ok(()) |
| 266 | } |
| 267 | |
| 268 | #[cfg(test)] |
| 269 | mod tests { |
no test coverage detected