├── .editorconfig ├── .github └── workflows │ ├── check-and-lint.yaml │ └── rust.yml ├── .gitignore ├── CHANGELOG.md ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── rustfmt.toml └── src ├── arg.rs ├── clean.rs ├── error.rs └── main.rs /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | 6 | [*.rs] 7 | indent_style = tab 8 | indent_size = 2 9 | 10 | -------------------------------------------------------------------------------- /.github/workflows/check-and-lint.yaml: -------------------------------------------------------------------------------- 1 | on: 2 | pull_request: 3 | push: 4 | branches: 5 | - main 6 | 7 | 8 | name: Check and Lint 9 | 10 | jobs: 11 | check: 12 | name: Check 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | - uses: actions-rs/toolchain@v1 17 | with: 18 | profile: minimal 19 | toolchain: stable 20 | override: true 21 | - uses: rui314/setup-mold@v1 22 | - uses: actions-rs/cargo@v1 23 | with: 24 | command: check 25 | 26 | fmt: 27 | name: Rustfmt 28 | runs-on: ubuntu-latest 29 | steps: 30 | - uses: actions/checkout@v2 31 | - uses: actions-rs/toolchain@v1 32 | with: 33 | profile: minimal 34 | toolchain: stable 35 | override: true 36 | - run: rustup component add rustfmt 37 | - uses: rui314/setup-mold@v1 38 | - uses: actions-rs/cargo@v1 39 | with: 40 | command: fmt 41 | args: --all -- --check 42 | 43 | clippy: 44 | name: Clippy 45 | runs-on: ubuntu-latest 46 | steps: 47 | - uses: actions/checkout@v2 48 | - uses: actions-rs/toolchain@v1 49 | with: 50 | toolchain: stable 51 | components: clippy 52 | override: true 53 | - uses: rui314/setup-mold@v1 54 | - uses: actions-rs/clippy-check@v1 55 | with: 56 | token: ${{ secrets.GITHUB_TOKEN }} 57 | args: --all-features 58 | name: Clippy Output 59 | -------------------------------------------------------------------------------- /.github/workflows/rust.yml: -------------------------------------------------------------------------------- 1 | name: Rust 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | pull_request: 7 | branches: [ "main" ] 8 | 9 | env: 10 | CARGO_TERM_COLOR: always 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v3 19 | - uses: rui314/setup-mold@v1 20 | - name: Build 21 | run: mold -run cargo build --verbose 22 | - name: Run tests 23 | run: mold -run cargo test --verbose 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 0.1.2 2 | + Updated package tags 3 | 4 | # 0.1.1 5 | + Fixed ignored folders not being igored if symlinked 6 | 7 | # 0.1.0 8 | + Initial release 9 | 10 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "addr2line" 7 | version = "0.19.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" 10 | dependencies = [ 11 | "gimli", 12 | ] 13 | 14 | [[package]] 15 | name = "adler" 16 | version = "1.0.2" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 19 | 20 | [[package]] 21 | name = "ahash" 22 | version = "0.7.6" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" 25 | dependencies = [ 26 | "getrandom", 27 | "once_cell", 28 | "version_check", 29 | ] 30 | 31 | [[package]] 32 | name = "aho-corasick" 33 | version = "0.7.20" 34 | source = "registry+https://github.com/rust-lang/crates.io-index" 35 | checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" 36 | dependencies = [ 37 | "memchr", 38 | ] 39 | 40 | [[package]] 41 | name = "android_system_properties" 42 | version = "0.1.5" 43 | source = "registry+https://github.com/rust-lang/crates.io-index" 44 | checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" 45 | dependencies = [ 46 | "libc", 47 | ] 48 | 49 | [[package]] 50 | name = "atty" 51 | version = "0.2.14" 52 | source = "registry+https://github.com/rust-lang/crates.io-index" 53 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 54 | dependencies = [ 55 | "hermit-abi 0.1.19", 56 | "libc", 57 | "winapi", 58 | ] 59 | 60 | [[package]] 61 | name = "autocfg" 62 | version = "1.1.0" 63 | source = "registry+https://github.com/rust-lang/crates.io-index" 64 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 65 | 66 | [[package]] 67 | name = "backtrace" 68 | version = "0.3.67" 69 | source = "registry+https://github.com/rust-lang/crates.io-index" 70 | checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" 71 | dependencies = [ 72 | "addr2line", 73 | "cc", 74 | "cfg-if", 75 | "libc", 76 | "miniz_oxide", 77 | "object", 78 | "rustc-demangle", 79 | ] 80 | 81 | [[package]] 82 | name = "bitflags" 83 | version = "1.3.2" 84 | source = "registry+https://github.com/rust-lang/crates.io-index" 85 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 86 | 87 | [[package]] 88 | name = "bumpalo" 89 | version = "3.12.0" 90 | source = "registry+https://github.com/rust-lang/crates.io-index" 91 | checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" 92 | 93 | [[package]] 94 | name = "cargo-cleanall" 95 | version = "0.1.2" 96 | dependencies = [ 97 | "clap", 98 | "flexi_logger", 99 | "human_bytes", 100 | "log", 101 | "miette", 102 | "path-absolutize", 103 | "thiserror", 104 | "tokio", 105 | "unwrap_or", 106 | "walkdir", 107 | ] 108 | 109 | [[package]] 110 | name = "cc" 111 | version = "1.0.78" 112 | source = "registry+https://github.com/rust-lang/crates.io-index" 113 | checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" 114 | 115 | [[package]] 116 | name = "cfg-if" 117 | version = "1.0.0" 118 | source = "registry+https://github.com/rust-lang/crates.io-index" 119 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 120 | 121 | [[package]] 122 | name = "chrono" 123 | version = "0.4.23" 124 | source = "registry+https://github.com/rust-lang/crates.io-index" 125 | checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" 126 | dependencies = [ 127 | "iana-time-zone", 128 | "num-integer", 129 | "num-traits", 130 | "winapi", 131 | ] 132 | 133 | [[package]] 134 | name = "clap" 135 | version = "4.1.3" 136 | source = "registry+https://github.com/rust-lang/crates.io-index" 137 | checksum = "d8d93d855ce6a0aa87b8473ef9169482f40abaa2e9e0993024c35c902cbd5920" 138 | dependencies = [ 139 | "bitflags", 140 | "clap_lex", 141 | "is-terminal", 142 | "once_cell", 143 | "strsim", 144 | "termcolor", 145 | "terminal_size 0.2.3", 146 | ] 147 | 148 | [[package]] 149 | name = "clap_lex" 150 | version = "0.3.1" 151 | source = "registry+https://github.com/rust-lang/crates.io-index" 152 | checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" 153 | dependencies = [ 154 | "os_str_bytes", 155 | ] 156 | 157 | [[package]] 158 | name = "codespan-reporting" 159 | version = "0.11.1" 160 | source = "registry+https://github.com/rust-lang/crates.io-index" 161 | checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" 162 | dependencies = [ 163 | "termcolor", 164 | "unicode-width", 165 | ] 166 | 167 | [[package]] 168 | name = "core-foundation-sys" 169 | version = "0.8.3" 170 | source = "registry+https://github.com/rust-lang/crates.io-index" 171 | checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" 172 | 173 | [[package]] 174 | name = "cxx" 175 | version = "1.0.87" 176 | source = "registry+https://github.com/rust-lang/crates.io-index" 177 | checksum = "b61a7545f753a88bcbe0a70de1fcc0221e10bfc752f576754fa91e663db1622e" 178 | dependencies = [ 179 | "cc", 180 | "cxxbridge-flags", 181 | "cxxbridge-macro", 182 | "link-cplusplus", 183 | ] 184 | 185 | [[package]] 186 | name = "cxx-build" 187 | version = "1.0.87" 188 | source = "registry+https://github.com/rust-lang/crates.io-index" 189 | checksum = "f464457d494b5ed6905c63b0c4704842aba319084a0a3561cdc1359536b53200" 190 | dependencies = [ 191 | "cc", 192 | "codespan-reporting", 193 | "once_cell", 194 | "proc-macro2", 195 | "quote", 196 | "scratch", 197 | "syn", 198 | ] 199 | 200 | [[package]] 201 | name = "cxxbridge-flags" 202 | version = "1.0.87" 203 | source = "registry+https://github.com/rust-lang/crates.io-index" 204 | checksum = "43c7119ce3a3701ed81aca8410b9acf6fc399d2629d057b87e2efa4e63a3aaea" 205 | 206 | [[package]] 207 | name = "cxxbridge-macro" 208 | version = "1.0.87" 209 | source = "registry+https://github.com/rust-lang/crates.io-index" 210 | checksum = "65e07508b90551e610910fa648a1878991d367064997a596135b86df30daf07e" 211 | dependencies = [ 212 | "proc-macro2", 213 | "quote", 214 | "syn", 215 | ] 216 | 217 | [[package]] 218 | name = "errno" 219 | version = "0.2.8" 220 | source = "registry+https://github.com/rust-lang/crates.io-index" 221 | checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" 222 | dependencies = [ 223 | "errno-dragonfly", 224 | "libc", 225 | "winapi", 226 | ] 227 | 228 | [[package]] 229 | name = "errno-dragonfly" 230 | version = "0.1.2" 231 | source = "registry+https://github.com/rust-lang/crates.io-index" 232 | checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" 233 | dependencies = [ 234 | "cc", 235 | "libc", 236 | ] 237 | 238 | [[package]] 239 | name = "flexi_logger" 240 | version = "0.24.2" 241 | source = "registry+https://github.com/rust-lang/crates.io-index" 242 | checksum = "ade8e86c48285f138a4d6ca15a2912e39bd6c74d62db42da4f1985f651a0b057" 243 | dependencies = [ 244 | "atty", 245 | "chrono", 246 | "glob", 247 | "lazy_static", 248 | "log", 249 | "nu-ansi-term", 250 | "regex", 251 | "thiserror", 252 | ] 253 | 254 | [[package]] 255 | name = "getrandom" 256 | version = "0.2.8" 257 | source = "registry+https://github.com/rust-lang/crates.io-index" 258 | checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" 259 | dependencies = [ 260 | "cfg-if", 261 | "libc", 262 | "wasi", 263 | ] 264 | 265 | [[package]] 266 | name = "gimli" 267 | version = "0.27.1" 268 | source = "registry+https://github.com/rust-lang/crates.io-index" 269 | checksum = "221996f774192f0f718773def8201c4ae31f02616a54ccfc2d358bb0e5cefdec" 270 | 271 | [[package]] 272 | name = "glob" 273 | version = "0.3.1" 274 | source = "registry+https://github.com/rust-lang/crates.io-index" 275 | checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" 276 | 277 | [[package]] 278 | name = "hashbrown" 279 | version = "0.12.3" 280 | source = "registry+https://github.com/rust-lang/crates.io-index" 281 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 282 | dependencies = [ 283 | "ahash", 284 | ] 285 | 286 | [[package]] 287 | name = "hermit-abi" 288 | version = "0.1.19" 289 | source = "registry+https://github.com/rust-lang/crates.io-index" 290 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 291 | dependencies = [ 292 | "libc", 293 | ] 294 | 295 | [[package]] 296 | name = "hermit-abi" 297 | version = "0.2.6" 298 | source = "registry+https://github.com/rust-lang/crates.io-index" 299 | checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" 300 | dependencies = [ 301 | "libc", 302 | ] 303 | 304 | [[package]] 305 | name = "human_bytes" 306 | version = "0.4.1" 307 | source = "registry+https://github.com/rust-lang/crates.io-index" 308 | checksum = "39b528196c838e8b3da8b665e08c30958a6f2ede91d79f2ffcd0d4664b9c64eb" 309 | 310 | [[package]] 311 | name = "iana-time-zone" 312 | version = "0.1.53" 313 | source = "registry+https://github.com/rust-lang/crates.io-index" 314 | checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" 315 | dependencies = [ 316 | "android_system_properties", 317 | "core-foundation-sys", 318 | "iana-time-zone-haiku", 319 | "js-sys", 320 | "wasm-bindgen", 321 | "winapi", 322 | ] 323 | 324 | [[package]] 325 | name = "iana-time-zone-haiku" 326 | version = "0.1.1" 327 | source = "registry+https://github.com/rust-lang/crates.io-index" 328 | checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" 329 | dependencies = [ 330 | "cxx", 331 | "cxx-build", 332 | ] 333 | 334 | [[package]] 335 | name = "io-lifetimes" 336 | version = "1.0.4" 337 | source = "registry+https://github.com/rust-lang/crates.io-index" 338 | checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" 339 | dependencies = [ 340 | "libc", 341 | "windows-sys", 342 | ] 343 | 344 | [[package]] 345 | name = "is-terminal" 346 | version = "0.4.2" 347 | source = "registry+https://github.com/rust-lang/crates.io-index" 348 | checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" 349 | dependencies = [ 350 | "hermit-abi 0.2.6", 351 | "io-lifetimes", 352 | "rustix", 353 | "windows-sys", 354 | ] 355 | 356 | [[package]] 357 | name = "is_ci" 358 | version = "1.1.1" 359 | source = "registry+https://github.com/rust-lang/crates.io-index" 360 | checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb" 361 | 362 | [[package]] 363 | name = "js-sys" 364 | version = "0.3.60" 365 | source = "registry+https://github.com/rust-lang/crates.io-index" 366 | checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" 367 | dependencies = [ 368 | "wasm-bindgen", 369 | ] 370 | 371 | [[package]] 372 | name = "lazy_static" 373 | version = "1.4.0" 374 | source = "registry+https://github.com/rust-lang/crates.io-index" 375 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 376 | 377 | [[package]] 378 | name = "libc" 379 | version = "0.2.139" 380 | source = "registry+https://github.com/rust-lang/crates.io-index" 381 | checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" 382 | 383 | [[package]] 384 | name = "link-cplusplus" 385 | version = "1.0.8" 386 | source = "registry+https://github.com/rust-lang/crates.io-index" 387 | checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" 388 | dependencies = [ 389 | "cc", 390 | ] 391 | 392 | [[package]] 393 | name = "linux-raw-sys" 394 | version = "0.1.4" 395 | source = "registry+https://github.com/rust-lang/crates.io-index" 396 | checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" 397 | 398 | [[package]] 399 | name = "log" 400 | version = "0.4.17" 401 | source = "registry+https://github.com/rust-lang/crates.io-index" 402 | checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" 403 | dependencies = [ 404 | "cfg-if", 405 | ] 406 | 407 | [[package]] 408 | name = "memchr" 409 | version = "2.5.0" 410 | source = "registry+https://github.com/rust-lang/crates.io-index" 411 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 412 | 413 | [[package]] 414 | name = "miette" 415 | version = "5.5.0" 416 | source = "registry+https://github.com/rust-lang/crates.io-index" 417 | checksum = "4afd9b301defa984bbdbe112b4763e093ed191750a0d914a78c1106b2d0fe703" 418 | dependencies = [ 419 | "atty", 420 | "backtrace", 421 | "miette-derive", 422 | "once_cell", 423 | "owo-colors", 424 | "supports-color", 425 | "supports-hyperlinks", 426 | "supports-unicode", 427 | "terminal_size 0.1.17", 428 | "textwrap", 429 | "thiserror", 430 | "unicode-width", 431 | ] 432 | 433 | [[package]] 434 | name = "miette-derive" 435 | version = "5.5.0" 436 | source = "registry+https://github.com/rust-lang/crates.io-index" 437 | checksum = "97c2401ab7ac5282ca5c8b518a87635b1a93762b0b90b9990c509888eeccba29" 438 | dependencies = [ 439 | "proc-macro2", 440 | "quote", 441 | "syn", 442 | ] 443 | 444 | [[package]] 445 | name = "miniz_oxide" 446 | version = "0.6.2" 447 | source = "registry+https://github.com/rust-lang/crates.io-index" 448 | checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" 449 | dependencies = [ 450 | "adler", 451 | ] 452 | 453 | [[package]] 454 | name = "nu-ansi-term" 455 | version = "0.46.0" 456 | source = "registry+https://github.com/rust-lang/crates.io-index" 457 | checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" 458 | dependencies = [ 459 | "overload", 460 | "winapi", 461 | ] 462 | 463 | [[package]] 464 | name = "num-integer" 465 | version = "0.1.45" 466 | source = "registry+https://github.com/rust-lang/crates.io-index" 467 | checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" 468 | dependencies = [ 469 | "autocfg", 470 | "num-traits", 471 | ] 472 | 473 | [[package]] 474 | name = "num-traits" 475 | version = "0.2.15" 476 | source = "registry+https://github.com/rust-lang/crates.io-index" 477 | checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" 478 | dependencies = [ 479 | "autocfg", 480 | ] 481 | 482 | [[package]] 483 | name = "num_cpus" 484 | version = "1.15.0" 485 | source = "registry+https://github.com/rust-lang/crates.io-index" 486 | checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" 487 | dependencies = [ 488 | "hermit-abi 0.2.6", 489 | "libc", 490 | ] 491 | 492 | [[package]] 493 | name = "object" 494 | version = "0.30.3" 495 | source = "registry+https://github.com/rust-lang/crates.io-index" 496 | checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" 497 | dependencies = [ 498 | "memchr", 499 | ] 500 | 501 | [[package]] 502 | name = "once_cell" 503 | version = "1.17.0" 504 | source = "registry+https://github.com/rust-lang/crates.io-index" 505 | checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" 506 | 507 | [[package]] 508 | name = "os_str_bytes" 509 | version = "6.4.1" 510 | source = "registry+https://github.com/rust-lang/crates.io-index" 511 | checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" 512 | 513 | [[package]] 514 | name = "overload" 515 | version = "0.1.1" 516 | source = "registry+https://github.com/rust-lang/crates.io-index" 517 | checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" 518 | 519 | [[package]] 520 | name = "owo-colors" 521 | version = "3.5.0" 522 | source = "registry+https://github.com/rust-lang/crates.io-index" 523 | checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" 524 | 525 | [[package]] 526 | name = "path-absolutize" 527 | version = "3.0.14" 528 | source = "registry+https://github.com/rust-lang/crates.io-index" 529 | checksum = "0f1d4993b16f7325d90c18c3c6a3327db7808752db8d208cea0acee0abd52c52" 530 | dependencies = [ 531 | "path-dedot", 532 | ] 533 | 534 | [[package]] 535 | name = "path-dedot" 536 | version = "3.0.18" 537 | source = "registry+https://github.com/rust-lang/crates.io-index" 538 | checksum = "9a81540d94551664b72b72829b12bd167c73c9d25fbac0e04fafa8023f7e4901" 539 | dependencies = [ 540 | "once_cell", 541 | ] 542 | 543 | [[package]] 544 | name = "pin-project-lite" 545 | version = "0.2.9" 546 | source = "registry+https://github.com/rust-lang/crates.io-index" 547 | checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" 548 | 549 | [[package]] 550 | name = "proc-macro2" 551 | version = "1.0.50" 552 | source = "registry+https://github.com/rust-lang/crates.io-index" 553 | checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" 554 | dependencies = [ 555 | "unicode-ident", 556 | ] 557 | 558 | [[package]] 559 | name = "quote" 560 | version = "1.0.23" 561 | source = "registry+https://github.com/rust-lang/crates.io-index" 562 | checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" 563 | dependencies = [ 564 | "proc-macro2", 565 | ] 566 | 567 | [[package]] 568 | name = "regex" 569 | version = "1.7.1" 570 | source = "registry+https://github.com/rust-lang/crates.io-index" 571 | checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" 572 | dependencies = [ 573 | "aho-corasick", 574 | "memchr", 575 | "regex-syntax", 576 | ] 577 | 578 | [[package]] 579 | name = "regex-syntax" 580 | version = "0.6.28" 581 | source = "registry+https://github.com/rust-lang/crates.io-index" 582 | checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" 583 | 584 | [[package]] 585 | name = "rustc-demangle" 586 | version = "0.1.21" 587 | source = "registry+https://github.com/rust-lang/crates.io-index" 588 | checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" 589 | 590 | [[package]] 591 | name = "rustix" 592 | version = "0.36.7" 593 | source = "registry+https://github.com/rust-lang/crates.io-index" 594 | checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03" 595 | dependencies = [ 596 | "bitflags", 597 | "errno", 598 | "io-lifetimes", 599 | "libc", 600 | "linux-raw-sys", 601 | "windows-sys", 602 | ] 603 | 604 | [[package]] 605 | name = "same-file" 606 | version = "1.0.6" 607 | source = "registry+https://github.com/rust-lang/crates.io-index" 608 | checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" 609 | dependencies = [ 610 | "winapi-util", 611 | ] 612 | 613 | [[package]] 614 | name = "scratch" 615 | version = "1.0.3" 616 | source = "registry+https://github.com/rust-lang/crates.io-index" 617 | checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" 618 | 619 | [[package]] 620 | name = "smawk" 621 | version = "0.3.1" 622 | source = "registry+https://github.com/rust-lang/crates.io-index" 623 | checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043" 624 | 625 | [[package]] 626 | name = "strsim" 627 | version = "0.10.0" 628 | source = "registry+https://github.com/rust-lang/crates.io-index" 629 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 630 | 631 | [[package]] 632 | name = "supports-color" 633 | version = "1.3.1" 634 | source = "registry+https://github.com/rust-lang/crates.io-index" 635 | checksum = "8ba6faf2ca7ee42fdd458f4347ae0a9bd6bcc445ad7cb57ad82b383f18870d6f" 636 | dependencies = [ 637 | "atty", 638 | "is_ci", 639 | ] 640 | 641 | [[package]] 642 | name = "supports-hyperlinks" 643 | version = "1.2.0" 644 | source = "registry+https://github.com/rust-lang/crates.io-index" 645 | checksum = "590b34f7c5f01ecc9d78dba4b3f445f31df750a67621cf31626f3b7441ce6406" 646 | dependencies = [ 647 | "atty", 648 | ] 649 | 650 | [[package]] 651 | name = "supports-unicode" 652 | version = "1.0.2" 653 | source = "registry+https://github.com/rust-lang/crates.io-index" 654 | checksum = "a8b945e45b417b125a8ec51f1b7df2f8df7920367700d1f98aedd21e5735f8b2" 655 | dependencies = [ 656 | "atty", 657 | ] 658 | 659 | [[package]] 660 | name = "syn" 661 | version = "1.0.107" 662 | source = "registry+https://github.com/rust-lang/crates.io-index" 663 | checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" 664 | dependencies = [ 665 | "proc-macro2", 666 | "quote", 667 | "unicode-ident", 668 | ] 669 | 670 | [[package]] 671 | name = "termcolor" 672 | version = "1.2.0" 673 | source = "registry+https://github.com/rust-lang/crates.io-index" 674 | checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" 675 | dependencies = [ 676 | "winapi-util", 677 | ] 678 | 679 | [[package]] 680 | name = "terminal_size" 681 | version = "0.1.17" 682 | source = "registry+https://github.com/rust-lang/crates.io-index" 683 | checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" 684 | dependencies = [ 685 | "libc", 686 | "winapi", 687 | ] 688 | 689 | [[package]] 690 | name = "terminal_size" 691 | version = "0.2.3" 692 | source = "registry+https://github.com/rust-lang/crates.io-index" 693 | checksum = "cb20089a8ba2b69debd491f8d2d023761cbf196e999218c591fa1e7e15a21907" 694 | dependencies = [ 695 | "rustix", 696 | "windows-sys", 697 | ] 698 | 699 | [[package]] 700 | name = "textwrap" 701 | version = "0.15.2" 702 | source = "registry+https://github.com/rust-lang/crates.io-index" 703 | checksum = "b7b3e525a49ec206798b40326a44121291b530c963cfb01018f63e135bac543d" 704 | dependencies = [ 705 | "smawk", 706 | "unicode-linebreak", 707 | "unicode-width", 708 | ] 709 | 710 | [[package]] 711 | name = "thiserror" 712 | version = "1.0.38" 713 | source = "registry+https://github.com/rust-lang/crates.io-index" 714 | checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" 715 | dependencies = [ 716 | "thiserror-impl", 717 | ] 718 | 719 | [[package]] 720 | name = "thiserror-impl" 721 | version = "1.0.38" 722 | source = "registry+https://github.com/rust-lang/crates.io-index" 723 | checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" 724 | dependencies = [ 725 | "proc-macro2", 726 | "quote", 727 | "syn", 728 | ] 729 | 730 | [[package]] 731 | name = "tokio" 732 | version = "1.24.2" 733 | source = "registry+https://github.com/rust-lang/crates.io-index" 734 | checksum = "597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb" 735 | dependencies = [ 736 | "autocfg", 737 | "num_cpus", 738 | "pin-project-lite", 739 | "tokio-macros", 740 | "windows-sys", 741 | ] 742 | 743 | [[package]] 744 | name = "tokio-macros" 745 | version = "1.8.2" 746 | source = "registry+https://github.com/rust-lang/crates.io-index" 747 | checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" 748 | dependencies = [ 749 | "proc-macro2", 750 | "quote", 751 | "syn", 752 | ] 753 | 754 | [[package]] 755 | name = "unicode-ident" 756 | version = "1.0.6" 757 | source = "registry+https://github.com/rust-lang/crates.io-index" 758 | checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" 759 | 760 | [[package]] 761 | name = "unicode-linebreak" 762 | version = "0.1.4" 763 | source = "registry+https://github.com/rust-lang/crates.io-index" 764 | checksum = "c5faade31a542b8b35855fff6e8def199853b2da8da256da52f52f1316ee3137" 765 | dependencies = [ 766 | "hashbrown", 767 | "regex", 768 | ] 769 | 770 | [[package]] 771 | name = "unicode-width" 772 | version = "0.1.10" 773 | source = "registry+https://github.com/rust-lang/crates.io-index" 774 | checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" 775 | 776 | [[package]] 777 | name = "unwrap_or" 778 | version = "1.0.0" 779 | source = "registry+https://github.com/rust-lang/crates.io-index" 780 | checksum = "2fbfe96089af082b3c856f83bdd0b6866241377d9dbea803fb39481151e5742d" 781 | 782 | [[package]] 783 | name = "version_check" 784 | version = "0.9.4" 785 | source = "registry+https://github.com/rust-lang/crates.io-index" 786 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 787 | 788 | [[package]] 789 | name = "walkdir" 790 | version = "2.3.2" 791 | source = "registry+https://github.com/rust-lang/crates.io-index" 792 | checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" 793 | dependencies = [ 794 | "same-file", 795 | "winapi", 796 | "winapi-util", 797 | ] 798 | 799 | [[package]] 800 | name = "wasi" 801 | version = "0.11.0+wasi-snapshot-preview1" 802 | source = "registry+https://github.com/rust-lang/crates.io-index" 803 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 804 | 805 | [[package]] 806 | name = "wasm-bindgen" 807 | version = "0.2.83" 808 | source = "registry+https://github.com/rust-lang/crates.io-index" 809 | checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" 810 | dependencies = [ 811 | "cfg-if", 812 | "wasm-bindgen-macro", 813 | ] 814 | 815 | [[package]] 816 | name = "wasm-bindgen-backend" 817 | version = "0.2.83" 818 | source = "registry+https://github.com/rust-lang/crates.io-index" 819 | checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" 820 | dependencies = [ 821 | "bumpalo", 822 | "log", 823 | "once_cell", 824 | "proc-macro2", 825 | "quote", 826 | "syn", 827 | "wasm-bindgen-shared", 828 | ] 829 | 830 | [[package]] 831 | name = "wasm-bindgen-macro" 832 | version = "0.2.83" 833 | source = "registry+https://github.com/rust-lang/crates.io-index" 834 | checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" 835 | dependencies = [ 836 | "quote", 837 | "wasm-bindgen-macro-support", 838 | ] 839 | 840 | [[package]] 841 | name = "wasm-bindgen-macro-support" 842 | version = "0.2.83" 843 | source = "registry+https://github.com/rust-lang/crates.io-index" 844 | checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" 845 | dependencies = [ 846 | "proc-macro2", 847 | "quote", 848 | "syn", 849 | "wasm-bindgen-backend", 850 | "wasm-bindgen-shared", 851 | ] 852 | 853 | [[package]] 854 | name = "wasm-bindgen-shared" 855 | version = "0.2.83" 856 | source = "registry+https://github.com/rust-lang/crates.io-index" 857 | checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" 858 | 859 | [[package]] 860 | name = "winapi" 861 | version = "0.3.9" 862 | source = "registry+https://github.com/rust-lang/crates.io-index" 863 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 864 | dependencies = [ 865 | "winapi-i686-pc-windows-gnu", 866 | "winapi-x86_64-pc-windows-gnu", 867 | ] 868 | 869 | [[package]] 870 | name = "winapi-i686-pc-windows-gnu" 871 | version = "0.4.0" 872 | source = "registry+https://github.com/rust-lang/crates.io-index" 873 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 874 | 875 | [[package]] 876 | name = "winapi-util" 877 | version = "0.1.5" 878 | source = "registry+https://github.com/rust-lang/crates.io-index" 879 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 880 | dependencies = [ 881 | "winapi", 882 | ] 883 | 884 | [[package]] 885 | name = "winapi-x86_64-pc-windows-gnu" 886 | version = "0.4.0" 887 | source = "registry+https://github.com/rust-lang/crates.io-index" 888 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 889 | 890 | [[package]] 891 | name = "windows-sys" 892 | version = "0.42.0" 893 | source = "registry+https://github.com/rust-lang/crates.io-index" 894 | checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" 895 | dependencies = [ 896 | "windows_aarch64_gnullvm", 897 | "windows_aarch64_msvc", 898 | "windows_i686_gnu", 899 | "windows_i686_msvc", 900 | "windows_x86_64_gnu", 901 | "windows_x86_64_gnullvm", 902 | "windows_x86_64_msvc", 903 | ] 904 | 905 | [[package]] 906 | name = "windows_aarch64_gnullvm" 907 | version = "0.42.1" 908 | source = "registry+https://github.com/rust-lang/crates.io-index" 909 | checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" 910 | 911 | [[package]] 912 | name = "windows_aarch64_msvc" 913 | version = "0.42.1" 914 | source = "registry+https://github.com/rust-lang/crates.io-index" 915 | checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" 916 | 917 | [[package]] 918 | name = "windows_i686_gnu" 919 | version = "0.42.1" 920 | source = "registry+https://github.com/rust-lang/crates.io-index" 921 | checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" 922 | 923 | [[package]] 924 | name = "windows_i686_msvc" 925 | version = "0.42.1" 926 | source = "registry+https://github.com/rust-lang/crates.io-index" 927 | checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" 928 | 929 | [[package]] 930 | name = "windows_x86_64_gnu" 931 | version = "0.42.1" 932 | source = "registry+https://github.com/rust-lang/crates.io-index" 933 | checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" 934 | 935 | [[package]] 936 | name = "windows_x86_64_gnullvm" 937 | version = "0.42.1" 938 | source = "registry+https://github.com/rust-lang/crates.io-index" 939 | checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" 940 | 941 | [[package]] 942 | name = "windows_x86_64_msvc" 943 | version = "0.42.1" 944 | source = "registry+https://github.com/rust-lang/crates.io-index" 945 | checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" 946 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cargo-cleanall" 3 | version = "0.1.3" 4 | edition = "2021" 5 | authors = ["LeSnake "] 6 | description = "Cargo plugin to clean all cargo projects in a directory" 7 | license = "AGPL-3.0" 8 | repository = "https://github.com/LeSnake04/cargo-cleanall" 9 | categories = ["development-tools::cargo-plugins", "command-line-utilities", "development-tools"] 10 | keywords = ["tool", "cli", "cargo"] 11 | publish = true 12 | 13 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 14 | 15 | [dependencies] 16 | clap = { version = "4.1", features = ["wrap_help", "cargo"] } 17 | flexi_logger = "0.24" 18 | human_bytes = "0.4" 19 | log = "0.4" 20 | miette = { version = "5.5", features = ["fancy"] } 21 | path-absolutize = "3.0" 22 | thiserror = "1.0" 23 | tokio = { version = "1.24", features = ["tokio-macros", "rt", "macros", "rt-multi-thread"] } 24 | unwrap_or = "1.0" 25 | walkdir = "2.3" 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published by 637 | the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | 663 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cargo Cleanall 2 | A simple tool to clean all cargo projects in a directory. 3 | 4 | ## Help 5 | ``` 6 | Cargo plugin to clean all cargo projects in a directory 7 | 8 | Usage: cargo cleanall [OPTIONS] ... 9 | 10 | Arguments: 11 | ... Path to search for projects to clean 12 | 13 | Options: 14 | -H, --hidden Get size of and clean hidden folders 15 | -d, --dry Don't clean any files 16 | -i, --ignore Ignore folders 17 | -s, --no-size Don't calculate the size 18 | -h, --help Print help information 19 | -V, --version Print version information 20 | ``` 21 | 22 | ## Output 23 | ``` 24 | $ cargo cleanall . 25 | INFO [cargo_cleanall] 1.2 GB => 117.8 MB (-1.1 GB: -90.303 %) 26 | ``` 27 | 28 | ## Features 29 | + Asynchronous scan and cleanup for fast performance 30 | + Show size from before and after as well as an percentage (Can be turned off). 31 | + Option to include hidden files 32 | + Option to ignore folders 33 | 34 | ## Roadmap 35 | + Bugfixes 36 | + Code cleanup 37 | + Optimizations 38 | Code reviews, suggestions and bug reports are welcome. 39 | 40 | ## Logging 41 | This crate uses [flexi_logger](www.docs.rs/flexyi_logger). 42 | To enable verbose output run with enviroment variable `RUST_LOG="debug"` 43 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | hard_tabs = true 2 | -------------------------------------------------------------------------------- /src/arg.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | 3 | use clap::{value_parser, Arg, ArgAction, ValueHint}; 4 | 5 | pub fn matches() -> clap::ArgMatches { 6 | clap::Command::new("cargo") 7 | .bin_name("cargo") 8 | .subcommand_required(true) 9 | // .setting(clap::AppSettings) 10 | .subcommand( 11 | clap::command!("cleanall") 12 | .args([ 13 | Arg::new("PATHS") 14 | .help("Path to search for projects to clean") 15 | .value_parser(value_parser!(PathBuf)) 16 | .value_hint(ValueHint::DirPath) 17 | .required(true) 18 | .action(ArgAction::Append), 19 | Arg::new("hidden") 20 | .short('H') 21 | .long("hidden") 22 | .action(ArgAction::SetTrue) 23 | .help("Get size of and clean hidden folders"), 24 | Arg::new("dry") 25 | .long("dry") 26 | .short('d') 27 | .action(ArgAction::SetTrue) 28 | .help("Don't clean any files"), 29 | Arg::new("ignore") 30 | .long("ignore") 31 | .short('i') 32 | .value_parser(value_parser!(PathBuf)) 33 | .help("Ignore folders") 34 | .value_hint(ValueHint::DirPath) 35 | .action(ArgAction::Append), 36 | Arg::new("no-size") 37 | .long("no-size") 38 | .short('s') 39 | .action(ArgAction::SetTrue) 40 | .help("Don't calculate the size"), 41 | ]) 42 | .arg_required_else_help(true), 43 | ) 44 | .get_matches() 45 | } 46 | -------------------------------------------------------------------------------- /src/clean.rs: -------------------------------------------------------------------------------- 1 | use crate::MResult; 2 | use std::path::{Path, PathBuf}; 3 | 4 | use clap::{parser::ValuesRef, ArgMatches}; 5 | #[allow(unused_imports)] 6 | use log::warn; 7 | use log::{debug, error, trace}; 8 | use miette::{Context, IntoDiagnostic}; 9 | use path_absolutize::Absolutize; 10 | use tokio::{spawn as tspawn, task::JoinHandle}; 11 | use unwrap_or::unwrap_ok_or; 12 | use walkdir::WalkDir; 13 | 14 | use crate::error::{Error, Result}; 15 | 16 | type Handles = Vec>; 17 | type SizeHandles = Handles>; 18 | // type RunResult = AResult<(std::process::Output, PathBuf)>; 19 | type MRunResult = MResult<(std::process::Output, PathBuf)>; 20 | 21 | #[derive(Debug)] 22 | pub struct CargoClean { 23 | hidden: bool, 24 | workspaces: Vec, 25 | roots: Vec, 26 | size_handles: Option, 27 | ignore: Option>, 28 | } 29 | 30 | impl TryFrom<&ArgMatches> for CargoClean { 31 | type Error = Error; 32 | fn try_from(m: &ArgMatches) -> Result { 33 | Ok(Self { 34 | hidden: *m.get_one("hidden").ok_or(Error::ArgNotSet("hidden"))?, 35 | roots: m 36 | .get_many("PATHS") 37 | .ok_or(Error::ArgNotSet("PATHS"))? 38 | .cloned() 39 | .filter_map(|p: PathBuf| { 40 | Some( 41 | unwrap_ok_or!(p.absolutize(), e, { 42 | error!("Error when absolitizing: {e}"); 43 | return None; 44 | }) 45 | .to_path_buf(), 46 | ) 47 | }) 48 | .collect(), 49 | workspaces: Vec::new(), 50 | size_handles: (!m 51 | .get_one::("no-size") 52 | .ok_or(Error::ArgNotSet("no-size"))?) 53 | .then_some(Vec::new()), 54 | ignore: m.get_many("ignore").map(|i: ValuesRef| { 55 | i.map(|p: &PathBuf| { 56 | let mut out = p 57 | .absolutize() 58 | .unwrap_or_else(|_| panic!("failed to absolutize {}", p.display())) 59 | .to_path_buf(); 60 | if out.is_file() { 61 | out = out 62 | .parent() 63 | .unwrap_or_else(|| panic!("Failed to get parent of {}", out.display())) 64 | .to_path_buf(); 65 | } 66 | out 67 | }) 68 | .collect() 69 | }), 70 | }) 71 | } 72 | } 73 | 74 | #[derive(Debug)] 75 | struct HandleTaskOut { 76 | pub paths: Vec, 77 | pub size_handles: Option, 78 | pub tasks: Vec, 79 | } 80 | 81 | impl HandleTaskOut { 82 | fn new(size: bool) -> HandleTaskOut { 83 | Self { 84 | size_handles: size.then_some(Vec::new()), 85 | paths: Vec::new(), 86 | tasks: Vec::new(), 87 | } 88 | } 89 | } 90 | 91 | impl CargoClean { 92 | #[inline] 93 | async fn get_path<'a>(&mut self, root: impl AsRef, size_only: bool) -> Result<()> { 94 | let mut tasks: Vec = vec![root.as_ref().to_path_buf()]; 95 | let mut tasks_handles: Handles = Vec::new(); 96 | let mut init_run = true; 97 | let hidden: bool = self.hidden; 98 | let size: bool = self.size_handles.is_some(); 99 | let ignore = self.ignore.as_mut().map(|i| { 100 | let mut out: Vec = Vec::new(); 101 | out.append(i); 102 | out 103 | }); 104 | while !tasks_handles.is_empty() || init_run { 105 | init_run = false; 106 | while tasks.get(0).is_some() { 107 | tasks_handles.push( 108 | handle_task( 109 | tasks.swap_remove(0), 110 | size, 111 | hidden, 112 | size_only, 113 | ignore.clone(), 114 | ) 115 | .await, 116 | ); 117 | } 118 | let mut i = 0; 119 | while i < tasks_handles.len() { 120 | if let Some(t) = tasks_handles.get(i) { 121 | if t.is_finished() { 122 | let t = tasks_handles.remove(i); 123 | let mut out: HandleTaskOut = unwrap_ok_or!(t.await, e, { 124 | error!("{e}"); 125 | break; 126 | }); 127 | if !out.paths.is_empty() { 128 | self.workspaces.append(&mut out.paths); 129 | } 130 | if !out.tasks.is_empty() { 131 | tasks.append(&mut out.tasks) 132 | } 133 | if let Some(mut o_size) = out.size_handles { 134 | if !o_size.is_empty() { 135 | if let Some(s) = self.size_handles.as_mut() { 136 | s.append(&mut o_size) 137 | } 138 | } 139 | } 140 | } else { 141 | i += 1; 142 | } 143 | } else { 144 | break; 145 | } 146 | } 147 | } 148 | Ok(()) 149 | } 150 | pub async fn get_paths(&mut self, size_only: bool) { 151 | trace!("Size only: {}", size_only); 152 | for r in self.roots.clone() { 153 | if let Err(e) = self.get_path(r, size_only).await { 154 | error!("{e}") 155 | } 156 | } 157 | } 158 | pub async fn get_size(&mut self) -> Option<(u64, String)> { 159 | let size_handles: &mut SizeHandles = match self.size_handles { 160 | Some(ref mut s) => s, 161 | None => return None, 162 | }; 163 | let mut out: u64 = 0; 164 | let mut i = 0; 165 | while i < size_handles.len() { 166 | if let Some(s) = size_handles.get(i) { 167 | if s.is_finished() { 168 | let size_handle = size_handles.swap_remove(0); 169 | if let Ok(Some(size)) = size_handle.await { 170 | (size > 0).then(|| out += size); 171 | }; 172 | } else { 173 | i += 1 174 | } 175 | } else { 176 | break; 177 | } 178 | } 179 | Some((out, human_bytes::human_bytes(out as f64))) 180 | } 181 | pub async fn run(&mut self) { 182 | let workspaces: Vec = { 183 | let mut out = Vec::new(); 184 | out.append(&mut self.workspaces); 185 | out 186 | }; 187 | let mut tasks: Handles = Vec::new(); 188 | for p in workspaces { 189 | tasks.push(tspawn(async move { 190 | clear_workspace(p.clone()) 191 | .context(format!("Failed to clear project {}", p.display())) 192 | })); 193 | } 194 | let mut i: usize; 195 | while !tasks.is_empty() { 196 | i = 0; 197 | while i < tasks.len() { 198 | if let Some(task) = tasks.get(i) { 199 | if task.is_finished() { 200 | let task = tasks.remove(i); 201 | match task.await { 202 | Ok(Ok(t)) => { 203 | // If getting parent fails, show path to Cargo.toml instead. 204 | debug!("Cleared project {}", t.1.parent().unwrap_or(&t.1).display()) 205 | } 206 | Ok(Err(e)) => error!("{e:?}"), 207 | Err(e) => error!("{e}"), 208 | } 209 | } else { 210 | i += 1; 211 | } 212 | } else { 213 | break; 214 | } 215 | } 216 | } 217 | } 218 | } 219 | #[inline] 220 | fn clear_workspace(manifest: PathBuf) -> MRunResult { 221 | use std::process::Command; 222 | // For some reason Cargo doesn't like a project being run and cleaned at the same time... .-. 223 | #[cfg(debug_assertions)] 224 | if manifest 225 | .parent() 226 | .ok_or_else(|| Error::ParentNotFound(manifest.clone()))? 227 | .file_name() 228 | .ok_or(Error::NoFileName)? 229 | == "cargo-cleanall" 230 | { 231 | warn!("Skipping cargo-cleanall"); 232 | Err(Error::Skipped)?; 233 | }; 234 | Ok(( 235 | Command::new("cargo") 236 | .arg("clean") 237 | .args([ 238 | "--manifest-path", 239 | manifest.to_str().ok_or(Error::ManifestToStrFailed)?, 240 | ]) 241 | .output() 242 | .into_diagnostic()?, 243 | manifest, 244 | )) 245 | } 246 | async fn handle_task( 247 | task: PathBuf, 248 | size: bool, 249 | hidden: bool, 250 | size_only: bool, 251 | ignore: Option>, 252 | ) -> JoinHandle { 253 | tspawn(async move { 254 | let mut out = HandleTaskOut::new(size); 255 | for p in WalkDir::new(task) { 256 | let p = unwrap_ok_or!(p, _, continue); 257 | let p_path: PathBuf = p.clone().into_path(); 258 | trace!("Checking {}", p_path.display()); 259 | if !hidden 260 | && p.file_name() 261 | .to_str() 262 | .map(|s| s.starts_with('.')) 263 | .unwrap_or(false) 264 | { 265 | continue; 266 | } 267 | if p.path().is_dir() { 268 | let p_path_abs: PathBuf = unwrap_ok_or!(p_path.absolutize(), e, { 269 | error!("Failed to absolutize {}, because {e}", p_path.display()); 270 | continue; 271 | }) 272 | .to_path_buf(); 273 | if let Some(ref i) = ignore { 274 | std::mem::drop(p_path); 275 | if i.contains(&p_path_abs) { 276 | debug!( 277 | "Skipped scaning {} because its ignored", 278 | p_path_abs.display() 279 | ); 280 | continue; 281 | } else { 282 | out.tasks.push(p_path_abs); 283 | continue; 284 | } 285 | } 286 | } 287 | if !size_only && p.file_name() == "Cargo.toml" { 288 | debug!( 289 | "Found Project: {}", 290 | p.path().parent().unwrap_or_else(|| p.path()).display() 291 | ); 292 | out.paths.push(p_path); 293 | } 294 | if let Some(ref mut a) = out.size_handles { 295 | a.push(tspawn(async move { p.metadata().ok().map(|m| m.len()) })); 296 | } 297 | } 298 | out 299 | }) 300 | } 301 | -------------------------------------------------------------------------------- /src/error.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | 3 | use miette::Diagnostic; 4 | use thiserror::Error; 5 | 6 | pub type Result = std::result::Result; 7 | 8 | #[derive(Debug, Error, Diagnostic)] 9 | pub enum Error { 10 | #[error("Argument not set: {0}")] 11 | ArgNotSet(&'static str), 12 | #[error("Command failed to execute")] 13 | ExecutionFailed(#[from] std::io::Error), 14 | #[error("Failed to get argument: {0}")] 15 | GetArgFailed(&'static str), 16 | #[error("Failed to start logger")] 17 | InitLoggerFailed(#[from] flexi_logger::FlexiLoggerError), 18 | #[error("Failed to join async")] 19 | JoinError(#[from] tokio::task::JoinError), 20 | #[error("Manifest could not be converted into &str")] 21 | ManifestToStrFailed, 22 | #[error("Failed to get File Name of parent")] 23 | NoFileName, 24 | #[error("Parent not found")] 25 | ParentNotFound(PathBuf), 26 | #[error("Failed to parse Args")] 27 | ParseArgsError(#[from] clap::parser::MatchesError), 28 | #[error("Size not Calculated")] 29 | SizeNotCalculated, 30 | #[cfg(debug_assertions)] 31 | #[error("Skipped")] 32 | Skipped, 33 | } 34 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | #![warn(clippy::all)] 2 | #![warn(clippy::unwrap_used)] 3 | 4 | use clap::ArgMatches; 5 | use clean::CargoClean; 6 | pub use error::{Error, Result}; 7 | use flexi_logger::LogSpecification; 8 | use log::info; 9 | use miette::Context; 10 | pub use miette::Result as MResult; 11 | 12 | pub mod arg; 13 | pub mod clean; 14 | mod error; 15 | 16 | type AResult = std::result::Result>; 17 | 18 | const _: &str = include_str!("../Cargo.toml"); 19 | 20 | #[tokio::main] 21 | async fn main() -> AResult<()> { 22 | #[cfg(debug_assertions)] 23 | let logdefault = "DEBUG"; 24 | #[cfg(not(debug_assertions))] 25 | let logdefault = "INFO"; 26 | flexi_logger::Logger::with(LogSpecification::env_or_parse(logdefault)?).start()?; 27 | let m: ArgMatches = match self::arg::matches().subcommand() { 28 | Some(("cleanall", m)) => m.clone(), 29 | _ => unreachable!("clap should ensure we don't get here"), 30 | }; 31 | // dbg!(m.ids()); 32 | let dry: bool = *m.get_one("dry").ok_or(Error::GetArgFailed("dry"))?; 33 | let mut cleaner = CargoClean::try_from(&m)?; 34 | cleaner.get_paths(false).await; 35 | let size_before = cleaner.get_size().await; 36 | if dry { 37 | if let Some(size) = size_before { 38 | info!("Size: {}", size.1); 39 | } 40 | info!("Stopping because of --dry"); 41 | return Ok(()); 42 | } 43 | cleaner.run().await; 44 | // Get Size again 45 | cleaner.get_paths(true).await; 46 | if let Some(s_before) = size_before { 47 | let size_after = cleaner 48 | .get_size() 49 | .await 50 | .ok_or(Error::SizeNotCalculated) 51 | .context("Size After not calculated")?; 52 | let s_before_i = s_before.0 as i64; 53 | let difference: i64 = s_before_i - size_after.0 as i64; 54 | let difference_str: String = { 55 | let mut out = human_bytes::human_bytes(difference as f64); 56 | if difference > 0 { 57 | out = format!("-{out}"); 58 | } 59 | out 60 | }; 61 | let percent = (100.0 / s_before_i as f64) * (difference as f64); 62 | info!( 63 | "{} => {} ({}: {}{:.3} %)", 64 | s_before.1, 65 | size_after.1, 66 | difference_str, 67 | if percent > 0.0 { "-" } else { "" }, 68 | percent 69 | ); 70 | } 71 | Ok(()) 72 | } 73 | --------------------------------------------------------------------------------