Return the path to the cached CLI binary if it exists. Args: version: CLI version. Defaults to the pinned CLI_VERSION. Returns: Path to the binary, or None if not cached.
(version: str | None = None)
| 83 | |
| 84 | |
| 85 | def get_cached_cli_path(version: str | None = None) -> str | None: |
| 86 | """Return the path to the cached CLI binary if it exists. |
| 87 | |
| 88 | Args: |
| 89 | version: CLI version. Defaults to the pinned CLI_VERSION. |
| 90 | |
| 91 | Returns: |
| 92 | Path to the binary, or None if not cached. |
| 93 | """ |
| 94 | ver = version or CLI_VERSION |
| 95 | if not ver: |
| 96 | return None |
| 97 | |
| 98 | try: |
| 99 | _, binary_name = get_asset_info() |
| 100 | except RuntimeError: |
| 101 | return None |
| 102 | binary_path = get_cache_dir(ver) / binary_name |
| 103 | |
| 104 | if binary_path.exists(): |
| 105 | return str(binary_path) |
| 106 | return None |
| 107 | |
| 108 | |
| 109 | def _should_skip_download() -> bool: |
no test coverage detected
searching dependent graphs…