Add a uv cache size command (#16032)
## Summary <!-- What's the purpose of the change? What does it do, and why? --> Implement `uv cache size` to output the cache directory size in raw bytes by default, with a `--human` option for human-readable output. close #15821 <!-- How was it tested? --> --------- Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
This commit is contained in:
@@ -757,7 +757,6 @@ pub enum CacheCommand {
|
||||
Prune(PruneArgs),
|
||||
/// Show the cache directory.
|
||||
///
|
||||
///
|
||||
/// By default, the cache is stored in `$XDG_CACHE_HOME/uv` or `$HOME/.cache/uv` on Unix and
|
||||
/// `%LOCALAPPDATA%\uv\cache` on Windows.
|
||||
///
|
||||
@@ -770,6 +769,12 @@ pub enum CacheCommand {
|
||||
/// Note that it is important for performance for the cache directory to be located on the same
|
||||
/// file system as the Python environment uv is operating on.
|
||||
Dir,
|
||||
/// Show the cache size.
|
||||
///
|
||||
/// Displays the total size of the cache directory. This includes all downloaded and built
|
||||
/// wheels, source distributions, and other cached data. By default, outputs the size in raw
|
||||
/// bytes; use `--human` for human-readable output.
|
||||
Size(SizeArgs),
|
||||
}
|
||||
|
||||
#[derive(Args, Debug)]
|
||||
@@ -811,6 +816,13 @@ pub struct PruneArgs {
|
||||
pub force: bool,
|
||||
}
|
||||
|
||||
#[derive(Args, Debug)]
|
||||
pub struct SizeArgs {
|
||||
/// Display the cache size in human-readable format (e.g., `1.2 GiB` instead of raw bytes).
|
||||
#[arg(long = "human", short = 'H', alias = "human-readable")]
|
||||
pub human: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct PipNamespace {
|
||||
#[command(subcommand)]
|
||||
|
||||
Reference in New Issue
Block a user