├── .github └── workflows │ └── cicd.yaml ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── file_extensions.txt ├── screen_shot.png └── src ├── analyzer ├── counter.rs ├── error.rs ├── mod.rs ├── result.rs └── walker.rs ├── arg_parser.rs ├── default_ignore.rs ├── default_postfixes.rs ├── main.rs ├── ui ├── chart.rs ├── mod.rs └── table.rs └── update.rs /.github/workflows/cicd.yaml: -------------------------------------------------------------------------------- 1 | # from here: https://dzfrias.dev/blog/deploy-rust-cross-platform-github-actions 2 | 3 | name: Build and Deploy 4 | 5 | on: 6 | push: 7 | tags: 8 | - "[0-9]+.[0-9]+.[0-9]+" 9 | 10 | permissions: 11 | contents: write 12 | 13 | jobs: 14 | build-and-upload: 15 | name: Build and upload 16 | runs-on: ${{ matrix.os }} 17 | 18 | strategy: 19 | matrix: 20 | include: 21 | - build: linux 22 | os: ubuntu-latest 23 | target: x86_64-unknown-linux-musl 24 | 25 | - build: macos 26 | os: macos-latest 27 | target: x86_64-apple-darwin 28 | 29 | # - build: windows-gnu 30 | # os: windows-latest 31 | # target: x86_64-pc-windows-gnu 32 | 33 | steps: 34 | - name: Checkout 35 | uses: actions/checkout@v3 36 | 37 | - name: Get the release version from the tag 38 | shell: bash 39 | run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV 40 | 41 | - name: Install Rust 42 | # Or @nightly if you want 43 | uses: dtolnay/rust-toolchain@stable 44 | # Arguments to pass in 45 | with: 46 | # Make Rust compile to our target (defined in the matrix) 47 | targets: ${{ matrix.target }} 48 | 49 | - name: Build 50 | uses: actions-rs/cargo@v1 51 | with: 52 | use-cross: true 53 | command: build 54 | args: --verbose --release --target ${{ matrix.target }} 55 | 56 | - name: Build archive 57 | shell: bash 58 | run: | 59 | # Replace with the name of your binary 60 | binary_name="project_analyzer" 61 | 62 | dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}" 63 | mkdir "$dirname" 64 | if [ "${{ matrix.os }}" = "windows-latest" ]; then 65 | mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname" 66 | else 67 | mv "target/${{ matrix.target }}/release/$binary_name" "$dirname" 68 | fi 69 | 70 | if [ "${{ matrix.os }}" = "windows-latest" ]; then 71 | 7z a "$dirname.zip" "$dirname" 72 | echo "ASSET=$dirname.zip" >> $GITHUB_ENV 73 | else 74 | tar -czf "$dirname.tar.gz" "$dirname" 75 | echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV 76 | fi 77 | 78 | - name: Release 79 | uses: softprops/action-gh-release@v1 80 | with: 81 | files: | 82 | ${{ env.ASSET }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /linux 3 | -------------------------------------------------------------------------------- /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.21.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" 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 = "aho-corasick" 22 | version = "1.1.2" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" 25 | dependencies = [ 26 | "memchr", 27 | ] 28 | 29 | [[package]] 30 | name = "ansi_term" 31 | version = "0.12.1" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" 34 | dependencies = [ 35 | "winapi", 36 | ] 37 | 38 | [[package]] 39 | name = "anstream" 40 | version = "0.6.12" 41 | source = "registry+https://github.com/rust-lang/crates.io-index" 42 | checksum = "96b09b5178381e0874812a9b157f7fe84982617e48f71f4e3235482775e5b540" 43 | dependencies = [ 44 | "anstyle", 45 | "anstyle-parse", 46 | "anstyle-query", 47 | "anstyle-wincon", 48 | "colorchoice", 49 | "utf8parse", 50 | ] 51 | 52 | [[package]] 53 | name = "anstyle" 54 | version = "1.0.6" 55 | source = "registry+https://github.com/rust-lang/crates.io-index" 56 | checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" 57 | 58 | [[package]] 59 | name = "anstyle-parse" 60 | version = "0.2.3" 61 | source = "registry+https://github.com/rust-lang/crates.io-index" 62 | checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" 63 | dependencies = [ 64 | "utf8parse", 65 | ] 66 | 67 | [[package]] 68 | name = "anstyle-query" 69 | version = "1.0.2" 70 | source = "registry+https://github.com/rust-lang/crates.io-index" 71 | checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" 72 | dependencies = [ 73 | "windows-sys 0.52.0", 74 | ] 75 | 76 | [[package]] 77 | name = "anstyle-wincon" 78 | version = "3.0.2" 79 | source = "registry+https://github.com/rust-lang/crates.io-index" 80 | checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" 81 | dependencies = [ 82 | "anstyle", 83 | "windows-sys 0.52.0", 84 | ] 85 | 86 | [[package]] 87 | name = "autocfg" 88 | version = "1.1.0" 89 | source = "registry+https://github.com/rust-lang/crates.io-index" 90 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 91 | 92 | [[package]] 93 | name = "backtrace" 94 | version = "0.3.69" 95 | source = "registry+https://github.com/rust-lang/crates.io-index" 96 | checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" 97 | dependencies = [ 98 | "addr2line", 99 | "cc", 100 | "cfg-if", 101 | "libc", 102 | "miniz_oxide", 103 | "object", 104 | "rustc-demangle", 105 | ] 106 | 107 | [[package]] 108 | name = "bitflags" 109 | version = "1.3.2" 110 | source = "registry+https://github.com/rust-lang/crates.io-index" 111 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 112 | 113 | [[package]] 114 | name = "bitflags" 115 | version = "2.4.2" 116 | source = "registry+https://github.com/rust-lang/crates.io-index" 117 | checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" 118 | 119 | [[package]] 120 | name = "block-buffer" 121 | version = "0.10.4" 122 | source = "registry+https://github.com/rust-lang/crates.io-index" 123 | checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" 124 | dependencies = [ 125 | "generic-array", 126 | ] 127 | 128 | [[package]] 129 | name = "bstr" 130 | version = "1.6.2" 131 | source = "registry+https://github.com/rust-lang/crates.io-index" 132 | checksum = "4c2f7349907b712260e64b0afe2f84692af14a454be26187d9df565c7f69266a" 133 | dependencies = [ 134 | "memchr", 135 | "serde", 136 | ] 137 | 138 | [[package]] 139 | name = "bumpalo" 140 | version = "3.13.0" 141 | source = "registry+https://github.com/rust-lang/crates.io-index" 142 | checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" 143 | 144 | [[package]] 145 | name = "bytes" 146 | version = "1.5.0" 147 | source = "registry+https://github.com/rust-lang/crates.io-index" 148 | checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" 149 | 150 | [[package]] 151 | name = "cc" 152 | version = "1.0.86" 153 | source = "registry+https://github.com/rust-lang/crates.io-index" 154 | checksum = "7f9fa1897e4325be0d68d48df6aa1a71ac2ed4d27723887e7754192705350730" 155 | 156 | [[package]] 157 | name = "cesu8" 158 | version = "1.1.0" 159 | source = "registry+https://github.com/rust-lang/crates.io-index" 160 | checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" 161 | 162 | [[package]] 163 | name = "cfg-if" 164 | version = "1.0.0" 165 | source = "registry+https://github.com/rust-lang/crates.io-index" 166 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 167 | 168 | [[package]] 169 | name = "clap" 170 | version = "4.5.1" 171 | source = "registry+https://github.com/rust-lang/crates.io-index" 172 | checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" 173 | dependencies = [ 174 | "clap_builder", 175 | "clap_derive", 176 | ] 177 | 178 | [[package]] 179 | name = "clap_builder" 180 | version = "4.5.1" 181 | source = "registry+https://github.com/rust-lang/crates.io-index" 182 | checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" 183 | dependencies = [ 184 | "anstream", 185 | "anstyle", 186 | "clap_lex", 187 | "strsim", 188 | ] 189 | 190 | [[package]] 191 | name = "clap_derive" 192 | version = "4.5.0" 193 | source = "registry+https://github.com/rust-lang/crates.io-index" 194 | checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" 195 | dependencies = [ 196 | "heck", 197 | "proc-macro2", 198 | "quote", 199 | "syn", 200 | ] 201 | 202 | [[package]] 203 | name = "clap_lex" 204 | version = "0.7.0" 205 | source = "registry+https://github.com/rust-lang/crates.io-index" 206 | checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" 207 | 208 | [[package]] 209 | name = "clearscreen" 210 | version = "2.0.1" 211 | source = "registry+https://github.com/rust-lang/crates.io-index" 212 | checksum = "72f3f22f1a586604e62efd23f78218f3ccdecf7a33c4500db2d37d85a24fe994" 213 | dependencies = [ 214 | "nix", 215 | "terminfo", 216 | "thiserror", 217 | "which", 218 | "winapi", 219 | ] 220 | 221 | [[package]] 222 | name = "colorchoice" 223 | version = "1.0.0" 224 | source = "registry+https://github.com/rust-lang/crates.io-index" 225 | checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" 226 | 227 | [[package]] 228 | name = "combine" 229 | version = "4.6.6" 230 | source = "registry+https://github.com/rust-lang/crates.io-index" 231 | checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" 232 | dependencies = [ 233 | "bytes", 234 | "memchr", 235 | ] 236 | 237 | [[package]] 238 | name = "core-foundation" 239 | version = "0.9.3" 240 | source = "registry+https://github.com/rust-lang/crates.io-index" 241 | checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" 242 | dependencies = [ 243 | "core-foundation-sys", 244 | "libc", 245 | ] 246 | 247 | [[package]] 248 | name = "core-foundation-sys" 249 | version = "0.8.4" 250 | source = "registry+https://github.com/rust-lang/crates.io-index" 251 | checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" 252 | 253 | [[package]] 254 | name = "cpufeatures" 255 | version = "0.2.12" 256 | source = "registry+https://github.com/rust-lang/crates.io-index" 257 | checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" 258 | dependencies = [ 259 | "libc", 260 | ] 261 | 262 | [[package]] 263 | name = "crossbeam-channel" 264 | version = "0.5.11" 265 | source = "registry+https://github.com/rust-lang/crates.io-index" 266 | checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" 267 | dependencies = [ 268 | "crossbeam-utils", 269 | ] 270 | 271 | [[package]] 272 | name = "crossbeam-utils" 273 | version = "0.8.19" 274 | source = "registry+https://github.com/rust-lang/crates.io-index" 275 | checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" 276 | 277 | [[package]] 278 | name = "crypto-common" 279 | version = "0.1.6" 280 | source = "registry+https://github.com/rust-lang/crates.io-index" 281 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 282 | dependencies = [ 283 | "generic-array", 284 | "typenum", 285 | ] 286 | 287 | [[package]] 288 | name = "digest" 289 | version = "0.10.7" 290 | source = "registry+https://github.com/rust-lang/crates.io-index" 291 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" 292 | dependencies = [ 293 | "block-buffer", 294 | "crypto-common", 295 | ] 296 | 297 | [[package]] 298 | name = "dirs" 299 | version = "4.0.0" 300 | source = "registry+https://github.com/rust-lang/crates.io-index" 301 | checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" 302 | dependencies = [ 303 | "dirs-sys", 304 | ] 305 | 306 | [[package]] 307 | name = "dirs-sys" 308 | version = "0.3.7" 309 | source = "registry+https://github.com/rust-lang/crates.io-index" 310 | checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" 311 | dependencies = [ 312 | "libc", 313 | "redox_users", 314 | "winapi", 315 | ] 316 | 317 | [[package]] 318 | name = "either" 319 | version = "1.10.0" 320 | source = "registry+https://github.com/rust-lang/crates.io-index" 321 | checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" 322 | 323 | [[package]] 324 | name = "errno" 325 | version = "0.3.8" 326 | source = "registry+https://github.com/rust-lang/crates.io-index" 327 | checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" 328 | dependencies = [ 329 | "libc", 330 | "windows-sys 0.52.0", 331 | ] 332 | 333 | [[package]] 334 | name = "filetime" 335 | version = "0.2.23" 336 | source = "registry+https://github.com/rust-lang/crates.io-index" 337 | checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" 338 | dependencies = [ 339 | "cfg-if", 340 | "libc", 341 | "redox_syscall", 342 | "windows-sys 0.52.0", 343 | ] 344 | 345 | [[package]] 346 | name = "fnv" 347 | version = "1.0.7" 348 | source = "registry+https://github.com/rust-lang/crates.io-index" 349 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 350 | 351 | [[package]] 352 | name = "form_urlencoded" 353 | version = "1.2.0" 354 | source = "registry+https://github.com/rust-lang/crates.io-index" 355 | checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" 356 | dependencies = [ 357 | "percent-encoding", 358 | ] 359 | 360 | [[package]] 361 | name = "fsevent-sys" 362 | version = "4.1.0" 363 | source = "registry+https://github.com/rust-lang/crates.io-index" 364 | checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" 365 | dependencies = [ 366 | "libc", 367 | ] 368 | 369 | [[package]] 370 | name = "generic-array" 371 | version = "0.14.7" 372 | source = "registry+https://github.com/rust-lang/crates.io-index" 373 | checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" 374 | dependencies = [ 375 | "typenum", 376 | "version_check", 377 | ] 378 | 379 | [[package]] 380 | name = "getrandom" 381 | version = "0.2.12" 382 | source = "registry+https://github.com/rust-lang/crates.io-index" 383 | checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" 384 | dependencies = [ 385 | "cfg-if", 386 | "libc", 387 | "wasi", 388 | ] 389 | 390 | [[package]] 391 | name = "gimli" 392 | version = "0.28.1" 393 | source = "registry+https://github.com/rust-lang/crates.io-index" 394 | checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" 395 | 396 | [[package]] 397 | name = "globset" 398 | version = "0.4.13" 399 | source = "registry+https://github.com/rust-lang/crates.io-index" 400 | checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d" 401 | dependencies = [ 402 | "aho-corasick", 403 | "bstr", 404 | "fnv", 405 | "log", 406 | "regex", 407 | ] 408 | 409 | [[package]] 410 | name = "heck" 411 | version = "0.4.1" 412 | source = "registry+https://github.com/rust-lang/crates.io-index" 413 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" 414 | 415 | [[package]] 416 | name = "hermit-abi" 417 | version = "0.3.6" 418 | source = "registry+https://github.com/rust-lang/crates.io-index" 419 | checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" 420 | 421 | [[package]] 422 | name = "home" 423 | version = "0.5.5" 424 | source = "registry+https://github.com/rust-lang/crates.io-index" 425 | checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" 426 | dependencies = [ 427 | "windows-sys 0.48.0", 428 | ] 429 | 430 | [[package]] 431 | name = "idna" 432 | version = "0.4.0" 433 | source = "registry+https://github.com/rust-lang/crates.io-index" 434 | checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" 435 | dependencies = [ 436 | "unicode-bidi", 437 | "unicode-normalization", 438 | ] 439 | 440 | [[package]] 441 | name = "inotify" 442 | version = "0.9.6" 443 | source = "registry+https://github.com/rust-lang/crates.io-index" 444 | checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" 445 | dependencies = [ 446 | "bitflags 1.3.2", 447 | "inotify-sys", 448 | "libc", 449 | ] 450 | 451 | [[package]] 452 | name = "inotify-sys" 453 | version = "0.1.5" 454 | source = "registry+https://github.com/rust-lang/crates.io-index" 455 | checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" 456 | dependencies = [ 457 | "libc", 458 | ] 459 | 460 | [[package]] 461 | name = "itoa" 462 | version = "1.0.10" 463 | source = "registry+https://github.com/rust-lang/crates.io-index" 464 | checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" 465 | 466 | [[package]] 467 | name = "jni" 468 | version = "0.21.1" 469 | source = "registry+https://github.com/rust-lang/crates.io-index" 470 | checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" 471 | dependencies = [ 472 | "cesu8", 473 | "cfg-if", 474 | "combine", 475 | "jni-sys", 476 | "log", 477 | "thiserror", 478 | "walkdir", 479 | "windows-sys 0.45.0", 480 | ] 481 | 482 | [[package]] 483 | name = "jni-sys" 484 | version = "0.3.0" 485 | source = "registry+https://github.com/rust-lang/crates.io-index" 486 | checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" 487 | 488 | [[package]] 489 | name = "js-sys" 490 | version = "0.3.64" 491 | source = "registry+https://github.com/rust-lang/crates.io-index" 492 | checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" 493 | dependencies = [ 494 | "wasm-bindgen", 495 | ] 496 | 497 | [[package]] 498 | name = "kqueue" 499 | version = "1.0.8" 500 | source = "registry+https://github.com/rust-lang/crates.io-index" 501 | checksum = "7447f1ca1b7b563588a205fe93dea8df60fd981423a768bc1c0ded35ed147d0c" 502 | dependencies = [ 503 | "kqueue-sys", 504 | "libc", 505 | ] 506 | 507 | [[package]] 508 | name = "kqueue-sys" 509 | version = "1.0.4" 510 | source = "registry+https://github.com/rust-lang/crates.io-index" 511 | checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b" 512 | dependencies = [ 513 | "bitflags 1.3.2", 514 | "libc", 515 | ] 516 | 517 | [[package]] 518 | name = "lazy_static" 519 | version = "1.4.0" 520 | source = "registry+https://github.com/rust-lang/crates.io-index" 521 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 522 | 523 | [[package]] 524 | name = "libc" 525 | version = "0.2.153" 526 | source = "registry+https://github.com/rust-lang/crates.io-index" 527 | checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" 528 | 529 | [[package]] 530 | name = "libredox" 531 | version = "0.0.1" 532 | source = "registry+https://github.com/rust-lang/crates.io-index" 533 | checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" 534 | dependencies = [ 535 | "bitflags 2.4.2", 536 | "libc", 537 | "redox_syscall", 538 | ] 539 | 540 | [[package]] 541 | name = "linux-raw-sys" 542 | version = "0.4.13" 543 | source = "registry+https://github.com/rust-lang/crates.io-index" 544 | checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" 545 | 546 | [[package]] 547 | name = "lock_api" 548 | version = "0.4.11" 549 | source = "registry+https://github.com/rust-lang/crates.io-index" 550 | checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" 551 | dependencies = [ 552 | "autocfg", 553 | "scopeguard", 554 | ] 555 | 556 | [[package]] 557 | name = "log" 558 | version = "0.4.20" 559 | source = "registry+https://github.com/rust-lang/crates.io-index" 560 | checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" 561 | 562 | [[package]] 563 | name = "malloc_buf" 564 | version = "0.0.6" 565 | source = "registry+https://github.com/rust-lang/crates.io-index" 566 | checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" 567 | dependencies = [ 568 | "libc", 569 | ] 570 | 571 | [[package]] 572 | name = "memchr" 573 | version = "2.6.3" 574 | source = "registry+https://github.com/rust-lang/crates.io-index" 575 | checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" 576 | 577 | [[package]] 578 | name = "minimal-lexical" 579 | version = "0.2.1" 580 | source = "registry+https://github.com/rust-lang/crates.io-index" 581 | checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" 582 | 583 | [[package]] 584 | name = "miniz_oxide" 585 | version = "0.7.2" 586 | source = "registry+https://github.com/rust-lang/crates.io-index" 587 | checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" 588 | dependencies = [ 589 | "adler", 590 | ] 591 | 592 | [[package]] 593 | name = "mio" 594 | version = "0.8.11" 595 | source = "registry+https://github.com/rust-lang/crates.io-index" 596 | checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" 597 | dependencies = [ 598 | "libc", 599 | "log", 600 | "wasi", 601 | "windows-sys 0.48.0", 602 | ] 603 | 604 | [[package]] 605 | name = "ndk-context" 606 | version = "0.1.1" 607 | source = "registry+https://github.com/rust-lang/crates.io-index" 608 | checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" 609 | 610 | [[package]] 611 | name = "nix" 612 | version = "0.26.4" 613 | source = "registry+https://github.com/rust-lang/crates.io-index" 614 | checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" 615 | dependencies = [ 616 | "bitflags 1.3.2", 617 | "cfg-if", 618 | "libc", 619 | ] 620 | 621 | [[package]] 622 | name = "nom" 623 | version = "7.1.3" 624 | source = "registry+https://github.com/rust-lang/crates.io-index" 625 | checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" 626 | dependencies = [ 627 | "memchr", 628 | "minimal-lexical", 629 | ] 630 | 631 | [[package]] 632 | name = "notify" 633 | version = "6.1.1" 634 | source = "registry+https://github.com/rust-lang/crates.io-index" 635 | checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" 636 | dependencies = [ 637 | "bitflags 2.4.2", 638 | "crossbeam-channel", 639 | "filetime", 640 | "fsevent-sys", 641 | "inotify", 642 | "kqueue", 643 | "libc", 644 | "log", 645 | "mio", 646 | "walkdir", 647 | "windows-sys 0.48.0", 648 | ] 649 | 650 | [[package]] 651 | name = "num_cpus" 652 | version = "1.16.0" 653 | source = "registry+https://github.com/rust-lang/crates.io-index" 654 | checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" 655 | dependencies = [ 656 | "hermit-abi", 657 | "libc", 658 | ] 659 | 660 | [[package]] 661 | name = "objc" 662 | version = "0.2.7" 663 | source = "registry+https://github.com/rust-lang/crates.io-index" 664 | checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" 665 | dependencies = [ 666 | "malloc_buf", 667 | ] 668 | 669 | [[package]] 670 | name = "object" 671 | version = "0.32.2" 672 | source = "registry+https://github.com/rust-lang/crates.io-index" 673 | checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" 674 | dependencies = [ 675 | "memchr", 676 | ] 677 | 678 | [[package]] 679 | name = "once_cell" 680 | version = "1.18.0" 681 | source = "registry+https://github.com/rust-lang/crates.io-index" 682 | checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" 683 | 684 | [[package]] 685 | name = "parking_lot" 686 | version = "0.12.1" 687 | source = "registry+https://github.com/rust-lang/crates.io-index" 688 | checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" 689 | dependencies = [ 690 | "lock_api", 691 | "parking_lot_core", 692 | ] 693 | 694 | [[package]] 695 | name = "parking_lot_core" 696 | version = "0.9.9" 697 | source = "registry+https://github.com/rust-lang/crates.io-index" 698 | checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" 699 | dependencies = [ 700 | "cfg-if", 701 | "libc", 702 | "redox_syscall", 703 | "smallvec", 704 | "windows-targets 0.48.5", 705 | ] 706 | 707 | [[package]] 708 | name = "percent-encoding" 709 | version = "2.3.0" 710 | source = "registry+https://github.com/rust-lang/crates.io-index" 711 | checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" 712 | 713 | [[package]] 714 | name = "phf" 715 | version = "0.11.2" 716 | source = "registry+https://github.com/rust-lang/crates.io-index" 717 | checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" 718 | dependencies = [ 719 | "phf_shared", 720 | ] 721 | 722 | [[package]] 723 | name = "phf_codegen" 724 | version = "0.11.2" 725 | source = "registry+https://github.com/rust-lang/crates.io-index" 726 | checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" 727 | dependencies = [ 728 | "phf_generator", 729 | "phf_shared", 730 | ] 731 | 732 | [[package]] 733 | name = "phf_generator" 734 | version = "0.11.2" 735 | source = "registry+https://github.com/rust-lang/crates.io-index" 736 | checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" 737 | dependencies = [ 738 | "phf_shared", 739 | "rand", 740 | ] 741 | 742 | [[package]] 743 | name = "phf_shared" 744 | version = "0.11.2" 745 | source = "registry+https://github.com/rust-lang/crates.io-index" 746 | checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" 747 | dependencies = [ 748 | "siphasher", 749 | ] 750 | 751 | [[package]] 752 | name = "piechart" 753 | version = "1.0.0" 754 | source = "registry+https://github.com/rust-lang/crates.io-index" 755 | checksum = "79730372879e285c066c9289e164f4033ff665a866396dfa478f58f5adcd4089" 756 | dependencies = [ 757 | "ansi_term", 758 | ] 759 | 760 | [[package]] 761 | name = "pin-project-lite" 762 | version = "0.2.13" 763 | source = "registry+https://github.com/rust-lang/crates.io-index" 764 | checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" 765 | 766 | [[package]] 767 | name = "proc-macro2" 768 | version = "1.0.78" 769 | source = "registry+https://github.com/rust-lang/crates.io-index" 770 | checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" 771 | dependencies = [ 772 | "unicode-ident", 773 | ] 774 | 775 | [[package]] 776 | name = "project_analyzer" 777 | version = "2.1.0" 778 | dependencies = [ 779 | "clap", 780 | "clearscreen", 781 | "lazy_static", 782 | "notify", 783 | "piechart", 784 | "rust-embed", 785 | "serde", 786 | "serde_json", 787 | "tokio", 788 | "webbrowser", 789 | ] 790 | 791 | [[package]] 792 | name = "quote" 793 | version = "1.0.35" 794 | source = "registry+https://github.com/rust-lang/crates.io-index" 795 | checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" 796 | dependencies = [ 797 | "proc-macro2", 798 | ] 799 | 800 | [[package]] 801 | name = "rand" 802 | version = "0.8.5" 803 | source = "registry+https://github.com/rust-lang/crates.io-index" 804 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 805 | dependencies = [ 806 | "rand_core", 807 | ] 808 | 809 | [[package]] 810 | name = "rand_core" 811 | version = "0.6.4" 812 | source = "registry+https://github.com/rust-lang/crates.io-index" 813 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 814 | 815 | [[package]] 816 | name = "raw-window-handle" 817 | version = "0.5.2" 818 | source = "registry+https://github.com/rust-lang/crates.io-index" 819 | checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" 820 | 821 | [[package]] 822 | name = "redox_syscall" 823 | version = "0.4.1" 824 | source = "registry+https://github.com/rust-lang/crates.io-index" 825 | checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" 826 | dependencies = [ 827 | "bitflags 1.3.2", 828 | ] 829 | 830 | [[package]] 831 | name = "redox_users" 832 | version = "0.4.4" 833 | source = "registry+https://github.com/rust-lang/crates.io-index" 834 | checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" 835 | dependencies = [ 836 | "getrandom", 837 | "libredox", 838 | "thiserror", 839 | ] 840 | 841 | [[package]] 842 | name = "regex" 843 | version = "1.10.2" 844 | source = "registry+https://github.com/rust-lang/crates.io-index" 845 | checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" 846 | dependencies = [ 847 | "aho-corasick", 848 | "memchr", 849 | "regex-automata", 850 | "regex-syntax", 851 | ] 852 | 853 | [[package]] 854 | name = "regex-automata" 855 | version = "0.4.3" 856 | source = "registry+https://github.com/rust-lang/crates.io-index" 857 | checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" 858 | dependencies = [ 859 | "aho-corasick", 860 | "memchr", 861 | "regex-syntax", 862 | ] 863 | 864 | [[package]] 865 | name = "regex-syntax" 866 | version = "0.8.2" 867 | source = "registry+https://github.com/rust-lang/crates.io-index" 868 | checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" 869 | 870 | [[package]] 871 | name = "rust-embed" 872 | version = "8.3.0" 873 | source = "registry+https://github.com/rust-lang/crates.io-index" 874 | checksum = "fb78f46d0066053d16d4ca7b898e9343bc3530f71c61d5ad84cd404ada068745" 875 | dependencies = [ 876 | "rust-embed-impl", 877 | "rust-embed-utils", 878 | "walkdir", 879 | ] 880 | 881 | [[package]] 882 | name = "rust-embed-impl" 883 | version = "8.3.0" 884 | source = "registry+https://github.com/rust-lang/crates.io-index" 885 | checksum = "b91ac2a3c6c0520a3fb3dd89321177c3c692937c4eb21893378219da10c44fc8" 886 | dependencies = [ 887 | "proc-macro2", 888 | "quote", 889 | "rust-embed-utils", 890 | "syn", 891 | "walkdir", 892 | ] 893 | 894 | [[package]] 895 | name = "rust-embed-utils" 896 | version = "8.3.0" 897 | source = "registry+https://github.com/rust-lang/crates.io-index" 898 | checksum = "86f69089032567ffff4eada41c573fc43ff466c7db7c5688b2e7969584345581" 899 | dependencies = [ 900 | "globset", 901 | "sha2", 902 | "walkdir", 903 | ] 904 | 905 | [[package]] 906 | name = "rustc-demangle" 907 | version = "0.1.23" 908 | source = "registry+https://github.com/rust-lang/crates.io-index" 909 | checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" 910 | 911 | [[package]] 912 | name = "rustix" 913 | version = "0.38.31" 914 | source = "registry+https://github.com/rust-lang/crates.io-index" 915 | checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" 916 | dependencies = [ 917 | "bitflags 2.4.2", 918 | "errno", 919 | "libc", 920 | "linux-raw-sys", 921 | "windows-sys 0.52.0", 922 | ] 923 | 924 | [[package]] 925 | name = "ryu" 926 | version = "1.0.17" 927 | source = "registry+https://github.com/rust-lang/crates.io-index" 928 | checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" 929 | 930 | [[package]] 931 | name = "same-file" 932 | version = "1.0.6" 933 | source = "registry+https://github.com/rust-lang/crates.io-index" 934 | checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" 935 | dependencies = [ 936 | "winapi-util", 937 | ] 938 | 939 | [[package]] 940 | name = "scopeguard" 941 | version = "1.2.0" 942 | source = "registry+https://github.com/rust-lang/crates.io-index" 943 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 944 | 945 | [[package]] 946 | name = "serde" 947 | version = "1.0.197" 948 | source = "registry+https://github.com/rust-lang/crates.io-index" 949 | checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" 950 | dependencies = [ 951 | "serde_derive", 952 | ] 953 | 954 | [[package]] 955 | name = "serde_derive" 956 | version = "1.0.197" 957 | source = "registry+https://github.com/rust-lang/crates.io-index" 958 | checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" 959 | dependencies = [ 960 | "proc-macro2", 961 | "quote", 962 | "syn", 963 | ] 964 | 965 | [[package]] 966 | name = "serde_json" 967 | version = "1.0.114" 968 | source = "registry+https://github.com/rust-lang/crates.io-index" 969 | checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" 970 | dependencies = [ 971 | "itoa", 972 | "ryu", 973 | "serde", 974 | ] 975 | 976 | [[package]] 977 | name = "sha2" 978 | version = "0.10.8" 979 | source = "registry+https://github.com/rust-lang/crates.io-index" 980 | checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" 981 | dependencies = [ 982 | "cfg-if", 983 | "cpufeatures", 984 | "digest", 985 | ] 986 | 987 | [[package]] 988 | name = "signal-hook-registry" 989 | version = "1.4.1" 990 | source = "registry+https://github.com/rust-lang/crates.io-index" 991 | checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" 992 | dependencies = [ 993 | "libc", 994 | ] 995 | 996 | [[package]] 997 | name = "siphasher" 998 | version = "0.3.11" 999 | source = "registry+https://github.com/rust-lang/crates.io-index" 1000 | checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" 1001 | 1002 | [[package]] 1003 | name = "smallvec" 1004 | version = "1.13.1" 1005 | source = "registry+https://github.com/rust-lang/crates.io-index" 1006 | checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" 1007 | 1008 | [[package]] 1009 | name = "socket2" 1010 | version = "0.5.6" 1011 | source = "registry+https://github.com/rust-lang/crates.io-index" 1012 | checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" 1013 | dependencies = [ 1014 | "libc", 1015 | "windows-sys 0.52.0", 1016 | ] 1017 | 1018 | [[package]] 1019 | name = "strsim" 1020 | version = "0.11.0" 1021 | source = "registry+https://github.com/rust-lang/crates.io-index" 1022 | checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" 1023 | 1024 | [[package]] 1025 | name = "syn" 1026 | version = "2.0.51" 1027 | source = "registry+https://github.com/rust-lang/crates.io-index" 1028 | checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c" 1029 | dependencies = [ 1030 | "proc-macro2", 1031 | "quote", 1032 | "unicode-ident", 1033 | ] 1034 | 1035 | [[package]] 1036 | name = "terminfo" 1037 | version = "0.8.0" 1038 | source = "registry+https://github.com/rust-lang/crates.io-index" 1039 | checksum = "666cd3a6681775d22b200409aad3b089c5b99fb11ecdd8a204d9d62f8148498f" 1040 | dependencies = [ 1041 | "dirs", 1042 | "fnv", 1043 | "nom", 1044 | "phf", 1045 | "phf_codegen", 1046 | ] 1047 | 1048 | [[package]] 1049 | name = "thiserror" 1050 | version = "1.0.48" 1051 | source = "registry+https://github.com/rust-lang/crates.io-index" 1052 | checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" 1053 | dependencies = [ 1054 | "thiserror-impl", 1055 | ] 1056 | 1057 | [[package]] 1058 | name = "thiserror-impl" 1059 | version = "1.0.48" 1060 | source = "registry+https://github.com/rust-lang/crates.io-index" 1061 | checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" 1062 | dependencies = [ 1063 | "proc-macro2", 1064 | "quote", 1065 | "syn", 1066 | ] 1067 | 1068 | [[package]] 1069 | name = "tinyvec" 1070 | version = "1.6.0" 1071 | source = "registry+https://github.com/rust-lang/crates.io-index" 1072 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" 1073 | dependencies = [ 1074 | "tinyvec_macros", 1075 | ] 1076 | 1077 | [[package]] 1078 | name = "tinyvec_macros" 1079 | version = "0.1.1" 1080 | source = "registry+https://github.com/rust-lang/crates.io-index" 1081 | checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" 1082 | 1083 | [[package]] 1084 | name = "tokio" 1085 | version = "1.36.0" 1086 | source = "registry+https://github.com/rust-lang/crates.io-index" 1087 | checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" 1088 | dependencies = [ 1089 | "backtrace", 1090 | "bytes", 1091 | "libc", 1092 | "mio", 1093 | "num_cpus", 1094 | "parking_lot", 1095 | "pin-project-lite", 1096 | "signal-hook-registry", 1097 | "socket2", 1098 | "tokio-macros", 1099 | "windows-sys 0.48.0", 1100 | ] 1101 | 1102 | [[package]] 1103 | name = "tokio-macros" 1104 | version = "2.2.0" 1105 | source = "registry+https://github.com/rust-lang/crates.io-index" 1106 | checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" 1107 | dependencies = [ 1108 | "proc-macro2", 1109 | "quote", 1110 | "syn", 1111 | ] 1112 | 1113 | [[package]] 1114 | name = "typenum" 1115 | version = "1.17.0" 1116 | source = "registry+https://github.com/rust-lang/crates.io-index" 1117 | checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" 1118 | 1119 | [[package]] 1120 | name = "unicode-bidi" 1121 | version = "0.3.13" 1122 | source = "registry+https://github.com/rust-lang/crates.io-index" 1123 | checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" 1124 | 1125 | [[package]] 1126 | name = "unicode-ident" 1127 | version = "1.0.12" 1128 | source = "registry+https://github.com/rust-lang/crates.io-index" 1129 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 1130 | 1131 | [[package]] 1132 | name = "unicode-normalization" 1133 | version = "0.1.22" 1134 | source = "registry+https://github.com/rust-lang/crates.io-index" 1135 | checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" 1136 | dependencies = [ 1137 | "tinyvec", 1138 | ] 1139 | 1140 | [[package]] 1141 | name = "url" 1142 | version = "2.4.1" 1143 | source = "registry+https://github.com/rust-lang/crates.io-index" 1144 | checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" 1145 | dependencies = [ 1146 | "form_urlencoded", 1147 | "idna", 1148 | "percent-encoding", 1149 | ] 1150 | 1151 | [[package]] 1152 | name = "utf8parse" 1153 | version = "0.2.1" 1154 | source = "registry+https://github.com/rust-lang/crates.io-index" 1155 | checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" 1156 | 1157 | [[package]] 1158 | name = "version_check" 1159 | version = "0.9.4" 1160 | source = "registry+https://github.com/rust-lang/crates.io-index" 1161 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 1162 | 1163 | [[package]] 1164 | name = "walkdir" 1165 | version = "2.4.0" 1166 | source = "registry+https://github.com/rust-lang/crates.io-index" 1167 | checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" 1168 | dependencies = [ 1169 | "same-file", 1170 | "winapi-util", 1171 | ] 1172 | 1173 | [[package]] 1174 | name = "wasi" 1175 | version = "0.11.0+wasi-snapshot-preview1" 1176 | source = "registry+https://github.com/rust-lang/crates.io-index" 1177 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1178 | 1179 | [[package]] 1180 | name = "wasm-bindgen" 1181 | version = "0.2.87" 1182 | source = "registry+https://github.com/rust-lang/crates.io-index" 1183 | checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" 1184 | dependencies = [ 1185 | "cfg-if", 1186 | "wasm-bindgen-macro", 1187 | ] 1188 | 1189 | [[package]] 1190 | name = "wasm-bindgen-backend" 1191 | version = "0.2.87" 1192 | source = "registry+https://github.com/rust-lang/crates.io-index" 1193 | checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" 1194 | dependencies = [ 1195 | "bumpalo", 1196 | "log", 1197 | "once_cell", 1198 | "proc-macro2", 1199 | "quote", 1200 | "syn", 1201 | "wasm-bindgen-shared", 1202 | ] 1203 | 1204 | [[package]] 1205 | name = "wasm-bindgen-macro" 1206 | version = "0.2.87" 1207 | source = "registry+https://github.com/rust-lang/crates.io-index" 1208 | checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" 1209 | dependencies = [ 1210 | "quote", 1211 | "wasm-bindgen-macro-support", 1212 | ] 1213 | 1214 | [[package]] 1215 | name = "wasm-bindgen-macro-support" 1216 | version = "0.2.87" 1217 | source = "registry+https://github.com/rust-lang/crates.io-index" 1218 | checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" 1219 | dependencies = [ 1220 | "proc-macro2", 1221 | "quote", 1222 | "syn", 1223 | "wasm-bindgen-backend", 1224 | "wasm-bindgen-shared", 1225 | ] 1226 | 1227 | [[package]] 1228 | name = "wasm-bindgen-shared" 1229 | version = "0.2.87" 1230 | source = "registry+https://github.com/rust-lang/crates.io-index" 1231 | checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" 1232 | 1233 | [[package]] 1234 | name = "web-sys" 1235 | version = "0.3.64" 1236 | source = "registry+https://github.com/rust-lang/crates.io-index" 1237 | checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" 1238 | dependencies = [ 1239 | "js-sys", 1240 | "wasm-bindgen", 1241 | ] 1242 | 1243 | [[package]] 1244 | name = "webbrowser" 1245 | version = "0.8.11" 1246 | source = "registry+https://github.com/rust-lang/crates.io-index" 1247 | checksum = "b2c79b77f525a2d670cb40619d7d9c673d09e0666f72c591ebd7861f84a87e57" 1248 | dependencies = [ 1249 | "core-foundation", 1250 | "home", 1251 | "jni", 1252 | "log", 1253 | "ndk-context", 1254 | "objc", 1255 | "raw-window-handle", 1256 | "url", 1257 | "web-sys", 1258 | ] 1259 | 1260 | [[package]] 1261 | name = "which" 1262 | version = "4.4.2" 1263 | source = "registry+https://github.com/rust-lang/crates.io-index" 1264 | checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" 1265 | dependencies = [ 1266 | "either", 1267 | "home", 1268 | "once_cell", 1269 | "rustix", 1270 | ] 1271 | 1272 | [[package]] 1273 | name = "winapi" 1274 | version = "0.3.9" 1275 | source = "registry+https://github.com/rust-lang/crates.io-index" 1276 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1277 | dependencies = [ 1278 | "winapi-i686-pc-windows-gnu", 1279 | "winapi-x86_64-pc-windows-gnu", 1280 | ] 1281 | 1282 | [[package]] 1283 | name = "winapi-i686-pc-windows-gnu" 1284 | version = "0.4.0" 1285 | source = "registry+https://github.com/rust-lang/crates.io-index" 1286 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1287 | 1288 | [[package]] 1289 | name = "winapi-util" 1290 | version = "0.1.5" 1291 | source = "registry+https://github.com/rust-lang/crates.io-index" 1292 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 1293 | dependencies = [ 1294 | "winapi", 1295 | ] 1296 | 1297 | [[package]] 1298 | name = "winapi-x86_64-pc-windows-gnu" 1299 | version = "0.4.0" 1300 | source = "registry+https://github.com/rust-lang/crates.io-index" 1301 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1302 | 1303 | [[package]] 1304 | name = "windows-sys" 1305 | version = "0.45.0" 1306 | source = "registry+https://github.com/rust-lang/crates.io-index" 1307 | checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" 1308 | dependencies = [ 1309 | "windows-targets 0.42.2", 1310 | ] 1311 | 1312 | [[package]] 1313 | name = "windows-sys" 1314 | version = "0.48.0" 1315 | source = "registry+https://github.com/rust-lang/crates.io-index" 1316 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 1317 | dependencies = [ 1318 | "windows-targets 0.48.5", 1319 | ] 1320 | 1321 | [[package]] 1322 | name = "windows-sys" 1323 | version = "0.52.0" 1324 | source = "registry+https://github.com/rust-lang/crates.io-index" 1325 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 1326 | dependencies = [ 1327 | "windows-targets 0.52.0", 1328 | ] 1329 | 1330 | [[package]] 1331 | name = "windows-targets" 1332 | version = "0.42.2" 1333 | source = "registry+https://github.com/rust-lang/crates.io-index" 1334 | checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" 1335 | dependencies = [ 1336 | "windows_aarch64_gnullvm 0.42.2", 1337 | "windows_aarch64_msvc 0.42.2", 1338 | "windows_i686_gnu 0.42.2", 1339 | "windows_i686_msvc 0.42.2", 1340 | "windows_x86_64_gnu 0.42.2", 1341 | "windows_x86_64_gnullvm 0.42.2", 1342 | "windows_x86_64_msvc 0.42.2", 1343 | ] 1344 | 1345 | [[package]] 1346 | name = "windows-targets" 1347 | version = "0.48.5" 1348 | source = "registry+https://github.com/rust-lang/crates.io-index" 1349 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 1350 | dependencies = [ 1351 | "windows_aarch64_gnullvm 0.48.5", 1352 | "windows_aarch64_msvc 0.48.5", 1353 | "windows_i686_gnu 0.48.5", 1354 | "windows_i686_msvc 0.48.5", 1355 | "windows_x86_64_gnu 0.48.5", 1356 | "windows_x86_64_gnullvm 0.48.5", 1357 | "windows_x86_64_msvc 0.48.5", 1358 | ] 1359 | 1360 | [[package]] 1361 | name = "windows-targets" 1362 | version = "0.52.0" 1363 | source = "registry+https://github.com/rust-lang/crates.io-index" 1364 | checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" 1365 | dependencies = [ 1366 | "windows_aarch64_gnullvm 0.52.0", 1367 | "windows_aarch64_msvc 0.52.0", 1368 | "windows_i686_gnu 0.52.0", 1369 | "windows_i686_msvc 0.52.0", 1370 | "windows_x86_64_gnu 0.52.0", 1371 | "windows_x86_64_gnullvm 0.52.0", 1372 | "windows_x86_64_msvc 0.52.0", 1373 | ] 1374 | 1375 | [[package]] 1376 | name = "windows_aarch64_gnullvm" 1377 | version = "0.42.2" 1378 | source = "registry+https://github.com/rust-lang/crates.io-index" 1379 | checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" 1380 | 1381 | [[package]] 1382 | name = "windows_aarch64_gnullvm" 1383 | version = "0.48.5" 1384 | source = "registry+https://github.com/rust-lang/crates.io-index" 1385 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 1386 | 1387 | [[package]] 1388 | name = "windows_aarch64_gnullvm" 1389 | version = "0.52.0" 1390 | source = "registry+https://github.com/rust-lang/crates.io-index" 1391 | checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" 1392 | 1393 | [[package]] 1394 | name = "windows_aarch64_msvc" 1395 | version = "0.42.2" 1396 | source = "registry+https://github.com/rust-lang/crates.io-index" 1397 | checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" 1398 | 1399 | [[package]] 1400 | name = "windows_aarch64_msvc" 1401 | version = "0.48.5" 1402 | source = "registry+https://github.com/rust-lang/crates.io-index" 1403 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 1404 | 1405 | [[package]] 1406 | name = "windows_aarch64_msvc" 1407 | version = "0.52.0" 1408 | source = "registry+https://github.com/rust-lang/crates.io-index" 1409 | checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" 1410 | 1411 | [[package]] 1412 | name = "windows_i686_gnu" 1413 | version = "0.42.2" 1414 | source = "registry+https://github.com/rust-lang/crates.io-index" 1415 | checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" 1416 | 1417 | [[package]] 1418 | name = "windows_i686_gnu" 1419 | version = "0.48.5" 1420 | source = "registry+https://github.com/rust-lang/crates.io-index" 1421 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 1422 | 1423 | [[package]] 1424 | name = "windows_i686_gnu" 1425 | version = "0.52.0" 1426 | source = "registry+https://github.com/rust-lang/crates.io-index" 1427 | checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" 1428 | 1429 | [[package]] 1430 | name = "windows_i686_msvc" 1431 | version = "0.42.2" 1432 | source = "registry+https://github.com/rust-lang/crates.io-index" 1433 | checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" 1434 | 1435 | [[package]] 1436 | name = "windows_i686_msvc" 1437 | version = "0.48.5" 1438 | source = "registry+https://github.com/rust-lang/crates.io-index" 1439 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 1440 | 1441 | [[package]] 1442 | name = "windows_i686_msvc" 1443 | version = "0.52.0" 1444 | source = "registry+https://github.com/rust-lang/crates.io-index" 1445 | checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" 1446 | 1447 | [[package]] 1448 | name = "windows_x86_64_gnu" 1449 | version = "0.42.2" 1450 | source = "registry+https://github.com/rust-lang/crates.io-index" 1451 | checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" 1452 | 1453 | [[package]] 1454 | name = "windows_x86_64_gnu" 1455 | version = "0.48.5" 1456 | source = "registry+https://github.com/rust-lang/crates.io-index" 1457 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 1458 | 1459 | [[package]] 1460 | name = "windows_x86_64_gnu" 1461 | version = "0.52.0" 1462 | source = "registry+https://github.com/rust-lang/crates.io-index" 1463 | checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" 1464 | 1465 | [[package]] 1466 | name = "windows_x86_64_gnullvm" 1467 | version = "0.42.2" 1468 | source = "registry+https://github.com/rust-lang/crates.io-index" 1469 | checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" 1470 | 1471 | [[package]] 1472 | name = "windows_x86_64_gnullvm" 1473 | version = "0.48.5" 1474 | source = "registry+https://github.com/rust-lang/crates.io-index" 1475 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 1476 | 1477 | [[package]] 1478 | name = "windows_x86_64_gnullvm" 1479 | version = "0.52.0" 1480 | source = "registry+https://github.com/rust-lang/crates.io-index" 1481 | checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" 1482 | 1483 | [[package]] 1484 | name = "windows_x86_64_msvc" 1485 | version = "0.42.2" 1486 | source = "registry+https://github.com/rust-lang/crates.io-index" 1487 | checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" 1488 | 1489 | [[package]] 1490 | name = "windows_x86_64_msvc" 1491 | version = "0.48.5" 1492 | source = "registry+https://github.com/rust-lang/crates.io-index" 1493 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 1494 | 1495 | [[package]] 1496 | name = "windows_x86_64_msvc" 1497 | version = "0.52.0" 1498 | source = "registry+https://github.com/rust-lang/crates.io-index" 1499 | checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" 1500 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "project_analyzer" 3 | version = "2.1.0" 4 | edition = "2021" 5 | description = "Fast Rust binary that counts line numbers of a codebase." 6 | license = "MIT" 7 | readme = "README.md" 8 | # documentation = "https://docs.rs/rust-persian-tools" # if not set docs.rs will generate one and put it in place 9 | homepage = "https://crates.io/crates/project_analyzer" 10 | repository = "https://github.com/ali77gh/ProjectAnalyzer" 11 | categories = ["command-line-utilities", "development-tools"] 12 | keywords = ["counter", "codebase", "source", "analyzer","project"] 13 | include = ["src/**/*.rs", "Cargo.toml", "LICENSE", "README.md"] 14 | 15 | [dependencies] 16 | clap = { version = "4.5.1", features = ["derive"] } 17 | piechart = "1.0.0" 18 | webbrowser = "0.8.11" 19 | tokio = { version = "1", features = ["full"] } 20 | notify = "6.1.1" 21 | clearscreen = "2.0.1" 22 | serde = { version = "1.0.197", features = ["derive"] } 23 | serde_json = "1.0.114" 24 | lazy_static = "1.4.0" 25 | rust-embed={version = "8.3.0", features = ["include-exclude"]} 26 | 27 | [profile.release] 28 | opt-level = 3 29 | lto = true 30 | codegen-units = 1 31 | overflow-checks=false 32 | panic = "abort" 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 ali ghahremani 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ProjectAnalyzer 2 | 3 | [![forthebadge made-with-rust](http://ForTheBadge.com/images/badges/made-with-rust.svg)](https://www.rust-lang.org/) 4 | 5 | Fast Rust binary that counts line numbers of a codebase. 6 | 7 |
8 | 9 | ## How to use 10 | 11 | ```posh 12 | Fast Rust binary that counts line numbers of a codebase 13 | 14 | Usage: project_analyzer [OPTIONS] [COMMAND] 15 | 16 | Commands: 17 | update Opens github 18 | help Print this message or the help of the given subcommand(s) 19 | 20 | Options: 21 | -r, --root-dir Number of times to greet [default: .] 22 | --ignore Example: project_analyzer --ignore node_modules --ignore dist 23 | -w, --watch Will keep running and update result whenever anything changed 24 | -p, --postfixes Filter by list of file postfixes example: project_analyzer --postfixes py,rs,cpp 25 | -j, --json Output as json 26 | -h, --help Print help 27 | -V, --version Print version 28 | ``` 29 | 30 | ## Installation 31 | 32 | ### If you have Rust toolchain installed: 33 | 34 | ```sh 35 | cargo install project_analyzer # works on linux, mac and windows 36 | ``` 37 | 38 | ### if you don't have Rust toolchain installed: 39 | 40 | Download binary from [here](https://github.com/ali77gh/ProjectAnalyzer/releases) or build it yourself: 41 | 42 | ```sh 43 | cd /tmp 44 | git clone git@github.com:ali77gh/ProjectAnalyzer.git 45 | cd ProjectAnalyzer 46 | cargo build --release 47 | ``` 48 | 49 | and Add binary to your PATH 50 | 51 | ```sh 52 | # linux 53 | cp ./target/release/project_analyzer /usr/bin 54 | 55 | # MacOS 56 | cp ./target/release/project_analyzer /usr/local/bin/ 57 | 58 | # Windows 59 | # add binary to Environment Variables Path 60 | ``` 61 | -------------------------------------------------------------------------------- /file_extensions.txt: -------------------------------------------------------------------------------- 1 | 1in 2 | 1m 3 | 1x 4 | 3in 5 | 3m 6 | 3qt 7 | 3x 8 | 4th 9 | 6pl 10 | 6pm 11 | a51 12 | abap 13 | ada 14 | adb 15 | ado 16 | adoc 17 | adp 18 | ads 19 | agda 20 | ahk 21 | ahkl 22 | aj 23 | al 24 | als 25 | ampl 26 | anim 27 | ant 28 | apacheconf 29 | apib 30 | apl 31 | applescript 32 | arc 33 | arpa 34 | as 35 | asax 36 | asc 37 | asciidoc 38 | ascx 39 | asd 40 | ash 41 | ashx 42 | asm 43 | asmx 44 | asp 45 | aspx 46 | asset 47 | au3 48 | aug 49 | auk 50 | aux 51 | aw 52 | awk 53 | axd 54 | axi 55 | axi.erb 56 | axml 57 | axs 58 | axs.erb 59 | b 60 | bas 61 | bash 62 | bat 63 | bats 64 | bb 65 | bbx 66 | befunge 67 | bf 68 | bib 69 | bison 70 | bmx 71 | bones 72 | boo 73 | boot 74 | brd 75 | bro 76 | brs 77 | bsv 78 | builder 79 | bzl 80 | c 81 | c++ 82 | cake 83 | capnp 84 | cats 85 | cbl 86 | cbx 87 | cc 88 | ccp 89 | ccxml 90 | cdf 91 | ceylon 92 | cfc 93 | cfg 94 | cfm 95 | cfml 96 | cgi 97 | ch 98 | chpl 99 | chs 100 | cirru 101 | cjsx 102 | ck 103 | cl 104 | cl2 105 | click 106 | clixml 107 | clj 108 | cljc 109 | cljs 110 | cljscm 111 | cljs.hl 112 | cljx 113 | clp 114 | cls 115 | clw 116 | cmake 117 | cmake.in 118 | cmd 119 | cob 120 | c++-objdump 121 | c++objdump 122 | c-objdump 123 | cobol 124 | _coffee 125 | coffee 126 | com 127 | command 128 | coq 129 | cp 130 | cpp 131 | cpp-objdump 132 | cppobjdump 133 | cproject 134 | cps 135 | cpy 136 | cql 137 | cr 138 | creole 139 | cs 140 | csh 141 | cshtml 142 | csl 143 | cson 144 | csproj 145 | css 146 | csv 147 | csx 148 | ct 149 | ctp 150 | cu 151 | cuh 152 | cw 153 | cxx 154 | cxx-objdump 155 | cy 156 | d 157 | darcspatch 158 | dart 159 | dats 160 | db2 161 | dcl 162 | ddl 163 | decls 164 | desktop 165 | desktop.in 166 | dfm 167 | di 168 | diff 169 | dita 170 | ditamap 171 | ditaval 172 | djs 173 | dll.config 174 | dlm 175 | dm 176 | do 177 | d-objdump 178 | dockerfile 179 | doh 180 | dot 181 | dotsettings 182 | dpatch 183 | dpr 184 | druby 185 | dtx 186 | duby 187 | dyalog 188 | dyl 189 | dylan 190 | e 191 | E 192 | eam.fs 193 | ebuild 194 | ec 195 | ecl 196 | eclass 197 | eclxml 198 | edn 199 | eex 200 | eh 201 | el 202 | eliom 203 | eliomi 204 | elm 205 | em 206 | emacs 207 | emacs.desktop 208 | emberscript 209 | epj 210 | eps 211 | erb 212 | erb.deface 213 | erl 214 | es 215 | es6 216 | escript 217 | ex 218 | exs 219 | f 220 | f03 221 | f08 222 | f77 223 | f90 224 | f95 225 | factor 226 | fan 227 | fancypack 228 | fcgi 229 | feature 230 | filters 231 | fish 232 | flex 233 | flux 234 | for 235 | forth 236 | fp 237 | fpp 238 | fr 239 | frag 240 | frg 241 | frm 242 | frt 243 | frx 244 | fs 245 | fsh 246 | fshader 247 | fsi 248 | fsproj 249 | fsx 250 | fth 251 | ftl 252 | fun 253 | fx 254 | fxh 255 | fxml 256 | fy 257 | g 258 | g4 259 | gap 260 | gawk 261 | gco 262 | gcode 263 | gd 264 | gemspec 265 | geo 266 | geojson 267 | geom 268 | gf 269 | gi 270 | glade 271 | glf 272 | glsl 273 | glslv 274 | gml 275 | gms 276 | gnu 277 | gnuplot 278 | go 279 | god 280 | golo 281 | gp 282 | grace 283 | gradle 284 | graphql 285 | groovy 286 | grt 287 | grxml 288 | gs 289 | gshader 290 | gsp 291 | gst 292 | gsx 293 | gtpl 294 | gv 295 | gvy 296 | gyp 297 | h 298 | h++ 299 | haml 300 | haml.deface 301 | handlebars 302 | hats 303 | hb 304 | hbs 305 | hcl 306 | hh 307 | hic 308 | hlean 309 | hlsl 310 | hlsli 311 | hpp 312 | hqf 313 | hrl 314 | hs 315 | hsc 316 | htm 317 | html 318 | html.hl 319 | http 320 | hx 321 | hxsl 322 | hxx 323 | hy 324 | i7x 325 | iced 326 | icl 327 | idc 328 | idr 329 | ihlp 330 | ijs 331 | ik 332 | ily 333 | iml 334 | inc 335 | ini 336 | inl 337 | ino 338 | ins 339 | intr 340 | io 341 | ipf 342 | ipp 343 | ipynb 344 | irbrc 345 | irclog 346 | iss 347 | ivy 348 | j 349 | jade 350 | jake 351 | java 352 | jbuilder 353 | jelly 354 | jflex 355 | jinja 356 | jl 357 | jq 358 | _js 359 | js 360 | jsb 361 | jscad 362 | jsfl 363 | jsm 364 | json 365 | json5 366 | jsonld 367 | jsp 368 | jsproj 369 | jss 370 | jsx 371 | kicad_pcb 372 | kid 373 | kit 374 | kml 375 | krl 376 | ksh 377 | kt 378 | ktm 379 | kts 380 | l 381 | lagda 382 | las 383 | lasso 384 | lasso8 385 | lasso9 386 | latte 387 | launch 388 | lbx 389 | ld 390 | ldml 391 | lds 392 | lean 393 | less 394 | lex 395 | lfe 396 | lgt 397 | lhs 398 | lid 399 | lidr 400 | liquid 401 | lisp 402 | litcoffee 403 | ll 404 | lmi 405 | logtalk 406 | lol 407 | lookml 408 | lpr 409 | _ls 410 | ls 411 | lsl 412 | lslp 413 | lsp 414 | ltx 415 | lua 416 | lvproj 417 | ly 418 | m 419 | m4 420 | ma 421 | mak 422 | mako 423 | man 424 | mao 425 | markdown 426 | mask 427 | mat 428 | mata 429 | matah 430 | mathematica 431 | matlab 432 | mawk 433 | maxhelp 434 | maxpat 435 | maxproj 436 | mcr 437 | mdpolicy 438 | me 439 | mediawiki 440 | meta 441 | metal 442 | minid 443 | mir 444 | mirah 445 | mk 446 | mkd 447 | mkdn 448 | mkdown 449 | mkfile 450 | mkii 451 | mkiv 452 | mkvi 453 | ml 454 | ML 455 | ml4 456 | mli 457 | mll 458 | mly 459 | mm 460 | mmk 461 | mms 462 | mo 463 | mod 464 | monkey 465 | moo 466 | moon 467 | ms 468 | mspec 469 | mss 470 | mt 471 | mtml 472 | mu 473 | muf 474 | mumps 475 | mustache 476 | mxml 477 | mxt 478 | myt 479 | n 480 | nasm 481 | nawk 482 | nb 483 | nbp 484 | nc 485 | ncl 486 | nginxconf 487 | ni 488 | nim 489 | nimrod 490 | ninja 491 | nit 492 | nix 493 | njs 494 | nl 495 | nlogo 496 | no 497 | nproj 498 | nqp 499 | nse 500 | nsh 501 | nsi 502 | nu 503 | numpy 504 | numpyw 505 | numsc 506 | nuspec 507 | nut 508 | ny 509 | objdump 510 | odd 511 | omgrofl 512 | ooc 513 | opa 514 | opal 515 | opencl 516 | org 517 | osm 518 | owl 519 | ox 520 | oxh 521 | oxo 522 | oxygene 523 | oz 524 | p 525 | p6 526 | p6l 527 | p6m 528 | pac 529 | pan 530 | parrot 531 | pas 532 | pasm 533 | pat 534 | patch 535 | pb 536 | pbi 537 | pck 538 | pd 539 | pde 540 | pd_lua 541 | perl 542 | ph 543 | php 544 | php3 545 | php4 546 | php5 547 | phps 548 | phpt 549 | phtml 550 | pig 551 | pike 552 | pir 553 | pkb 554 | pkl 555 | pks 556 | pl 557 | pl6 558 | plb 559 | plist 560 | plot 561 | pls 562 | plsql 563 | plt 564 | pluginspec 565 | plx 566 | pm 567 | pm6 568 | pmod 569 | po 570 | pod 571 | podsl 572 | podspec 573 | pogo 574 | pony 575 | pot 576 | pov 577 | pp 578 | prc 579 | prefab 580 | prefs 581 | prg 582 | pri 583 | pro 584 | prolog 585 | properties 586 | props 587 | proto 588 | prw 589 | ps 590 | ps1 591 | ps1xml 592 | psc 593 | psc1 594 | psd1 595 | psgi 596 | psm1 597 | pt 598 | pub 599 | purs 600 | pwn 601 | pxd 602 | pxi 603 | py 604 | pyde 605 | pyp 606 | pyt 607 | pytb 608 | pyw 609 | pyx 610 | qbs 611 | qml 612 | r 613 | r2 614 | r3 615 | rabl 616 | rake 617 | raml 618 | raw 619 | rb 620 | rbbas 621 | rbfrm 622 | rbmnu 623 | rbres 624 | rbtbar 625 | rbuild 626 | rbuistate 627 | rbw 628 | rbx 629 | rbxs 630 | rd 631 | rdf 632 | rdoc 633 | reb 634 | rebol 635 | red 636 | reds 637 | reek 638 | rest 639 | rest.txt 640 | rg 641 | rhtml 642 | rkt 643 | rktd 644 | rktl 645 | rl 646 | rmd 647 | rno 648 | robot 649 | roff 650 | ron 651 | rpy 652 | rq 653 | rs 654 | rsh 655 | rs.in 656 | rss 657 | rst 658 | rst.txt 659 | rsx 660 | ru 661 | ruby 662 | rviz 663 | s 664 | sage 665 | sagews 666 | sas 667 | sass 668 | sats 669 | sbt 670 | sc 671 | scad 672 | scala 673 | scaml 674 | scd 675 | sce 676 | sch 677 | sci 678 | scm 679 | scpt 680 | scrbl 681 | scss 682 | scxml 683 | self 684 | sexp 685 | sh 686 | shader 687 | shen 688 | sh.in 689 | sh-session 690 | sig 691 | sj 692 | sjs 693 | sl 694 | sld 695 | slim 696 | sls 697 | sma 698 | smali 699 | sml 700 | smt 701 | smt2 702 | sp 703 | sparql 704 | spin 705 | sps 706 | sqf 707 | sql 708 | srdf 709 | ss 710 | ssjs 711 | st 712 | stan 713 | sthlp 714 | ston 715 | storyboard 716 | stTheme 717 | sty 718 | styl 719 | sublime-build 720 | sublime-commands 721 | sublime-completions 722 | sublime-keymap 723 | sublime-macro 724 | sublime-menu 725 | sublime_metrics 726 | sublime-mousemap 727 | sublime-project 728 | sublime_session 729 | sublime-settings 730 | sublime-snippet 731 | sublime-syntax 732 | sublime-theme 733 | sublime-workspace 734 | sv 735 | svg 736 | svh 737 | swift 738 | syntax 739 | t 740 | tab 741 | tac 742 | targets 743 | tcc 744 | tcl 745 | tcsh 746 | tea 747 | tex 748 | textile 749 | tf 750 | thor 751 | thrift 752 | thy 753 | tm 754 | tmCommand 755 | tml 756 | tmLanguage 757 | tmPreferences 758 | tmSnippet 759 | tmTheme 760 | tmux 761 | toc 762 | toml 763 | tool 764 | topojson 765 | tpl 766 | tpp 767 | ts 768 | tst 769 | tsx 770 | ttl 771 | tu 772 | twig 773 | txl 774 | uc 775 | udf 776 | ui 777 | unity 778 | uno 779 | upc 780 | ur 781 | urdf 782 | urs 783 | ux 784 | v 785 | vala 786 | vapi 787 | vark 788 | vb 789 | vba 790 | vbhtml 791 | vbproj 792 | vbs 793 | vcl 794 | vcxproj 795 | veo 796 | vert 797 | vh 798 | vhd 799 | vhdl 800 | vhf 801 | vhi 802 | vho 803 | vhost 804 | vhs 805 | vht 806 | vhw 807 | vim 808 | viw 809 | volt 810 | vrx 811 | vsh 812 | vshader 813 | vssettings 814 | vue 815 | vxml 816 | w 817 | watchr 818 | webidl 819 | weechatlog 820 | wiki 821 | wisp 822 | wl 823 | wlt 824 | wlua 825 | wsdl 826 | wsf 827 | wsgi 828 | wxi 829 | wxl 830 | wxs 831 | x 832 | x10 833 | x3d 834 | xacro 835 | xaml 836 | xc 837 | xht 838 | xhtml 839 | xi 840 | xib 841 | xlf 842 | xliff 843 | xm 844 | xmi 845 | xml 846 | xml.dist 847 | xojo_code 848 | xojo_menu 849 | xojo_report 850 | xojo_script 851 | xojo_toolbar 852 | xojo_window 853 | xpl 854 | xproc 855 | xproj 856 | xpy 857 | xq 858 | xql 859 | xqm 860 | xquery 861 | xqy 862 | xrl 863 | xs 864 | xsd 865 | xsjs 866 | xsjslib 867 | xsl 868 | xslt 869 | xsp-config 870 | xsp.metadata 871 | xtend 872 | xul 873 | y 874 | yacc 875 | yaml 876 | yaml-tmlanguage 877 | yang 878 | yap 879 | yml 880 | yrl 881 | yy 882 | zcml 883 | zep 884 | zimpl 885 | zmpl 886 | zone 887 | zpl 888 | zsh 889 | -------------------------------------------------------------------------------- /screen_shot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ali77gh/ProjectAnalyzer/3f75b544012470093d7dc8b5842dd422a04ce9c9/screen_shot.png -------------------------------------------------------------------------------- /src/analyzer/counter.rs: -------------------------------------------------------------------------------- 1 | use std::fs::File; 2 | use std::io::BufReader; 3 | use std::path::PathBuf; 4 | 5 | use tokio::sync::mpsc::Receiver; 6 | use tokio::sync::mpsc::Sender; 7 | 8 | use super::result::AnalyzeResult; 9 | pub struct Counter { 10 | input_channel: Receiver, 11 | output_channel: Sender, 12 | } 13 | 14 | impl Counter { 15 | pub fn new(input_channel: Receiver, output_channel: Sender) -> Self { 16 | Self { 17 | input_channel, 18 | output_channel, 19 | } 20 | } 21 | 22 | pub fn start(mut self) { 23 | tokio::spawn(async move { 24 | let mut result = AnalyzeResult::new(); 25 | 26 | while let Some(x) = self.input_channel.recv().await { 27 | let postfix = x 28 | .file_name() 29 | .unwrap() 30 | .to_str() 31 | .unwrap_or("") 32 | .split('.') 33 | .last() 34 | .unwrap_or("nothing_file"); 35 | 36 | match File::open(x.clone()) { 37 | Ok(file) => { 38 | let content = BufReader::new(file); 39 | result.add(postfix, content); 40 | } 41 | Err(_) => println!("can't read file:{}", x.to_str().unwrap()), 42 | } 43 | } 44 | 45 | if let Err(e) = self.output_channel.send(result).await { 46 | println!("error while sending signal in from counter channel: {}", e); 47 | } 48 | }); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/analyzer/error.rs: -------------------------------------------------------------------------------- 1 | use std::fmt::Display; 2 | 3 | //TODO use thiserror for this 4 | pub enum AnalyzeErr {} 5 | 6 | impl Display for AnalyzeErr { 7 | fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 8 | todo!() 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/analyzer/mod.rs: -------------------------------------------------------------------------------- 1 | mod counter; 2 | mod error; 3 | pub(crate) mod result; 4 | mod walker; 5 | 6 | use std::path::PathBuf; 7 | use tokio::sync::mpsc; 8 | use walker::Walker; 9 | 10 | use crate::arg_parser::MyArgs; 11 | 12 | use self::counter::Counter; 13 | use self::error::AnalyzeErr; 14 | use self::result::AnalyzeResult; 15 | 16 | pub struct Analyzer<'a> { 17 | args: &'a MyArgs, 18 | } 19 | 20 | impl<'a> Analyzer<'a> { 21 | pub fn new(args: &'a MyArgs) -> Self { 22 | Self { args } 23 | } 24 | 25 | pub async fn analyze(&self) -> Result { 26 | let (tx12, rx12) = mpsc::channel::(1000); // channel thread 1,2 27 | let (tx23, mut rx23) = mpsc::channel::(1); // channel thread 2,3 28 | 29 | Walker::new(self.args, tx12).start(); 30 | Counter::new(rx12, tx23).start(); 31 | 32 | Ok(rx23.recv().await.unwrap()) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/analyzer/result.rs: -------------------------------------------------------------------------------- 1 | use std::{ 2 | fs::File, 3 | io::{BufRead, BufReader}, 4 | }; 5 | 6 | use serde::Serialize; 7 | 8 | #[derive(Serialize)] 9 | pub struct AnalyzeResultItem { 10 | postfix: String, 11 | files: usize, 12 | lines: usize, 13 | empty_lines: usize, 14 | } 15 | 16 | impl AnalyzeResultItem { 17 | pub fn new(postfix: String, files: usize, lines: usize, empty_lines: usize) -> Self { 18 | Self { 19 | postfix, 20 | files, 21 | lines, 22 | empty_lines, 23 | } 24 | } 25 | 26 | pub fn lines(&self) -> usize { 27 | self.lines 28 | } 29 | pub fn files(&self) -> usize { 30 | self.files 31 | } 32 | pub fn postfix(&self) -> &str { 33 | &self.postfix 34 | } 35 | pub fn empty_lines(&self) -> usize { 36 | self.empty_lines 37 | } 38 | pub fn total_lines(&self) -> usize { 39 | self.empty_lines + self.lines 40 | } 41 | } 42 | 43 | #[derive(Serialize)] 44 | pub struct AnalyzeResult(Vec); 45 | 46 | impl AnalyzeResult { 47 | pub fn new() -> Self { 48 | Self(vec![]) 49 | } 50 | 51 | pub fn add(&mut self, postfix: &str, content: BufReader) { 52 | let position = self.0.iter().position(|x| x.postfix == postfix); 53 | 54 | let mut lines = 0; 55 | let mut empty_lines = 0; 56 | for line in content.lines() { 57 | if line.unwrap().trim().is_empty() { 58 | empty_lines += 1; 59 | } else { 60 | lines += 1; 61 | } 62 | } 63 | 64 | match position { 65 | Some(position) => { 66 | self.0[position].files += 1; 67 | self.0[position].lines += lines; 68 | self.0[position].empty_lines += empty_lines; 69 | } 70 | None => self.0.push(AnalyzeResultItem::new( 71 | postfix.to_string(), 72 | 1, 73 | lines, 74 | empty_lines, 75 | )), 76 | } 77 | } 78 | 79 | pub fn iter(&self) -> &Vec { 80 | &self.0 81 | } 82 | } 83 | 84 | impl ToString for AnalyzeResult { 85 | fn to_string(&self) -> String { 86 | let mut table = crate::ui::table::Table::new(); 87 | 88 | table.write_center("ProjectAnalyzer"); 89 | 90 | table.empty_line(); 91 | table.write("https://github.com/ali77gh/ProjectAnalyzer"); 92 | table.empty_line(); 93 | 94 | for item in self.iter() { 95 | if item.lines == 0 { 96 | continue; 97 | } 98 | table.draw_line(); 99 | table.write(format!("{} files result:", item.postfix())); 100 | table.write(format!(" files: {}", item.files())); 101 | table.write(format!(" lines: {} ", item.lines())); 102 | table.write(format!(" empty lines: {} ", item.empty_lines())); 103 | table.write(format!(" total lines: {} ", item.total_lines())); 104 | } 105 | table.render_table() 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/analyzer/walker.rs: -------------------------------------------------------------------------------- 1 | use std::{ 2 | collections::HashSet, 3 | fs::{self, DirEntry}, 4 | io, 5 | path::{Path, PathBuf}, 6 | }; 7 | 8 | use tokio::sync::mpsc::Sender; 9 | 10 | use crate::arg_parser::MyArgs; 11 | 12 | pub struct Walker { 13 | root_dir: String, 14 | ignore: HashSet, 15 | output_channel: Sender, 16 | postfixes: Option>, 17 | } 18 | 19 | impl Walker { 20 | pub fn new(args: &MyArgs, output_channel: Sender) -> Self { 21 | let mut ignore_hash_set: HashSet = HashSet::new(); 22 | 23 | // passed ignores 24 | for i in args.ignore() { 25 | let mut i = i.clone(); 26 | if !i.starts_with("./") { 27 | i = format!("./{}", i); 28 | } 29 | ignore_hash_set.insert(PathBuf::from(i)); 30 | } 31 | 32 | // default ignores 33 | for i in crate::default_ignore::get_default_ignore(!args.json()) { 34 | let mut i = i.clone(); 35 | if !i.starts_with("./") { 36 | i = format!("./{}", i); 37 | } 38 | ignore_hash_set.insert(PathBuf::from(i)); 39 | } 40 | 41 | let postfixes = match args.postfixes() { 42 | Some(arg_p) => { 43 | let mut postfixes = HashSet::::new(); 44 | for p in arg_p { 45 | postfixes.insert(p); 46 | } 47 | Some(postfixes) 48 | } 49 | None => None, 50 | }; 51 | 52 | Self { 53 | root_dir: args.root_dir().to_string(), 54 | ignore: ignore_hash_set, 55 | output_channel, 56 | postfixes, 57 | } 58 | } 59 | 60 | pub fn start(mut self) { 61 | tokio::spawn(async move { 62 | let (s, r) = std::sync::mpsc::channel(); 63 | let mut cb = move |x: &DirEntry| { 64 | let binding = x.file_name(); 65 | let postfix = binding 66 | .to_str() 67 | .unwrap_or("") 68 | .split('.') 69 | .last() 70 | .unwrap_or("nothing_file"); 71 | 72 | match &self.postfixes { 73 | Some(p) => { 74 | if p.contains(postfix) { 75 | s.send(x.path()).unwrap(); 76 | } 77 | } 78 | None => { 79 | use crate::default_postfixes::DEFAULT_POSTFIXES; 80 | if DEFAULT_POSTFIXES.contains(postfix) { 81 | s.send(x.path()).unwrap(); 82 | } 83 | } 84 | }; 85 | }; 86 | 87 | std::thread::spawn(move || { 88 | let _ = Self::walk( 89 | Path::new(Path::new(&self.root_dir)), 90 | &mut cb, 91 | &mut self.ignore, 92 | ); 93 | }); 94 | 95 | while let Ok(path) = r.recv() { 96 | self.output_channel.send(path).await.unwrap(); 97 | } 98 | }); 99 | } 100 | 101 | fn walk( 102 | dir: &Path, 103 | cb: &mut dyn FnMut(&DirEntry), 104 | ignore: &mut HashSet, 105 | ) -> io::Result<()> { 106 | if dir.is_dir() { 107 | for entry in fs::read_dir(dir)? { 108 | let entry = entry?; 109 | let path = entry.path(); 110 | 111 | if ignore.contains(&path) { 112 | ignore.remove(&path); 113 | continue; 114 | } 115 | 116 | if path.is_dir() { 117 | Self::walk(&path, cb, ignore)?; 118 | } else { 119 | cb(&entry); 120 | } 121 | } 122 | } 123 | Ok(()) 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /src/arg_parser.rs: -------------------------------------------------------------------------------- 1 | use clap::{Parser, Subcommand}; 2 | 3 | /// Fast Rust binary that counts line numbers of a codebase 4 | #[derive(Parser, Debug, Clone)] 5 | #[command(version, about, long_about = None)] 6 | pub struct MyArgs { 7 | /// Number of times to greet 8 | #[arg(short, long, default_value_t = String::from("."))] 9 | root_dir: String, 10 | 11 | /// Example: project_analyzer --ignore node_modules --ignore dist 12 | #[arg(long)] 13 | ignore: Vec, 14 | 15 | /// Will keep running and update result whenever anything changed. 16 | #[arg(short, long, default_value_t = false)] 17 | watch: bool, 18 | 19 | /// Filter by list of file postfixes example: project_analyzer --postfixes py,rs,cpp 20 | #[arg(short = 'p', long)] 21 | postfixes: Option, 22 | 23 | /// Output as json 24 | #[arg(short, long, default_value_t = false)] 25 | json: bool, 26 | 27 | #[command(subcommand)] 28 | command: Option, 29 | } 30 | 31 | impl MyArgs { 32 | pub fn root_dir(&self) -> &str { 33 | &self.root_dir 34 | } 35 | 36 | pub fn ignore(&self) -> &[String] { 37 | &self.ignore 38 | } 39 | 40 | pub fn postfixes(&self) -> Option> { 41 | self.postfixes.clone().map(|s| { 42 | s.split(',') 43 | .filter(|i| !i.is_empty()) 44 | .map(|i| i.to_string()) 45 | .collect::>() 46 | }) 47 | } 48 | 49 | pub fn command(&self) -> Option<&MyCommands> { 50 | self.command.as_ref() 51 | } 52 | 53 | pub fn json(&self) -> bool { 54 | self.json 55 | } 56 | 57 | pub fn watch(&self) -> bool { 58 | self.watch 59 | } 60 | } 61 | 62 | #[derive(Subcommand, Debug, Clone)] 63 | pub enum MyCommands { 64 | /// Opens github 65 | Update, 66 | } 67 | -------------------------------------------------------------------------------- /src/default_ignore.rs: -------------------------------------------------------------------------------- 1 | use std::{fs, path::Path}; 2 | 3 | pub(crate) fn get_default_ignore(enable_log: bool) -> Vec { 4 | let mut result = vec![]; 5 | if Path::new("./.git").exists() { 6 | result.push("./.git".to_string()); 7 | if enable_log { 8 | println!("ignoring: .git/") 9 | } 10 | } 11 | 12 | if let Ok(content) = fs::read_to_string(Path::new("./.gitignore")) { 13 | if enable_log { 14 | println!(".gitignore detected (ignoring content)"); 15 | } 16 | for p in content.split('\n').filter(|p| !p.trim().is_empty()) { 17 | let mut p = p.to_owned(); 18 | if p.starts_with('/') { 19 | p = p.chars().skip(1).collect(); //pop first char 20 | } 21 | result.push(p); 22 | } 23 | } 24 | 25 | result 26 | } 27 | -------------------------------------------------------------------------------- /src/default_postfixes.rs: -------------------------------------------------------------------------------- 1 | use lazy_static::lazy_static; 2 | use rust_embed::RustEmbed; 3 | use std::{borrow::Borrow, collections::HashSet}; 4 | 5 | #[derive(RustEmbed)] 6 | #[folder = "./"] 7 | #[include = "file_extensions.txt"] 8 | struct Asset; 9 | lazy_static! { 10 | pub static ref DEFAULT_POSTFIXES: HashSet = { 11 | let content = Asset::get("file_extensions.txt").unwrap(); //read file at compile time 12 | let content = content.data; 13 | let content: &[u8] = content.borrow(); 14 | let content = String::from_utf8(content.to_vec()).unwrap(); 15 | 16 | let mut m = HashSet::new(); 17 | for line in content.split('\n') { 18 | m.insert(line.to_string()); 19 | } 20 | m 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | mod analyzer; 2 | mod arg_parser; 3 | mod default_ignore; 4 | mod default_postfixes; 5 | mod ui; 6 | mod update; 7 | 8 | use std::{io, path::Path, sync::mpsc}; 9 | 10 | use analyzer::Analyzer; 11 | use arg_parser::MyArgs; 12 | use clap::Parser; 13 | 14 | use crate::ui::chart::DrawableChart; 15 | 16 | use update::update_handler; 17 | 18 | use notify::{RecursiveMode, Watcher}; 19 | 20 | #[tokio::main] 21 | async fn main() { 22 | let args = MyArgs::parse(); 23 | 24 | if let Some(command) = args.command() { 25 | match command { 26 | arg_parser::MyCommands::Update => update_handler(), 27 | } 28 | } else if args.watch() { 29 | watch(&args).await; 30 | } else { 31 | analyze_and_show(&args).await; 32 | } 33 | } 34 | 35 | async fn analyze_and_show(args: &MyArgs) { 36 | let analyzer = Analyzer::new(args); 37 | match analyzer.analyze().await { 38 | Ok(result) => { 39 | if args.json() { 40 | println!("{}", serde_json::to_string(&result).unwrap()); 41 | } else { 42 | println!("{}", result.to_string()); 43 | result.draw(); 44 | } 45 | } 46 | Err(err) => { 47 | println!("{}", err); 48 | } 49 | }; 50 | } 51 | 52 | async fn watch(args: &MyArgs) { 53 | clearscreen::clear().unwrap(); 54 | analyze_and_show(args).await; 55 | 56 | let (tx, rx) = mpsc::channel::<()>(); // channel thread 1,2 57 | 58 | let mut watcher = notify::recommended_watcher(move |res| match res { 59 | Ok(_) => { 60 | clearscreen::clear().unwrap(); 61 | tx.send(()).unwrap(); 62 | } 63 | Err(e) => println!("watch error: {:?}", e), 64 | }) 65 | .unwrap(); 66 | let ar = args.clone(); 67 | tokio::spawn(async move { 68 | while rx.recv().is_ok() { 69 | analyze_and_show(&ar).await; 70 | } 71 | }); 72 | watcher 73 | .watch(Path::new(args.root_dir()), RecursiveMode::Recursive) 74 | .unwrap(); 75 | 76 | //prevent exist 77 | let mut buffer = String::new(); 78 | io::stdin().read_line(&mut buffer).unwrap(); 79 | } 80 | -------------------------------------------------------------------------------- /src/ui/chart.rs: -------------------------------------------------------------------------------- 1 | use piechart::{Chart, Color, Data, Style}; 2 | 3 | use crate::analyzer::result::AnalyzeResult; 4 | 5 | pub trait DrawableChart { 6 | fn draw(&self); 7 | } 8 | 9 | impl DrawableChart for AnalyzeResult { 10 | fn draw(&self) { 11 | if self.iter().len() <= 1 { 12 | return; 13 | } 14 | 15 | let mut dataset = vec![]; 16 | let mut counter = 0; 17 | for item in self.iter() { 18 | let style: Style = (get_rounded(&COLORS, counter)).into(); 19 | dataset.push(Data { 20 | label: item.postfix().to_string(), 21 | value: item.total_lines() as f32, 22 | color: Some(style), 23 | fill: get_rounded(&CHARS, counter), 24 | }); 25 | counter += 1; 26 | } 27 | if counter > 10 { 28 | counter = 10; 29 | } 30 | // draw chart 31 | Chart::new() 32 | .radius(counter as u16 + 4) 33 | .aspect_ratio(3) 34 | .legend(true) 35 | .draw(&dataset); 36 | } 37 | } 38 | 39 | fn get_rounded(array: &[T], index: usize) -> T { 40 | let mut index = index; 41 | while index >= array.len() { 42 | index -= array.len(); 43 | } 44 | array[index].clone() 45 | } 46 | const CHARS: [char; 7] = ['▰', '▼', '◆', '■', '•', '▪', '▴']; 47 | 48 | const COLORS: [Color; 7] = [ 49 | Color::Green, 50 | Color::Yellow, 51 | Color::Blue, 52 | Color::Purple, 53 | Color::Cyan, 54 | Color::White, 55 | Color::Red, 56 | ]; 57 | -------------------------------------------------------------------------------- /src/ui/mod.rs: -------------------------------------------------------------------------------- 1 | pub(crate) mod chart; 2 | pub(crate) mod table; 3 | -------------------------------------------------------------------------------- /src/ui/table.rs: -------------------------------------------------------------------------------- 1 | #[derive(Clone)] 2 | pub struct Table { 3 | content: Vec, 4 | } 5 | 6 | impl Table { 7 | pub fn new() -> Self { 8 | Self { 9 | content: vec![InTableContent::TopLine], 10 | } 11 | } 12 | 13 | pub fn write(&mut self, line: impl Into) { 14 | self.content.push(InTableContent::Text(line.into())); 15 | } 16 | pub fn write_center(&mut self, line: impl Into) { 17 | self.content.push(InTableContent::CenterText(line.into())); 18 | } 19 | pub fn empty_line(&mut self) { 20 | self.content.push(InTableContent::Text("".to_string())); 21 | } 22 | pub fn draw_line(&mut self) { 23 | self.content.push(InTableContent::MiddleLine); 24 | } 25 | 26 | pub fn render_table(mut self) -> String { 27 | self.content.push(InTableContent::BottomLine); 28 | 29 | let width = self 30 | .content 31 | .iter() 32 | .filter_map(|x| match x { 33 | InTableContent::CenterText(s) => Some(s.len()), 34 | InTableContent::Text(s) => Some(s.len()), 35 | _ => None, 36 | }) 37 | .max(); 38 | 39 | let width = width.unwrap_or(1) + 1; //+1 is for left margin 40 | 41 | self.content 42 | .iter() 43 | .map(|content| content.render(width)) 44 | .collect::>() 45 | .join("\n") 46 | } 47 | } 48 | 49 | #[derive(Clone)] 50 | enum InTableContent { 51 | TopLine, 52 | CenterText(String), 53 | Text(String), 54 | MiddleLine, 55 | BottomLine, 56 | } 57 | 58 | impl InTableContent { 59 | pub fn render(&self, width: usize) -> String { 60 | match self { 61 | InTableContent::TopLine => format!("┌{}┐", "─".repeat(width + 1)), 62 | InTableContent::MiddleLine => format!("├{}┤", "─".repeat(width + 1)), 63 | InTableContent::BottomLine => format!("└{}┘", "─".repeat(width + 1)), 64 | InTableContent::Text(text) => format!("│ {}{}│", text, " ".repeat(width - text.len())), 65 | InTableContent::CenterText(text) => { 66 | let space_around = " ".repeat((width - text.len()) / 2); 67 | let fix = if text.len() % 2 == 0 { " " } else { "" }; 68 | format!("│ {}{}{}{}│", space_around, text, space_around, fix) 69 | } 70 | } 71 | } 72 | } 73 | 74 | #[cfg(test)] 75 | mod tests { 76 | use super::*; 77 | 78 | #[test] 79 | fn full_test() { 80 | let mut table = Table::new(); 81 | table.write_center("Rust"); 82 | table.draw_line(); 83 | table.write("Hello my name is Sam"); 84 | table.empty_line(); 85 | let rendered = table.render_table(); 86 | println!("{}", &rendered); 87 | let expected = "┌──────────────────────┐ 88 | │ Rust │ 89 | ├──────────────────────┤ 90 | │ Hello my name is Sam │ 91 | │ │ 92 | └──────────────────────┘"; 93 | assert_eq!(rendered, expected); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/update.rs: -------------------------------------------------------------------------------- 1 | 2 | 3 | const GITHUB_ADDR: &str = "https://github.com/ali77gh/ProjectAnalyzer/"; 4 | 5 | pub fn update_handler() { 6 | webbrowser::open(GITHUB_ADDR).unwrap_or_else(|_| println!("checkout: {}", GITHUB_ADDR)); 7 | } 8 | --------------------------------------------------------------------------------