Skip to content

Latest commit

 

History

History
105 lines (76 loc) · 2.14 KB

readme.md

File metadata and controls

105 lines (76 loc) · 2.14 KB

Rmdev

中文

Hello

This is a tool to delete the remaining dependencies and cache files in the development environment, eg: nodule_modules、target...

Feature

  • 🌟 batch deletion
  • 🚀 fast deletion
  • 🧹 support multi project type
    • nodejs (nodule_modules)
    • rust (target)
    • ...

Install

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # install cargo

cargo install rmdev

Use

rmdev clear ../ -f

# ../ clear target dir

Help

rmdev clear --help

Skip Scan

Add rmdev.skip file to your project. skip to deletion.

Contribute

I hope that this tool will eventually cover all the major languages, but more of this work needs to be contributed by all of you ❤️!

We can contribute by modifying the src/scan_category.rs file and writing in the PR what tool in what language generated the.

use std::path::Path;

use once_cell::sync::Lazy;

pub(crate) static STRATEGY: Lazy<Vec<ScanCate>> =
    Lazy::new(|| vec![ScanCate::Npm, ScanCate::Cargo]);

#[derive(Debug, Clone)]
pub enum ScanCate {
    Npm,
    Cargo,
}

impl ScanCate {
    pub(crate) fn access_keyfile(&self, path: &Path) -> bool {
        match self {
            Self::Npm => path.join("package.json").exists(),
            Self::Cargo => path.join("Cargo.toml").exists(),
        }
    }

    pub(crate) fn rm_keyfile(&self, path: &Path) -> bool {
        match self {
            Self::Npm => path.to_str().unwrap().contains("node_modules"),
            Self::Cargo => path.to_str().unwrap().contains("target"),
        }
    }

    pub(crate) fn ident(&self) -> String {
        match self {
            Self::Npm => "NPM",
            Self::Cargo => "Cargo",
        }
        .to_string()
    }
}

The whole process is still very easy, everyone is welcome to contribute.

About

MIT