Crates.io | ocy |
lib.rs | ocy |
version | 0.1.7 |
source | src |
created_at | 2021-04-23 07:02:32.243693 |
updated_at | 2024-02-01 07:55:09.888958 |
description | ocy is a simple project cleaner CLI |
homepage | |
repository | |
max_upload_size | |
id | 388474 |
size | 7,731,316 |
ocy
– Project CleanerA simple, temporary build files cleaning CLI app written in Rust.
Ocy
is short for Ocypode cordimanus, or smooth-handed ghost crab.
Like all crabs of the genus Ocypode, it has one claw larger than the other (as
on the banner).
Although he's so cute, ocy
is a scavenger – he will take care of your dead
bytes.
cargo install ocy
I use to play a lot with several languages/techs and would regularily end up with GBs used by temporary build outputs on my litte Macbook Pro SSD.
Each build/project system have its own convention for storing temporary build
files (i.e Cargo will use target
, gradle will use build
, etc. …) and I
wanted to have a quick tool for wiping them securely.
Why not an existing tool?
Most of cleanup/wipe tools I found seem to focus on handling up one single type of project.
Why not bash
?
Clever use of bash/find can give you 80% of what ocy
is doing. However, if
we want a little bit of security, for instance matching folders by the build
pattern may have a lot of false positive, and ergonomics, such as displaying
and summing-up folder size, something more involved is required.
Why Rust?
It is fun to write a CLI app in Rust! And in the end the executable will be quite small (currently around 3.2MB without too much time spent into optimizing it). Any language could have done the job here. So this is for fun and learning.
Ocy
is based on the idea of rules for detecting projects.
In the current form a pattern is given for detecting the project, and another
pattern for files and folders to delete.
Rule name | Project matcher | Files to delete |
---|---|---|
Cargo | Cargo.toml | target |
Gradle | build.gradle | build |
GradleKTS | build.gradle.kts | build |
Maven | pom.xml | target |
NodeJS | * | node_modules |
XCode | * | DerivedData |
SBT | build.sbt | target |
SBT | plugins.sbt | target |
Usage: ocy [OPTIONS]
Optional arguments:
-h, --help print help message
-i, --ignores IGNORES ignore this path
-v, --version print version
-a, --all walk into hidden dirs
Make a TUI; since the ‘UI’ is decoupled from the cleaning logic (ocy-core
)
it should be easy to support both CLI and TUI.
Add user customizable rules, and support more projects resp. more complex rule definition.