Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,7 @@ pub struct CacheNamespace {
#[derive(Subcommand)]
pub enum CacheCommand {
/// Clear the cache, removing all entries or those linked to specific packages.
#[command(alias = "clear")]
Clean(CleanArgs),
/// Prune all unreachable objects from the cache.
Prune(PruneArgs),
Expand Down
32 changes: 32 additions & 0 deletions crates/uv/tests/it/cache_clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,38 @@ fn clean_all() -> Result<()> {
Ok(())
}

/// `cache clear` should behave as an alias of `cache clean`.
#[test]
fn clear_all_alias() -> Result<()> {
let context = uv_test::test_context!("3.12");

let requirements_txt = context.temp_dir.child("requirements.txt");
requirements_txt.write_str("typing-extensions\niniconfig")?;

// Install a requirement, to populate the cache.
context
.pip_sync()
.arg("requirements.txt")
.assert()
.success();

let mut command = context.command();
command.arg("cache").arg("clear").arg("--verbose");

uv_snapshot!(context.with_filtered_counts().filters(), command, @"
success: true
exit_code: 0
----- stdout -----

----- stderr -----
DEBUG uv [VERSION] ([COMMIT] DATE)
Clearing cache at: [CACHE_DIR]/
Removed [N] files ([SIZE])
");

Ok(())
}

#[tokio::test]
async fn clean_force() -> Result<()> {
let context = uv_test::test_context!("3.12").with_filtered_counts();
Expand Down
Loading