Crate rskiller

Crate rskiller 

Source
Expand description

§rskiller

A Rust library for finding and cleaning Rust project build artifacts and caches.

This library provides functionality to scan for Rust projects, analyze their build artifacts, and safely clean up target directories and other cache files.

§Features

  • Find Rust projects by scanning for Cargo.toml files
  • Analyze build artifacts and calculate sizes
  • Safe cleanup with project activity detection
  • Support for Cargo workspaces
  • Configurable scanning and filtering options
  • Configuration file support (TOML and JSON formats)

§Example

use rskiller::{ProjectScanner, Cli, SortBy, Color, ConfigFormat};
use std::path::PathBuf;
 
#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let cli = Cli {
        directory: Some(PathBuf::from("~/")),
        full: false,
        target: Some("target".to_string()),
        sort: Some(SortBy::Size),
        gb: false,
        exclude: None,
        exclude_hidden: false,
        hide_errors: false,
        delete_all: false,
        dry_run: true,
        list_only: true,
        include_cargo_cache: false,
        color: Some(Color::Blue),
        no_check_update: false,
        config: None,
        print_config: false,
        init_config: false,
        format: ConfigFormat::Toml,
        global: false,
        validate_config: None,
        config_info: false,
    };
     
    let scanner = ProjectScanner::new(cli);
    let projects = scanner.scan().await?;
     
    for project in &projects {
        println!("Project: {} - Size: {} bytes", 
                 project.name, 
                 project.total_cleanable_size());
    }
     
    Ok(())
}

Re-exports§

pub use cli::Cli;
pub use cli::SortBy;
pub use cli::Color;
pub use cli::ConfigFormat;
pub use config::Config;
pub use config::ConfigLoader;
pub use scanner::ProjectScanner;
pub use project::RustProject;
pub use project::BuildArtifact;
pub use project::ArtifactType;
pub use ui::InteractiveUI;
pub use utils::calculate_dir_size;
pub use utils::format_size;
pub use utils::remove_directory;

Modules§

cli
config
project
scanner
ui
utils

Constants§

DEFAULT_SEARCH_DEPTH
Default search depth for project scanning
DEFAULT_TARGET
Default target directory name
MAX_FULL_SEARCH_DEPTH
Maximum search depth when scanning from home directory
VERSION
Library version