Previously, deleting caches by key or key+ref could misreport the number of deleted entries, especially when multiple caches matched the criteria. This change ensures the actual number of deleted caches is reported by consuming the API response's total_count field.
* Ensure that the `--ref` flag cannot be used in conjunction with a cache ID.
* Update error handling to provide clear feedback when this condition is violated.
* Add tests to cover scenarios involving the `--ref` flag and cache ID.
* Added validation to ensure that the `--ref` flag cannot be used when a cache ID is provided.
* Updated error message to include the reference when a cache is not found with the specified `--ref`.
* Replaced direct conversion of cache ID string to int with a dedicated `parseCacheID` function.
* Improved readability and maintainability of the `deleteCaches` function.
* Changed the error message from "--ref cannot be used without cache key/ID" to "must provide a cache key" for clarity.
* Updated corresponding test case to reflect the new error message.
* Clarified the description of the `--ref` flag to specify its purpose more accurately.
* Ensures users understand that it narrows down deletion by cache key and ref.
* Implemented test cases for handling the `--ref` flag in cache deletion commands.
* Added validation for using `--ref` with cache key and ID.
* Ensured proper error messages are returned for invalid usage of `--ref`.
- Introduced `--ref` flag to narrow down cache deletion to a specific branch or PR reference.
- Updated command examples to include usage of `--ref`.
- Added validation to ensure `--ref` cannot be used with `--all` and must accompany a cache key/ID.