Main entry point.
()
| 190 | |
| 191 | |
| 192 | def main() -> int: |
| 193 | """Main entry point.""" |
| 194 | parser = argparse.ArgumentParser( |
| 195 | description="Lock administration tool for cache management", |
| 196 | formatter_class=argparse.RawDescriptionHelpFormatter, |
| 197 | epilog=""" |
| 198 | Examples: |
| 199 | # List all locks with status |
| 200 | uv run python -m ci.util.lock_admin --list |
| 201 | |
| 202 | # Clean only stale locks (safe) |
| 203 | uv run python -m ci.util.lock_admin --clean-stale |
| 204 | |
| 205 | # Force unlock everything (DANGEROUS!) |
| 206 | uv run python -m ci.util.lock_admin --force-unlock-all |
| 207 | |
| 208 | # Check specific lock |
| 209 | uv run python -m ci.util.lock_admin --check "build:libfastled_build" |
| 210 | """, |
| 211 | ) |
| 212 | |
| 213 | parser.add_argument( |
| 214 | "--cache-dir", |
| 215 | type=Path, |
| 216 | default=Path.home() / ".platformio" / "global_cache", |
| 217 | help="Cache directory (default: ~/.platformio/global_cache)", |
| 218 | ) |
| 219 | |
| 220 | parser.add_argument( |
| 221 | "--list", |
| 222 | action="store_true", |
| 223 | help="List all locks with their status", |
| 224 | ) |
| 225 | |
| 226 | parser.add_argument( |
| 227 | "--clean-stale", |
| 228 | action="store_true", |
| 229 | help="Remove only stale locks (safe - checks PID)", |
| 230 | ) |
| 231 | |
| 232 | parser.add_argument( |
| 233 | "--force-unlock-all", |
| 234 | action="store_true", |
| 235 | help="Force remove ALL locks (DANGEROUS - no PID check)", |
| 236 | ) |
| 237 | |
| 238 | parser.add_argument( |
| 239 | "--check", |
| 240 | type=str, |
| 241 | metavar="LOCK_NAME", |
| 242 | help="Check status of specific lock (by name)", |
| 243 | ) |
| 244 | |
| 245 | args = parser.parse_args() |
| 246 | |
| 247 | # Require at least one action |
| 248 | if not any([args.list, args.clean_stale, args.force_unlock_all, args.check]): |
| 249 | parser.print_help() |
no test coverage detected