From c94ad19f317d528124b0286cccf6db7ead557aa1 Mon Sep 17 00:00:00 2001 From: newtoallofthis123 Date: Wed, 24 Jan 2024 22:50:37 +0530 Subject: [PATCH] Fix Progress Bars --- test_one/Cargo.lock | 1467 ------------------------------------- test_one/Cargo.toml | 28 - test_one/LICENSE | 21 - test_one/README.md | 163 ----- test_one/install_linux.py | 44 -- test_one/src/config.rs | 103 --- test_one/src/db.rs | 331 --------- test_one/src/files.rs | 53 -- test_one/src/handler.rs | 354 --------- test_one/src/main.rs | 159 ---- test_one/src/utils.rs | 179 ----- 11 files changed, 2902 deletions(-) delete mode 100644 test_one/Cargo.lock delete mode 100644 test_one/Cargo.toml delete mode 100644 test_one/LICENSE delete mode 100644 test_one/README.md delete mode 100644 test_one/install_linux.py delete mode 100644 test_one/src/config.rs delete mode 100644 test_one/src/db.rs delete mode 100644 test_one/src/files.rs delete mode 100644 test_one/src/handler.rs delete mode 100644 test_one/src/main.rs delete mode 100644 test_one/src/utils.rs diff --git a/test_one/Cargo.lock b/test_one/Cargo.lock deleted file mode 100644 index 3cbe5bd..0000000 --- a/test_one/Cargo.lock +++ /dev/null @@ -1,1467 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "ahash" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "aho-corasick" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" -dependencies = [ - "memchr", -] - -[[package]] -name = "allocator-api2" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "anstream" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd2405b3ac1faab2990b74d728624cd9fd115651fcecc7c2d8daf01376275ba" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" - -[[package]] -name = "anstyle-parse" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" -dependencies = [ - "anstyle", - "windows-sys 0.52.0", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" - -[[package]] -name = "bstr" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc" -dependencies = [ - "memchr", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" - -[[package]] -name = "bunt" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeb7c4cef71d530ff905a71f879a22a5937d761f24a4f07010fc28cdfc6a76ac" -dependencies = [ - "bunt-macros", - "termcolor", -] - -[[package]] -name = "bunt-macros" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ac489d939a3b4eac4a574ec70a5af015e01231983d0ef1f0833984522f04ab8" -dependencies = [ - "litrs", - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "bytes" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" - -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "wasm-bindgen", - "windows-targets 0.48.5", -] - -[[package]] -name = "clap" -version = "4.4.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58e54881c004cec7895b0068a0a954cd5d62da01aef83fa35b1e594497bf5445" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.4.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59cb82d7f531603d2fd1f507441cdd35184fa81beff7bd489570de7f773460bb" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "clap_lex" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" - -[[package]] -name = "colorchoice" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" - -[[package]] -name = "console" -version = "0.15.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" -dependencies = [ - "encode_unicode", - "lazy_static", - "libc", - "unicode-width", - "windows-sys 0.52.0", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" - -[[package]] -name = "crossbeam-deque" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" - -[[package]] -name = "crossterm" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67" -dependencies = [ - "bitflags 1.3.2", - "crossterm_winapi", - "libc", - "mio", - "parking_lot", - "signal-hook", - "signal-hook-mio", - "winapi", -] - -[[package]] -name = "crossterm_winapi" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" -dependencies = [ - "winapi", -] - -[[package]] -name = "dirs" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" -dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.48.0", -] - -[[package]] -name = "dyn-clone" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" - -[[package]] -name = "encode_unicode" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "fallible-iterator" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" - -[[package]] -name = "fallible-streaming-iterator" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" - -[[package]] -name = "futures" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" - -[[package]] -name = "futures-executor" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - -[[package]] -name = "futures-macro" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-sink" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" - -[[package]] -name = "futures-task" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" - -[[package]] -name = "futures-util" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "getrandom" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "gimli" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" - -[[package]] -name = "globset" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" -dependencies = [ - "aho-corasick", - "bstr", - "log", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "hashbrown" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" -dependencies = [ - "ahash", - "allocator-api2", -] - -[[package]] -name = "hashlink" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" -dependencies = [ - "hashbrown", -] - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" - -[[package]] -name = "iana-time-zone" -version = "0.1.59" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "ignore" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" -dependencies = [ - "crossbeam-deque", - "globset", - "log", - "memchr", - "regex-automata", - "same-file", - "walkdir", - "winapi-util", -] - -[[package]] -name = "indexmap" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" -dependencies = [ - "equivalent", - "hashbrown", -] - -[[package]] -name = "indicatif" -version = "0.17.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb28741c9db9a713d93deb3bb9515c20788cef5815265bee4980e87bde7e0f25" -dependencies = [ - "console", - "instant", - "number_prefix", - "portable-atomic", - "tokio", - "unicode-width", -] - -[[package]] -name = "inherent" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0122b7114117e64a63ac49f752a5ca4624d534c7b1c7de796ac196381cd2d947" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "inquire" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c33e7c1ddeb15c9abcbfef6029d8e29f69b52b6d6c891031b88ed91b5065803b" -dependencies = [ - "bitflags 1.3.2", - "crossterm", - "dyn-clone", - "lazy_static", - "newline-converter", - "thiserror", - "unicode-segmentation", - "unicode-width", -] - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "js-sys" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" - -[[package]] -name = "libredox" -version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" -dependencies = [ - "bitflags 2.4.1", - "libc", - "redox_syscall", -] - -[[package]] -name = "libsqlite3-sys" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "litrs" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9275e0933cf8bb20f008924c0cb07a0692fe54d8064996520bf998de9eb79aa" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "lock_api" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" - -[[package]] -name = "memchr" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" - -[[package]] -name = "miniz_oxide" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "0.8.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" -dependencies = [ - "libc", - "log", - "wasi", - "windows-sys 0.48.0", -] - -[[package]] -name = "newline-converter" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f71d09d5c87634207f894c6b31b6a2b2c64ea3bdcf71bd5599fdbbe1600c00f" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "num-traits" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "number_prefix" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" - -[[package]] -name = "object" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.48.5", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" - -[[package]] -name = "portable-atomic" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" - -[[package]] -name = "proc-macro2" -version = "1.0.76" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_users" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" -dependencies = [ - "getrandom", - "libredox", - "thiserror", -] - -[[package]] -name = "regex-automata" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" - -[[package]] -name = "rusqlite" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a78046161564f5e7cd9008aff3b2990b3850dc8e0349119b98e8f251e099f24d" -dependencies = [ - "bitflags 2.4.1", - "fallible-iterator", - "fallible-streaming-iterator", - "hashlink", - "libsqlite3-sys", - "smallvec", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "sea-query" -version = "0.30.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4166a1e072292d46dc91f31617c2a1cdaf55a8be4b5c9f4bf2ba248e3ac4999b" -dependencies = [ - "inherent", - "sea-query-derive", -] - -[[package]] -name = "sea-query-derive" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25a82fcb49253abcb45cdcb2adf92956060ec0928635eb21b4f7a6d8f25ab0bc" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", - "thiserror", -] - -[[package]] -name = "serde" -version = "1.0.195" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.195" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_spanned" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" -dependencies = [ - "serde", -] - -[[package]] -name = "signal-hook" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" -dependencies = [ - "libc", - "signal-hook-registry", -] - -[[package]] -name = "signal-hook-mio" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" -dependencies = [ - "libc", - "mio", - "signal-hook", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" -dependencies = [ - "libc", -] - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2593d31f82ead8df961d8bd23a64c2ccf2eb5dd34b0a34bfb4dd54011c72009e" - -[[package]] -name = "socket2" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" -dependencies = [ - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "syn" -version = "2.0.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thiserror" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio" -version = "1.35.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "num_cpus", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys 0.48.0", -] - -[[package]] -name = "tokio-macros" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "toml" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-segmentation" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" - -[[package]] -name = "unicode-width" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" - -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "utf8parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "walkdir" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.0", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.0", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" -dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" - -[[package]] -name = "winnow" -version = "0.5.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" -dependencies = [ - "memchr", -] - -[[package]] -name = "ynk" -version = "0.1.9" -dependencies = [ - "bunt", - "chrono", - "clap", - "dirs", - "futures", - "hashbrown", - "ignore", - "indicatif", - "inquire", - "rusqlite", - "sea-query", - "serde", - "tokio", - "toml", -] - -[[package]] -name = "zerocopy" -version = "0.7.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] diff --git a/test_one/Cargo.toml b/test_one/Cargo.toml deleted file mode 100644 index c603aa9..0000000 --- a/test_one/Cargo.toml +++ /dev/null @@ -1,28 +0,0 @@ -[package] -name = "ynk" -version = "0.1.9" -edition = "2021" -license = "MIT" -keywords = ["yank", "cp", "cli", "tool", "terminal"] -readme = "README.md" -authors = ["Ishan Joshi "] -description = "Effortlessly yank and paste files blazingly fast in the terminal" -repository = "https://github.com/newtoallofthis123/ynk" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -bunt = "0.2.8" -chrono = "0.4.31" -clap = { version = "4.4.16", features = ["derive"] } -dirs = "5.0.1" -futures = "0.3.30" -hashbrown = "0.14.3" -ignore = "0.4.22" -indicatif = { version = "0.17.7", features = ["tokio"] } -inquire = "0.6" -rusqlite = { version = "0.30.0", features = ["bundled"] } -sea-query = "0" -serde = {version="1.0.195", features = ["derive"]} -tokio = { version = "1.35.1", features = ["full"] } -toml = {version = "0.8.8", features = ["preserve_order"]} diff --git a/test_one/LICENSE b/test_one/LICENSE deleted file mode 100644 index dff7946..0000000 --- a/test_one/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2024 NoobScience - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/test_one/README.md b/test_one/README.md deleted file mode 100644 index 3bccf94..0000000 --- a/test_one/README.md +++ /dev/null @@ -1,163 +0,0 @@ -# Y(a)NK - -Y(a)nk is a simple command line tool that implements a very basic feature in the terminal that I always wanted to have. It allows you to essentially copy and paste files from one directory to another without having to type out the full path. It's a very simple tool that I made for myself, but I thought it might be useful for others as well. - -So essentially, you can go into a directory, like you would do with a GUI, and copy a file or directory. Then you can go to another directory and paste it. It's that simple. - -No `cp` or `mv` needed. Just `yank` and `paste`. - -## Installation - -### Unix - -If you are on a unix platform like Linux or Macos, ynk has first class and tested support for it. The best way to install it is to use cargo. If you don't have cargo installed, you can install it from [here](https://rustup.rs/). - -Once you have cargo installed, you can install ynk by running the following command: - -```bash -cargo install ynk -``` - -Or, you can also run ~~the install.sh or~~ the `install_linux.py` script in the root of the repository. This will install ynk in `/usr/local/bin` and will also create a `yank` alias for `ynk`. - -```bash -./install.sh -``` - -### Windows - -The best way to install ynk on Windows is to use cargo. - -```bash -cargo install ynk -``` - -Moreover, I cannot test it on Windows, so if you find any bugs, please open an issue. - -## Usage - -### Copying - -To copy a file or directory, you can use the `add` command. It takes a single argument which is the path to the file(s) or directory(s) that you want to copy. - -```bash -yank add README.md -``` - -For this you need not provide any arguments. This is because this inherently doesn't do any sort of IO operations. It just stores the path of the file or directory in a database. So it's very fast. - -It checks the integrity of the path, converts it into a suitable format, and then stores it in the database. If the path is invalid, it will throw an error. - -### Pasting - -Pasting is also quite simple. Just use the `paste` command. Here is where you get to essentially tweak what you want to copy over. You can do this with the following options - -> **WARNING**: Paste will paste all the files and directories in the store. If you want to specify a specific entry, use `ynk list`, get the index of the entry, and then use `ynk paste -r `, or just use `ynk pop`. - -```bash -ynk paste [-n|--no-ignore] [--hidden] [-s|--strict] [-f|--force] [--dry-run] [-r|--range ] [-d|--delete] FOLDER_NAME -``` - -Before passing in the options, know that the `paste` command is highly optimized for IO tasks. All the way from reading the directory structure (walking the directory tree) to reading and writing files. It uses a lot of threads to do this. So it's very fast. - -Moreover, it also by default respects your `.gitignore` file and doesn't copy over an hidden files or directories. To learn how to tweak this, read the options below. - -- `-n` or `--no-ignore`: This will make it ignore the `.gitignore` file and copy over all files and directories. -- `--hidden`: This will make it copy over hidden files and directories as well. -- `-s` or `--strict`: This will make sure that any and all IO errors are reported. By default, it will ignore any IO errors and continue with the operation. -- `-f` or `--force`: **TODO** For now, this does nothing. But in the future, this will make it overwrite any files or directories that already exist. -- `--dry-run`: This will make it not actually copy over any files or directories. It will just print out what it would have done. -- `-r` or `--range`: This will make it paste only a range of files and directories. This is useful when you want to paste only a few files and directories from a large list. You can specify the range in the following format: `start:end`. -It is not the smartest yet, so make sure that you specify the range correctly. It will throw an error if the range is invalid. -- `-d` or `--delete`: This will make it delete the files and directories from stored in the database after pasting them. Not from the disk. - -### Popping - -This is the most common use case. -You can pop the last file or directory that you copied. This will remove it from the database and paste all the files and directories in the current directory. -The same options as the `paste` command, except the `--range` option, are available for the `pop` command. - -```bash -yank pop [-n|--no-ignore] [--hidden] [-s|--strict] [-f|--force] [--dry-run] [-d|--delete] FOLDER_NAME -``` - -### Listing - -You can list all the files and directories indexed by ynk in the database. - -```bash -yank list -``` - -### Deleting - -You can delete a file or directory from the database. - -```bash -yank delete README.md -``` - -## So it's just a glorified `cp`? - -Well, yes and no. For now, it only has a database that sort of abstracts a name and full path. So you can do something like this: - -```bash -yank add README.md -``` - -This would store something like this in the database: - -| id | name | path | created_at | -|----|----------|------------|------------| -| 1 | README.md| /home/user/README.md | 2020-01-01 00:00:00 | - -So, when you paste, it would basically just read the entire file, store it in temporary memory, and then write it to the current directory. So it's not really a `cp` or `mv` because it doesn't actually move the file. It just reads and writes it. - -## Stuff Ynk can do that `cp` can't - -- It can respect your `.gitignore` file. So if you have a file or directory that is ignored by git, it won't be copied over. -- Have a consistent store of files and directories that you copy over. You can list them, delete them, and paste them whenever you want. -- Essentially, it's a clipboard for your files and directories. -- It's fast. It uses multiple threads to do IO operations, so it's very fast. -- Especially useful for handling very large projects with dependencies, think `node_modules` or `target` directories. -- You can essentially combine multiple `cp` commands into one. You can copy over multiple files and directories, and then paste them all at once, in fact this is the recommended way to use ynk. -- Hey, it's Rust. So it's fast and safe. -- Essentially, it's a GUI like feature in the terminal. - -## What about the pasting? - -Pasting is at the core of this tool. The indexed files and directories are stored in a database. So when you paste, it will read the file's exact path from the database, and then read the file, and then write it to the current directory. -If the path it is reading from is invalid, it will throw an error. - -The IO operation itself is powered by multiple threads, almost like a thread pool. So it's very fast. Every file IO is done in a separate thread. So it's very fast. -The Reading and writing of the files is done in chunks powered by `tokio`'s fs module, maintaining safety and speed. - -The file tree is walked using `walkdir`, while making sure that it respects the `.gitignore` file. All of this is done parallely in a thread pool with a in memory static cache. - -## What DB do I need to install? - -You need not install any database. - -The database is a simple SQLite3 database, the drivers for which are embedded in the binary. So you don't need to install anything else. This keeps the binary a single file, and makes it easy to install and use. - -The db functionality is all abstracted away in a separate module, so it's easy to swap out the database if needed. - -## TODO - -- [ ] Add a `--force` option to overwrite files and directories. -- [x] Add a `--target` option to paste files and directories in a specific directory. (release 0.1.2) -- [ ] Add config file support. -- [ ] Add permanent storage option. -- [ ] More explicit error handling. - -## License - -This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. - -## Contributing - -ynk is an open source project and contributions are welcome. You can contribute in many ways like filing issues, fixing bugs, suggesting features, etc. You can read the contributing guidelines [here](CONTRIBUTING.md). - -I am quite new to Rust, so if you find any bugs or have any suggestions, please open an issue. I would love to hear your feedback. - -Thanks for trying out ynk! diff --git a/test_one/install_linux.py b/test_one/install_linux.py deleted file mode 100644 index 5dda958..0000000 --- a/test_one/install_linux.py +++ /dev/null @@ -1,44 +0,0 @@ -import platform -import requests -import os -import tarfile -import tempfile - -LINUX_RELEASE_URL = "https://github.com/newtoallofthis123/ynk/releases/download/v.0.1.1/ynk_v.0.1.1.tar.xz" -DESTINATION = "ynk_v.0.1.1.tar.xz" - - -def get_release_url(): - system = platform.system() - if system == "Windows": - print("Windows is not supported yet") - print("Use cargo install ynk instead") - exit(0) - elif system == "Darwin": - print("Mac is not supported yet") - print("Use cargo install ynk instead") - exit(0) - elif system == "Linux": - return LINUX_RELEASE_URL - else: - print("Unknown system") - exit(0) - - -temp_dir = tempfile.gettempdir() -tar_file_path = os.path.join(temp_dir, DESTINATION) -des_dir = os.path.expanduser("/usr/local/bin/") -url = get_release_url() -response = requests.get(url) - -with open(tar_file_path, "wb") as file: - file.write(response.content) - - -with tarfile.open(tar_file_path, "r:xz") as tar: - tar.extractall(temp_dir) - -print("Give me the sudo power!!") -os.system(f"sudo mv {temp_dir}/ynk {des_dir}") - -print(f"File downloaded to {DESTINATION}") diff --git a/test_one/src/config.rs b/test_one/src/config.rs deleted file mode 100644 index c3dcd0c..0000000 --- a/test_one/src/config.rs +++ /dev/null @@ -1,103 +0,0 @@ -use std::path::Path; - -use crate::{files::get_config_path, Args}; - -/// ConstructedArgs struct -/// which is used to emulate or mimic -/// Arg struct -/// -/// This is a safe way to interact with the async paste -/// handler without accidentally messing up the arguments -/// -/// Moreover, this is a good way to pass arguments from -/// the config file to the async paste handler -/// -/// # Warning -/// -/// In the actual config implementation, every argument -/// is placed in a "OR" relationship with the arguments passed -/// to the command line. -/// -/// # Note -/// -/// This takes up a bit more memory than the Arg struct -/// but it is worth it in the long run -pub struct ConstructedArgs { - pub files: Option>, - pub dir: bool, - pub strict: bool, - pub no_ignore: bool, - pub hidden: bool, - pub overwrite: bool, - pub delete: bool, - pub range: Option, - pub specific: Option, -} - -impl ConstructedArgs { - pub fn new(args: Args, config: Config) -> Self { - Self { - files: args.files, - dir: args.dir, - strict: arg_or_config(args.strict, config.strict), - hidden: arg_or_config(args.hidden, config.hidden), - overwrite: arg_or_config(args.overwrite, config.overwrite), - no_ignore: arg_or_config(args.no_ignore, config.no_ignore), - delete: arg_or_config(args.delete, config.delete), - range: args.range, - specific: None, - } - } -} - -pub fn arg_or_config(to_check: bool, replace: bool) -> bool { - if !to_check { - replace - } else { - to_check - } -} - -/// Write a file to the specified path -pub fn write_file(path: &Path, content: String) -> bool { - let _ = std::fs::write(path, content); - true -} - -fn default_config() -> String { - r#" -strict = false -no_ignore = false -hidden = false -overwrite = false -delete = false -"# - .to_string() -} - -#[derive(serde::Deserialize)] -pub struct Config { - pub strict: bool, - pub no_ignore: bool, - pub hidden: bool, - pub overwrite: bool, - pub delete: bool, -} - -/// Convert config from string to Config struct -pub fn get_config(config: String) -> Config { - let config: Config = - toml::from_str(config.as_str()).unwrap_or(toml::from_str(&default_config()).unwrap()); - config -} - -pub fn get_config_from_file() -> Config { - let config_path = get_config_path(); - let config = std::fs::read_to_string(config_path).unwrap_or(default_config()); - get_config(config) -} - -/// Writes the default config to the config file -pub fn write_default_config() { - write_file(&get_config_path(), default_config()); -} diff --git a/test_one/src/db.rs b/test_one/src/db.rs deleted file mode 100644 index c397185..0000000 --- a/test_one/src/db.rs +++ /dev/null @@ -1,331 +0,0 @@ -use std::str::FromStr; - -use chrono::{DateTime, Local}; -use rusqlite::Connection; -use sea_query::{ColumnDef, Expr, Iden, Order, Query, SqliteQueryBuilder, Table}; - -use crate::files::get_path; - -/// The name of the database -const DB_NAME: &str = "store.db"; - -/// Establishes a connection to the database -/// The database name is specified in the DB_NAME constant -pub fn connect_to_db() -> Result { - Connection::open(get_path(DB_NAME)) -} - -#[derive(Iden)] -enum Store { - Table, - Id, - Name, - Path, - IsDir, - AccessedAt, - CreatedAt, -} - -#[derive(Debug)] -pub struct Entry { - pub id: i32, - pub name: String, - pub path: String, - pub is_dir: bool, - pub accessed_at: DateTime, - pub created_at: DateTime, -} - -#[derive(Debug, Clone)] -pub struct EntryBuilder { - pub name: String, - pub path: String, - pub is_dir: bool, -} - -impl EntryBuilder { - pub fn new(name: &str, path: &str, is_dir: bool) -> Self { - Self { - name: name.to_string(), - path: path.to_string(), - is_dir, - } - } -} - -pub fn prep_db(conn: &Connection) -> rusqlite::Result { - let query = Table::create() - .table(Store::Table) - .if_not_exists() - .col( - ColumnDef::new(Store::Id) - .integer() - .not_null() - .auto_increment() - .primary_key(), - ) - .col(ColumnDef::new(Store::Name).string().not_null()) - .col(ColumnDef::new(Store::Path).string().not_null()) - .col(ColumnDef::new(Store::IsDir).boolean().not_null()) - .col(ColumnDef::new(Store::AccessedAt).date_time().not_null()) - .col(ColumnDef::new(Store::CreatedAt).date_time().not_null()) - .build(SqliteQueryBuilder); - - conn.execute(&query, []) -} - -/// Inserts an entry into the database -/// -/// # Arguments -/// -/// * `conn` - A reference to the database connection -/// * `eb` - An EntryBuilder struct -/// -/// # Returns -/// A Result enum with the following variants: -/// -/// * `Entry` - The entry that was inserted into the database -/// * `rusqlite::Error` - The error that was encountered while inserting into the database -pub fn insert_into_db(conn: &Connection, eb: EntryBuilder) -> Result { - let time_now = Local::now().to_string(); - - let query = Query::insert() - .into_table(Store::Table) - .columns([ - Store::Name, - Store::Path, - Store::IsDir, - Store::AccessedAt, - Store::CreatedAt, - ]) - .values_panic([ - eb.name.clone().into(), - eb.path.clone().into(), - eb.is_dir.into(), - time_now.clone().into(), - time_now.into(), - ]) - .to_string(SqliteQueryBuilder); - - match does_exist(conn, &eb.path) { - Ok(entry) => { - return Ok(entry); - } - Err(rusqlite::Error::QueryReturnedNoRows) => {} - Err(_) => {} - } - - conn.execute(&query, []) - .expect("Failed to insert into database"); - - let query = Query::select() - .columns([ - Store::Id, - Store::Name, - Store::Path, - Store::IsDir, - Store::AccessedAt, - Store::CreatedAt, - ]) - .from(Store::Table) - .and_where(Expr::col(Store::Name).eq(eb.name)) - .limit(1) - .to_string(SqliteQueryBuilder); - - conn.query_row(&query, [], |row| { - let accessed_at = - chrono::DateTime::from_str(row.get::<_, String>(4)?.as_str()).unwrap_or(Local::now()); - let created_at = - chrono::DateTime::from_str(row.get::<_, String>(5)?.as_str()).unwrap_or(Local::now()); - - Ok(Entry { - id: row.get(0)?, - name: row.get(1)?, - path: row.get(2)?, - is_dir: row.get(3)?, - accessed_at, - created_at, - }) - }) -} - -/// Gets all the entries from the database -/// -/// # Arguments -/// -/// * `conn` - A reference to the database connection -/// -/// # Returns -/// A Result enum with the following variants: -/// -/// * `Vec` - A vector of all the entries in the database -/// * `rusqlite::Error` - The error that was encountered while getting the entries from the database -pub fn get_all(conn: &Connection) -> Result, rusqlite::Error> { - let query = Query::select() - .columns([ - Store::Id, - Store::Name, - Store::Path, - Store::IsDir, - Store::AccessedAt, - Store::CreatedAt, - ]) - .from(Store::Table) - .to_string(SqliteQueryBuilder); - - let mut stmt = conn.prepare(&query)?; - - let entries = stmt - .query_map([], |row| { - let accessed_at = chrono::DateTime::from_str(row.get::<_, String>(4)?.as_str()) - .unwrap_or(Local::now()); - let created_at = chrono::DateTime::from_str(row.get::<_, String>(5)?.as_str()) - .unwrap_or(Local::now()); - - Ok(Entry { - id: row.get(0)?, - name: row.get(1)?, - path: row.get(2)?, - is_dir: row.get(3)?, - accessed_at, - created_at, - }) - })? - .map(|x| x.unwrap()) - .collect::>(); - - Ok(entries) -} - -/// Gets an entry from the database -/// using the path of the file -/// essentially checking if the file exists -/// in the database -/// -/// # Arguments -/// -/// * `conn` - A reference to the database connection -/// * `path` - The path of the file -/// -/// # Returns -/// -/// A Result enum with the following variants: -/// -/// * `Entry` - The entry that was found in the database -/// * `rusqlite::Error` - The error that was encountered while getting the entry from the database -/// -/// # Usage -/// -/// To essentially check if an entry exists, the Error `rusqlite::Error::QueryReturnedNoRows` is -/// returned if the entry does not exist in the database -/// Otherwise, the entry can be essentially used as a normal entry -pub fn does_exist(conn: &Connection, path: &str) -> Result { - let query = Query::select() - .columns([ - Store::Id, - Store::Name, - Store::Path, - Store::IsDir, - Store::AccessedAt, - Store::CreatedAt, - ]) - .from(Store::Table) - .and_where(Expr::col(Store::Path).eq(path)) - .limit(1) - .to_string(SqliteQueryBuilder); - - conn.query_row(&query, [], |row| { - let accessed_at = - chrono::DateTime::from_str(row.get::<_, String>(4)?.as_str()).unwrap_or(Local::now()); - let created_at = - chrono::DateTime::from_str(row.get::<_, String>(5)?.as_str()).unwrap_or(Local::now()); - - Ok(Entry { - id: row.get(0)?, - name: row.get(1)?, - path: row.get(2)?, - is_dir: row.get(3)?, - accessed_at, - created_at, - }) - }) -} - -/// Delete an entry from the database -/// using the path of the file -/// -/// # Arguments -/// -/// * `conn` - A reference to the database connection -/// * `path` - The path of the file -/// -/// # Returns -/// -/// A Result enum with the following variants: -/// -/// * `usize` - The number of rows that were deleted -/// * `rusqlite::Error` - The error that was encountered while deleting the entry from the database -pub fn delete_entry(conn: &Connection, path: &str) -> Result { - let query = Query::delete() - .from_table(Store::Table) - .and_where(Expr::col(Store::Path).eq(path)) - .to_string(SqliteQueryBuilder); - - conn.execute(&query, []) -} - -/// Delete all the entries from the database -/// Basically, it drops the table -/// -/// Better than deleting all the entries one by one -/// -/// # Arguments -/// -/// * `conn` - A reference to the database connection -/// -/// # Returns -/// -/// A Result enum with the following variants: -/// -/// * `usize` - The number of rows that were deleted -/// * `rusqlite::Error` - The error that was encountered while deleting the entries from the database -pub fn delete_all(conn: &Connection) -> Result { - let table_del = Table::drop() - .table(Store::Table) - .if_exists() - .to_string(SqliteQueryBuilder); - - conn.execute(&table_del, []) -} - -pub fn pop_one(conn: &Connection) -> Result { - let query = Query::select() - .columns([ - Store::Id, - Store::Name, - Store::Path, - Store::IsDir, - Store::AccessedAt, - Store::CreatedAt, - ]) - .order_by(Store::Id, Order::Asc) - .from(Store::Table) - .limit(1) - .to_string(SqliteQueryBuilder); - - conn.query_row(&query, [], |row| { - let accessed_at = - chrono::DateTime::from_str(row.get::<_, String>(4)?.as_str()).unwrap_or(Local::now()); - let created_at = - chrono::DateTime::from_str(row.get::<_, String>(5)?.as_str()).unwrap_or(Local::now()); - - Ok(Entry { - id: row.get(0)?, - name: row.get(1)?, - path: row.get(2)?, - is_dir: row.get(3)?, - accessed_at, - created_at, - }) - }) -} diff --git a/test_one/src/files.rs b/test_one/src/files.rs deleted file mode 100644 index 7969492..0000000 --- a/test_one/src/files.rs +++ /dev/null @@ -1,53 +0,0 @@ -//! This module contains functions related to files and directories -//! It has functions to get the store and config paths - -use std::path::PathBuf; - -use dirs::{config_dir, home_dir}; - -const NAME: &str = "ynk"; - -/// This function returns the path to the store directory -/// ie the directory where all the files related to SuperPaste are stored -/// -/// # Panics -/// -/// This function panics if it fails to get the home directory -pub fn get_store_path() -> PathBuf { - let home_path = home_dir().expect("Failed to get home directory"); - home_path.join(PathBuf::from(".".to_owned() + NAME)) -} - -/// This function checks if the store and config directories exist -/// If they don't, it creates them -/// -/// # Panics -/// -/// This function panics if it fails to create the directories -/// or when it fails to get the necessary paths -pub fn check_paths_exist() { - let store_path = get_store_path(); - if !store_path.exists() { - std::fs::create_dir_all(store_path).expect("Failed to create store directory"); - } - - let config_path = get_config_path(); - if !config_path.exists() { - std::fs::create_dir_all(config_path).expect("Failed to create config directory"); - } -} - -/// This function returns the path to the config file -pub fn get_config_path() -> PathBuf { - let config_path = config_dir() - .expect("Failed to get config directory") - .join(NAME); - config_path.join("config.toml") -} - -/// This function returns the path to the file in the store directory -/// basically it joins the path passed to it with the store directory -pub fn get_path(path: &str) -> PathBuf { - let path_buf = get_store_path(); - path_buf.join(path) -} diff --git a/test_one/src/handler.rs b/test_one/src/handler.rs deleted file mode 100644 index 3f4e891..0000000 --- a/test_one/src/handler.rs +++ /dev/null @@ -1,354 +0,0 @@ -use std::{ - path::PathBuf, sync::{Arc, OnceLock} -}; - -use hashbrown::HashMap; -use indicatif::{ProgressBar, ProgressStyle}; -use tokio::{sync::Mutex, task}; - -use crate::{ - db, utils::{self, does_file_exist, list_dir, ListDirConfig, parse_range}, Command, ConstructedArgs -}; - -/// The main handler function that handles all the commands -/// and the arguments -/// -/// It sort of acts like a router -/// sending the commands to their respective handlers -/// -/// # Arguments -/// -/// * `cmd` - The command to be handled -/// * `args` - The arguments to be handled -/// * `conn` - The database connection -/// -/// # Note -/// -/// This function is async because the paste command is async. -/// -/// # Panics -/// -/// This function panics if the database connection is not valid -/// and also if at any point, an error occurs while handling the -/// paste command -pub async fn handler(cmd: Command, args: ConstructedArgs, conn: &rusqlite::Connection) { - let mut files: HashMap = HashMap::new(); - - if cmd == Command::Add { - // make sure that the files are empty - // before adding new files - files.clear(); - - let req = args.files.unwrap_or_else(|| { - bunt::println!("{$yellow}No files or directories specified{/$}"); - bunt::println!("Copying the current directory"); - let choice = inquire::Confirm::new("Do you want to continue?") - .with_default(true) - .prompt() - .unwrap(); - - if !choice { - std::process::exit(0); - } - - vec![".".to_string()] - }); - req.iter().for_each(|x| { - if !does_file_exist(x) { - bunt::println!( - "{$red}File or directory with path \"{$white}{}{/$}\" does not exist.{/$}", - x - ); - std::process::exit(1); - } - - files.insert( - utils::strip_weird_stuff(x), - PathBuf::from(x).canonicalize().unwrap(), - ); - }); - - let entries = utils::construct_entry_builders(&files) - .iter() - .map(|x| { - db::insert_into_db(conn, x.to_owned()).expect("Could not insert into database") - }) - .collect::>(); - - // clear the files and entries hashmap - files.clear(); - - bunt::println!("Copied {$green}{}{/$} files", entries.len()); - } else if cmd == Command::Paste { - let mut paste_config = args; - paste_config.specific = None; - - handle_paste(paste_config, conn).await; - } else if cmd == Command::Exit { - bunt::println!("{$yellow}Bye!{/$}"); - std::process::exit(0); - } else if cmd == Command::List { - let entries = db::get_all(conn).expect("Could not get entries from database"); - - bunt::println!("{$green}{}{/$} files in store", entries.len()); - let mut count = 0; - - entries.iter().for_each(|x| { - bunt::println!("{}. {$blue}{}{/$}", count, x.path); - count += 1; - }); - - bunt::println!("Use {$green}ynk paste{/$} to paste the files"); - } else if cmd == Command::Pop { - let entry = match db::pop_one(conn) { - Ok(entry) => entry, - Err(e) => { - bunt::println!("{$red}Could not pop entry from database: {:?}{/$}", e); - std::process::exit(1); - } - }; - - let mut paste_config = args; - paste_config.range = None; - paste_config.specific = Some(entry.path); - - handle_paste(paste_config, conn).await - } else if cmd == Command::Clear { - let choice = inquire::Confirm::new("Are you sure you want to clear all the copied files?") - .prompt() - .unwrap(); - - if !choice { - bunt::println!("Ok! {$red}Quitting{/$}"); - } - - bunt::println!("Clearing the indexed files"); - db::delete_all(conn).expect("Unable to delete the indexes"); - } else if cmd == Command::Delete { - let entries = db::get_all(conn).expect("Could not get entries from database"); - - let mut choices = entries - .iter() - .map(utils::wrap_from_entry) - .collect::>(); - - choices.insert("Proceed".to_string(), PathBuf::from("_______")); - - let mut to_delete = Vec::new(); - let mut delete_choices = choices.iter().map(|(n, _)| n.clone()).collect::>(); - - loop { - let choice = inquire::Select::new( - "Select a file to delete", - delete_choices.clone() - ) - .prompt() - .unwrap(); - - if choice == "Proceed" { - break; - } - - to_delete.push(choices.get(&choice).unwrap().clone()); - delete_choices.remove(delete_choices.iter().position(|x| x == &choice).unwrap()); - } - - to_delete.iter().for_each(|x| { - db::delete_entry(conn, x.to_str().unwrap()).expect("Unable to delete entry"); - }); - - bunt::println!("Deleted {$green}{}{/$} files", to_delete.len()); - } -} - -/// Private async function to handle the paste command -async fn handle_paste(paste_config: ConstructedArgs, conn: &rusqlite::Connection) { - let s_files = db::get_all(conn) - .expect("Could not get entries from database") - .iter() - .map(utils::wrap_from_entry) - .filter(|(_, path)| { - if paste_config.specific.is_some() { - return path.to_str().unwrap() == paste_config.specific.as_ref().unwrap(); - } - true - }) - .collect::>(); - - let files = if paste_config.range.is_some(){ - let range = paste_config.range.unwrap(); - if range.contains(':'){ - let range_no = range.split(':').collect::>(); - if range_no.len() != 2 || range_no.len() > s_files.len(){ - bunt::println!("{$red}Invalid range{/$}"); - std::process::exit(1); - } else if range_no[0].parse::().is_err() || range_no[1].parse::().is_err(){ - bunt::println!("{$red}Invalid range{/$}"); - std::process::exit(1); - } - let (start, end) = parse_range(&range); - s_files - .iter() - .enumerate() - .filter(|(i, _)| *i >= start && *i <= end) - .map(|(_, (n, p))| (n.clone(), p.clone())) - .collect::>() - } else{ - let index = range.parse::().unwrap(); - if index > s_files.len(){ - bunt::println!("{$red}Invalid range{/$}"); - std::process::exit(1); - } - s_files - .iter() - .enumerate() - .filter(|(i, _)| *i == index) - .map(|(_, (n, p))| (n.clone(), p.clone())) - .collect::>() - } - } else{ - s_files - }; - - let user_target = paste_config - .files - .unwrap_or_else(|| vec![".".to_string()]) - .first() - .unwrap() - .clone(); - - static LIST_DIR_CONFIG: OnceLock = OnceLock::new(); - LIST_DIR_CONFIG.get_or_init(|| ListDirConfig { - filter_file: !paste_config.dir, - full_path: false, - strict: paste_config.strict, - hidden: paste_config.hidden, - respect_ignore: !paste_config.no_ignore, - }); - - let mut final_files = HashMap::new(); - - files.iter().for_each(|(name, path)| { - if path.is_dir() { - let entries = list_dir(path.to_str().unwrap(), LIST_DIR_CONFIG.get().unwrap()); - final_files.extend(entries.iter().map(|x| { - let (name, path) = utils::wrap_from_path(path, x); - (name, path) - })); - } else { - final_files.insert(name.clone(), path.clone()); - } - }); - - let pb = Arc::new(Mutex::new(ProgressBar::new(final_files.len() as u64).with_style( - ProgressStyle::default_bar() - .template("{spinner:.green} [{elapsed_precise}] [{bar:40.cyan/blue}] {pos:>7}/{len:7} {msg}") - .unwrap() - .progress_chars("#>-"), - ))); - - if utils::is_git_repo( - &user_target - ) { - bunt::println!("{$blue}Target directory is a git repository{/$}"); - bunt::println!("This may cause some problems with memory, which may cause your system to hang while the IO is being performed"); - bunt::println!("{$yellow}Proceed with caution{/$}"); - - let choice = inquire::Confirm::new("Do you want to continue?") - .with_default(false) - .prompt() - .unwrap(); - - if !choice { - bunt::println!("Good choice! I'll definitely fix this in the future"); - std::process::exit(0); - } - } - - let tasks = final_files.iter().map(|(name, path)| { - if !PathBuf::from(user_target.clone()).exists() { - bunt::println!("{$yellow}Target directory does not exist{/$}"); - bunt::println!("Creating the directory"); - std::fs::create_dir(&user_target).expect("Could not create directory"); - } - let target_file = PathBuf::from(user_target.clone()).join(name); - let pb_clone = Arc::clone(&pb); - - // Spawn a new asynchronous task for each file copy operation - task::spawn(copy_paste( - pb_clone, - path.clone(), - target_file.clone(), - paste_config.overwrite, - )) - }); - - match futures::future::try_join_all(tasks).await { - Ok(res) => { - let mut count: u64 = 0; - - res.iter().for_each(|x| { - if let Err(e) = x { - bunt::println!("{$red}Failed to paste file: {:?}{/$}\nUse the {$white}-v{/$} flag to see the error", e); - } else{ - count += 1; - } - }); - - let pb = pb.lock().await; - pb.finish_with_message(format!("Pasted {} files in {}", count, pb.elapsed().as_secs_f32())); - - files.iter().for_each(|(_, path)| { - let redundant_entry = match db::does_exist(conn, path.to_str().unwrap()){ - Ok(entry) => entry, - Err(e) => { - bunt::println!("{$red}Failed to check if entry exists: {:?}{/$}\nUse the {$white}-v{/$} flag to see the error", e); - std::process::exit(1); - } - }; - - db::delete_entry(conn, path.to_str().unwrap()).expect("Unable to delete entry"); - - if !paste_config.delete{ - db::insert_into_db(conn, utils::builder_from_entry(&redundant_entry)).expect("Could not insert into database"); - } - }); - } - Err(e) => { - bunt::println!("{$red}Failed to paste files: {:?}{/$}\nUse the {$white}-v{/$} flag to see the error", e); - } - } -} - -/// The Async function in charge of copying and pasting files -/// from the source to the target -/// This is at the core of the program -/// So, essentially, this function acts as an async and completely -/// parallelized version of the `cp` command -async fn copy_paste( - pb: Arc>, - source: PathBuf, - target: PathBuf, - overwrite: bool, -) -> Result<(), std::io::Error> { - tokio::fs::create_dir_all(target.parent().unwrap()).await?; - - let contents = tokio::fs::read(source).await?; - - if target.exists() && !overwrite { - bunt::println!( - "File {$yellow}{}{/$} already exists", - target.to_str().unwrap() - ); - - bunt::println!("Use the {$green}--overwrite{/$} flag to overwrite the any and all files"); - std::process::exit(1); - } - - tokio::fs::write(target, contents).await?; - - let pb = pb.lock().await; - pb.inc(1); - - Ok(()) -} diff --git a/test_one/src/main.rs b/test_one/src/main.rs deleted file mode 100644 index fda07c2..0000000 --- a/test_one/src/main.rs +++ /dev/null @@ -1,159 +0,0 @@ -use std::path::PathBuf; - -use clap::{command, Parser}; -use config::{get_config_from_file, write_default_config, ConstructedArgs}; -use files::get_config_path; -mod config; -mod db; -mod files; -mod handler; -mod utils; - -#[derive(Parser, Debug, Clone)] -#[command(name="ynk", author="Ishan Joshi ", version, about="Copy paste files in the terminal", long_about = None)] - -/// The Args struct is used to parse the command line arguments -/// In order to make the command line arguments more user friendly -/// the user has the option to not pass in the command name -/// If the user does not pass in the command name, then the program -/// will prompt the user to enter the command name -struct Args { - #[arg(required = false, help = "The command to be executed")] - cmd: Option, - - #[arg( - required = false, - help = "The name of the files / directories to be added to the store" - )] - files: Option>, - - #[arg( - required = false, - long, - help = "Explicitly specify that the given path is a directory" - )] - dir: bool, - - #[arg(required = false, short, long, help = "Throw any and all IO errors")] - strict: bool, - - #[arg( - required = false, - short, - long, - help = "Ignore the .gitignore file while adding files" - )] - no_ignore: bool, - - #[arg(required = false, long, help = "Include hidden files while pasting")] - hidden: bool, - - #[arg( - required = false, - short, - long, - help = "Overwrite the file if it already exists while pasting" - )] - overwrite: bool, - - #[arg( - required = false, - short, - long, - help = "Delete the file from the store, but not from the disk" - )] - delete: bool, - - #[arg( - required = false, - short, - long, - help = "The Range of files to be pasted" - )] - range: Option, -} - -#[derive(Debug, PartialEq, Eq)] -pub enum Command { - Add, - Paste, - Pop, - List, - Delete, - Clear, - Empty, - Exit, -} - -impl Command { - fn from(cmd: &str) -> Command { - match cmd { - "add" => Command::Add, - "paste" => Command::Paste, - "pop" => Command::Pop, - "clear" => Command::Clear, - "list" => Command::List, - "delete" => Command::Delete, - "exit" => Command::Exit, - _ => Command::Empty, - } - } -} - -#[tokio::main] -async fn main() { - let args = Args::parse(); - - if !get_config_path().exists() { - write_default_config(); - } - - let config = get_config_from_file(); - - let temp_arg = args.clone(); - let mut cmd = match args.clone().cmd { - Some(cmd) => Command::from(&cmd), - None => { - bunt::println!("{$yellow}Interactive Mode{/$}"); - get_cmd() - } - }; - - if cmd == Command::Empty { - if let Some(cmd) = temp_arg.cmd { - if PathBuf::from(cmd.clone()).exists() { - bunt::println!("You seem to have entered a {$red}file path{/$}"); - bunt::println!("You can use {$blue}ynk add {}{/$} to add to the store", cmd); - std::process::exit(0); - } - } else { - bunt::println!( - "{$red}Invalid Command{/$} \"{$green}{}{/$}\"", - &temp_arg.cmd.unwrap() - ); - } - cmd = get_cmd(); - } - - // check all the paths - files::check_paths_exist(); - - let conn = db::connect_to_db().expect("Could not connect to database"); - - db::prep_db(&conn).expect("Could not prepare database"); - - let constructed_args = ConstructedArgs::new(args, config); - - handler::handler(cmd, constructed_args, &conn).await; -} - -fn get_cmd() -> Command { - let choice = inquire::Select::new( - "Select a Command", - vec!["add", "paste", "list", "clear", "pop", "exit"], - ) - .prompt() - .unwrap(); - - Command::from(choice) -} diff --git a/test_one/src/utils.rs b/test_one/src/utils.rs deleted file mode 100644 index 70946df..0000000 --- a/test_one/src/utils.rs +++ /dev/null @@ -1,179 +0,0 @@ -use std::{ - path::{Path, PathBuf}, - sync::{Arc, Mutex}, -}; - -use hashbrown::HashMap; -use ignore::{WalkBuilder, WalkState}; - -use crate::db::{Entry, EntryBuilder}; - -pub fn does_file_exist(path: &str) -> bool { - let path_buf = PathBuf::from(path); - path_buf.exists() -} - -/// The Config struct that is used to configure the list_dir function -/// Easier than setting all the arguments -/// Plus, is usually OnceLocked -/// so, it can be used in multiple threads -#[derive(Debug, Clone)] -pub struct ListDirConfig { - pub respect_ignore: bool, - pub full_path: bool, - pub strict: bool, - pub hidden: bool, - pub filter_file: bool, -} - -/// Recursively lists all the files and directories in a directory -/// using the effective ignore file -/// as outlined by the crate `ignore` -/// which implements good algorithms listing and ignoring files -/// -/// # Warning -/// -/// This function does not throw any errors -/// when it encounters an error while listing the files -/// so, if you want to handle errors, use `strict_list_dir` -/// -/// # Arguments -/// -/// * `dir_path` - The path of the directory to list -/// * `respect_ignore` - Whether to respect the ignore file or not -/// * `full_path` - Whether to return the full path or not -/// * `strict` - Whether to throw errors when it encounters an error while listing files -/// -/// Usually, you would want to set the respect_ignore to true -/// and full_path to true. -/// Since I can't really set defaults for these, so think of them as -/// defaults. -/// -/// # Returns -/// -/// A vector of `PathBuf`s -pub fn list_dir(dir_path: &str, config: &ListDirConfig) -> Vec { - let paths = Arc::new(Mutex::new(Vec::new())); - - WalkBuilder::new(dir_path) - .hidden(config.hidden) - .git_ignore(config.respect_ignore) - .build_parallel() - .run(|| { - let paths = Arc::clone(&paths); - - Box::new(move |entry| { - let entry = if config.strict { - match entry { - Ok(entry) => entry, - Err(err) => { - bunt::println!("{$red}Error accessing entry: {:?}{/$}", err); - return WalkState::Quit; - } - } - } else { - match entry { - Ok(entry) => entry, - Err(_) => return WalkState::Continue, - } - }; - - if config.filter_file && !entry.file_type().unwrap().is_file() { - return WalkState::Continue; - } - - let mut paths = paths.lock().unwrap(); - - if config.full_path { - paths.push(entry.path().canonicalize().unwrap()); - } else { - paths.push(entry.path().to_path_buf()); - } - - WalkState::Continue - }) - }); - - // Extract paths from the Mutex - Arc::try_unwrap(paths) - .expect("Failed to unwrap Arc") - .into_inner() - .expect("Failed to extract paths from Mutex") -} - -/// Constructs a vector of `EntryBuilder`s -/// from a `HashMap` of `PathBuf`s -pub fn construct_entry_builders(map: &HashMap) -> Vec { - let mut builders = Vec::new(); - - for (name, path) in map { - let builder = EntryBuilder::new(name, path.to_str().unwrap(), path.is_dir()); - builders.push(builder); - } - - builders -} - -pub fn wrap_from_entry(entry: &Entry) -> (String, PathBuf) { - (entry.name.clone(), PathBuf::from(entry.path.clone())) -} - -pub fn wrap_from_path(root: &Path, path: &Path) -> (String, PathBuf) { - ( - path.strip_prefix(root) - .unwrap() - .to_str() - .unwrap() - .to_string(), - path.to_path_buf(), - ) -} - -pub fn builder_from_entry(entry: &Entry) -> EntryBuilder { - EntryBuilder { - name: entry.name.clone(), - path: entry.path.clone(), - is_dir: entry.is_dir, - } -} - -/// Strip weird stuff from a path -/// like ./ and / -pub fn strip_weird_stuff(path: &str) -> String { - let mut path = path.to_string(); - - if path.starts_with("./") { - path = path.strip_prefix("./").unwrap().to_string(); - } - - if path.starts_with('/') { - path = path.strip_prefix('/').unwrap().to_string(); - } - - path -} - -/// Directly print a cool splash screen -/// Still a WIP -pub fn _print_splash_screen() { - bunt::println!("{$blue}+-+-+-+{/$}"); - bunt::println!("{$green}Y{$red}(a){/$}NK{/$}"); - bunt::println!("{$yellow}+-+-+-+{/$}"); -} - -/// Checks if a directory is a git repo -pub fn is_git_repo(path: &str) -> bool { - let path = PathBuf::from(path); - let git_path = path.join(".git"); - - git_path.exists() -} - -pub fn parse_range(range: &str) -> (usize, usize) { - let range = range.split(':').collect::>(); - - let start = range[0].parse::().unwrap(); - let end = range[1].parse::().unwrap(); - - (start, end) -}