Skip to content

Commit

Permalink
Publish Crate (#6)
Browse files Browse the repository at this point in the history
* Merge cli and scanner crate

* Rename scanner folder to devclean folder

* chore: Update devclean project metadata
  • Loading branch information
HuakunShen committed May 6, 2024
1 parent 24fd834 commit 6745c71
Show file tree
Hide file tree
Showing 17 changed files with 17 additions and 159 deletions.
14 changes: 0 additions & 14 deletions cli/src/bin/pb.rs

This file was deleted.

10 changes: 7 additions & 3 deletions cli/Cargo.toml → devclean/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@
name = "devclean"
version = "0.1.0"
edition = "2021"
default-run = "devclean"
description = "A tool to clean up your development environment"
license = "MIT"
repository = "https://github.com/HuakunShen/devclean"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = { version = "4.5.4", features = ["derive", "cargo"] }
color-eyre = "0.6.3"
dialoguer = "0.11.0"
fs_extra = "1.3.0"
git2 = "0.18.3"
human_bytes = "0.4.3"
humantime = "2.1.0"
indicatif = "0.17.8"
prettytable = "0.10.0"
prettytable-rs = "0.10.0"
rayon = "1.10.0"
scanner = { path = "../scanner" }
walkdir = "2.5.0"
8 changes: 5 additions & 3 deletions cli/src/lib.rs → devclean/src/cleaner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use color_eyre::Result;
use fs_extra::dir::get_size;
use human_bytes::human_bytes;
use indicatif::ProgressBar;
use scanner::results::AnalyzeTarget;
use std::{io::Write, time::Duration};
use crate::results::AnalyzeTarget;
use std::io::Write;

pub struct Cleaner {
pub bytes_cleaned: u128,
Expand All @@ -24,7 +24,9 @@ impl Cleaner {
if !self.dry_run {
std::fs::remove_dir_all(&target.path)?;
}
let size = target.size.unwrap_or_else(|| get_size(target.path.clone()).unwrap_or(0));
let size = target
.size
.unwrap_or_else(|| get_size(target.path.clone()).unwrap_or(0));
self.bytes_cleaned += size as u128;
pb.inc(1);
}
Expand Down
1 change: 1 addition & 0 deletions scanner/src/lib.rs → devclean/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod predicates;
pub mod results;
pub mod scanner;
pub mod cleaner;
9 changes: 4 additions & 5 deletions cli/src/main.rs → devclean/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use clap::{Parser, Subcommand};
use color_eyre::Result;
use devclean::Cleaner;
use dialoguer::{theme::ColorfulTheme, MultiSelect};
use human_bytes::human_bytes;
use scanner::{
use devclean::cleaner::Cleaner;
use devclean::{
results::AnalyzeTargets,
scanner::{get_dirty_git_repo_scanner, get_project_garbage_scanner},
};
use dialoguer::{theme::ColorfulTheme, MultiSelect};
use human_bytes::human_bytes;
use std::path::PathBuf;

/// Simple program to greet a person
Expand Down Expand Up @@ -62,7 +62,6 @@ fn main() -> Result<()> {
}
let removable_scanner = get_project_garbage_scanner(args.depth, true);
let mut cleaner = Cleaner::new(args.dry_run, args.all);
let start = std::time::Instant::now();
let mut target_paths = removable_scanner.scan_parallel(&path, 0);
target_paths.sort_by(|a, b| b.cmp(a));
let to_clean = if args.yes {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 0 additions & 16 deletions scanner/Cargo.toml

This file was deleted.

72 changes: 0 additions & 72 deletions scanner/src/bin/parallel.rs

This file was deleted.

46 changes: 0 additions & 46 deletions scanner/src/bin/parallel_mut.rs

This file was deleted.

0 comments on commit 6745c71

Please sign in to comment.