8 releases

0.1.7 Feb 1, 2024
0.1.6 Oct 19, 2023
0.1.5 Jul 3, 2021
0.1.4 May 16, 2021
0.1.1 Apr 25, 2021

#148 in Development tools

36 downloads per month

MIT/Apache

7.5MB
875 lines

ocy – Project Cleaner

A simple, temporary build files cleaning CLI app written in Rust.

Colophon

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.

BBayCrab2

Installation

cargo install ocy

Motivation

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.

Supported Rules

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

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

Future Plans

  • 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.

Dependencies

~4–14MB
~129K SLoC