(hook_type: str)
| 147 | |
| 148 | |
| 149 | def _uninstall_hook_script(hook_type: str) -> None: |
| 150 | hook_path, legacy_path = _hook_paths(hook_type) |
| 151 | |
| 152 | # If our file doesn't exist or it isn't ours, gtfo. |
| 153 | if not os.path.exists(hook_path) or not is_our_script(hook_path): |
| 154 | return |
| 155 | |
| 156 | os.remove(hook_path) |
| 157 | output.write_line(f'{hook_type} uninstalled') |
| 158 | |
| 159 | if os.path.exists(legacy_path): |
| 160 | os.replace(legacy_path, hook_path) |
| 161 | output.write_line(f'Restored previous hooks to {hook_path}') |
| 162 | |
| 163 | |
| 164 | def uninstall(config_file: str, hook_types: list[str] | None) -> int: |
no test coverage detected