diff --git a/Cargo.lock b/Cargo.lock index a81b22c..0e257e4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -131,7 +131,7 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -142,20 +142,20 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "async-trait" -version = "0.1.82" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "av1-grain" @@ -269,7 +269,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" dependencies = [ "memchr", - "regex-automata 0.4.7", + "regex-automata 0.4.8", "serde", ] @@ -305,9 +305,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495" [[package]] name = "bytes" -version = "1.7.1" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "camino" @@ -358,9 +358,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.19" +version = "1.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d74707dde2ba56f86ae90effb3b43ddd369504387e718014de010cec7959800" +checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" dependencies = [ "jobserver", "libc", @@ -396,9 +396,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.5.17" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" dependencies = [ "clap_builder", "clap_derive", @@ -406,9 +406,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.17" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" dependencies = [ "anstream", "anstyle", @@ -416,19 +416,19 @@ dependencies = [ "strsim", "terminal_size", "unicase", - "unicode-width 0.1.13", + "unicode-width 0.2.0", ] [[package]] name = "clap_derive" -version = "4.5.13" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -609,7 +609,7 @@ checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" dependencies = [ "bitflags 2.6.0", "crossterm_winapi", - "futures-core", + "filedescriptor", "mio", "parking_lot", "rustix", @@ -665,7 +665,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -676,7 +676,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -690,33 +690,33 @@ dependencies = [ [[package]] name = "derive_builder" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd33f37ee6a119146a1781d3356a7c26028f83d779b2e04ecd45fdc75c76877b" +checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" dependencies = [ "derive_builder_macro", ] [[package]] name = "derive_builder_core" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7431fa049613920234f22c47fdc33e6cf3ee83067091ea4277a3f8c4587aae38" +checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] name = "derive_builder_macro" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4abae7035bf79b9877b779505d8cf3749285b80c43941eda66604841889451dc" +checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -872,6 +872,17 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "filedescriptor" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7199d965852c3bac31f779ef99cbb4537f80e952e2d6aa0ffeb30cce00f4f46e" +dependencies = [ + "libc", + "thiserror", + "winapi", +] + [[package]] name = "filetime" version = "0.2.25" @@ -886,9 +897,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.33" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" +checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" dependencies = [ "crc32fast", "miniz_oxide 0.8.0", @@ -909,6 +920,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -920,9 +937,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -935,9 +952,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -945,15 +962,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -962,38 +979,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -1037,18 +1054,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "getset" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f636605b743120a8d32ed92fc27b6cde1a769f8f936c065151eb66f88ded513c" -dependencies = [ - "proc-macro-error2", - "proc-macro2", - "quote", - "syn 2.0.77", -] - [[package]] name = "gif" version = "0.13.1" @@ -1067,9 +1072,9 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "gix" -version = "0.63.0" +version = "0.66.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "984c5018adfa7a4536ade67990b3ebc6e11ab57b3d6cd9968de0947ca99b4b06" +checksum = "9048b8d1ae2104f045cb37e5c450fc49d5d8af22609386bfc739c11ba88995eb" dependencies = [ "gix-actor", "gix-commitgraph", @@ -1084,7 +1089,6 @@ dependencies = [ "gix-hashtable", "gix-index", "gix-lock", - "gix-macros", "gix-object", "gix-odb", "gix-pack", @@ -1109,9 +1113,9 @@ dependencies = [ [[package]] name = "gix-actor" -version = "0.31.5" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0e454357e34b833cc3a00b6efbbd3dd4d18b24b9fb0c023876ec2645e8aa3f2" +checksum = "fc19e312cd45c4a66cd003f909163dc2f8e1623e30a0c0c6df3776e89b308665" dependencies = [ "bstr", "gix-date", @@ -1155,9 +1159,9 @@ dependencies = [ [[package]] name = "gix-config" -version = "0.37.0" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fafe42957e11d98e354a66b6bd70aeea00faf2f62dd11164188224a507c840" +checksum = "78e797487e6ca3552491de1131b4f72202f282fb33f198b1c34406d765b42bb0" dependencies = [ "bstr", "gix-config-value", @@ -1189,21 +1193,21 @@ dependencies = [ [[package]] name = "gix-date" -version = "0.8.7" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eed6931f21491ee0aeb922751bd7ec97b4b2fe8fbfedcb678e2a2dce5f3b8c0" +checksum = "35c84b7af01e68daf7a6bb8bb909c1ff5edb3ce4326f1f43063a5a96d3c3c8a5" dependencies = [ "bstr", "itoa", + "jiff", "thiserror", - "time", ] [[package]] name = "gix-diff" -version = "0.44.1" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1996d5c8a305b59709467d80617c9fde48d9d75fd1f4179ea970912630886c9d" +checksum = "92c9afd80fff00f8b38b1c1928442feb4cd6d2232a6ed806b6b193151a3d336c" dependencies = [ "bstr", "gix-hash", @@ -1213,9 +1217,9 @@ dependencies = [ [[package]] name = "gix-discover" -version = "0.32.0" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc27c699b63da66b50d50c00668bc0b7e90c3a382ef302865e891559935f3dbf" +checksum = "0577366b9567376bc26e815fd74451ebd0e6218814e242f8e5b7072c58d956d2" dependencies = [ "bstr", "dunce", @@ -1292,9 +1296,9 @@ dependencies = [ [[package]] name = "gix-index" -version = "0.33.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a9a44eb55bd84bb48f8a44980e951968ced21e171b22d115d1cdcef82a7d73f" +checksum = "0cd4203244444017682176e65fd0180be9298e58ed90bd4a8489a357795ed22d" dependencies = [ "bitflags 2.6.0", "bstr", @@ -1329,22 +1333,11 @@ dependencies = [ "thiserror", ] -[[package]] -name = "gix-macros" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "999ce923619f88194171a67fb3e6d613653b8d4d6078b529b15a765da0edcc17" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - [[package]] name = "gix-object" -version = "0.42.3" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25da2f46b4e7c2fa7b413ce4dffb87f69eaf89c2057e386491f4c55cadbfe386" +checksum = "2f5b801834f1de7640731820c2df6ba88d95480dc4ab166a5882f8ff12b88efa" dependencies = [ "bstr", "gix-actor", @@ -1361,9 +1354,9 @@ dependencies = [ [[package]] name = "gix-odb" -version = "0.61.1" +version = "0.63.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20d384fe541d93d8a3bb7d5d5ef210780d6df4f50c4e684ccba32665a5e3bc9b" +checksum = "a3158068701c17df54f0ab2adda527f5a6aca38fd5fd80ceb7e3c0a2717ec747" dependencies = [ "arc-swap", "gix-date", @@ -1381,9 +1374,9 @@ dependencies = [ [[package]] name = "gix-pack" -version = "0.51.1" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e0594491fffe55df94ba1c111a6566b7f56b3f8d2e1efc750e77d572f5f5229" +checksum = "3223aa342eee21e1e0e403cad8ae9caf9edca55ef84c347738d10681676fd954" dependencies = [ "clru", "gix-chunk", @@ -1423,12 +1416,11 @@ dependencies = [ [[package]] name = "gix-ref" -version = "0.44.1" +version = "0.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3394a2997e5bc6b22ebc1e1a87b41eeefbcfcff3dbfa7c4bd73cb0ac8f1f3e2e" +checksum = "ae0d8406ebf9aaa91f55a57f053c5a1ad1a39f60fdf0303142b7be7ea44311e5" dependencies = [ "gix-actor", - "gix-date", "gix-features", "gix-fs", "gix-hash", @@ -1445,9 +1437,9 @@ dependencies = [ [[package]] name = "gix-refspec" -version = "0.23.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6868f8cd2e62555d1f7c78b784bece43ace40dd2a462daf3b588d5416e603f37" +checksum = "ebb005f82341ba67615ffdd9f7742c87787544441c88090878393d0682869ca6" dependencies = [ "bstr", "gix-hash", @@ -1459,9 +1451,9 @@ dependencies = [ [[package]] name = "gix-revision" -version = "0.27.2" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01b13e43c2118c4b0537ddac7d0821ae0dfa90b7b8dbf20c711e153fb749adce" +checksum = "ba4621b219ac0cdb9256883030c3d56a6c64a6deaa829a92da73b9a576825e1e" dependencies = [ "bstr", "gix-date", @@ -1475,9 +1467,9 @@ dependencies = [ [[package]] name = "gix-revwalk" -version = "0.13.2" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b030ccaab71af141f537e0225f19b9e74f25fefdba0372246b844491cab43e0" +checksum = "b41e72544b93084ee682ef3d5b31b1ba4d8fa27a017482900e5e044d5b1b3984" dependencies = [ "gix-commitgraph", "gix-date", @@ -1523,9 +1515,9 @@ checksum = "6cae0e8661c3ff92688ce1c8b8058b3efb312aba9492bbe93661a21705ab431b" [[package]] name = "gix-traverse" -version = "0.39.2" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e499a18c511e71cf4a20413b743b9f5bcf64b3d9e81e9c3c6cd399eae55a8840" +checksum = "030da39af94e4df35472e9318228f36530989327906f38e27807df305fccb780" dependencies = [ "bitflags 2.6.0", "gix-commitgraph", @@ -1564,9 +1556,9 @@ dependencies = [ [[package]] name = "gix-validate" -version = "0.8.5" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82c27dd34a49b1addf193c92070bcbf3beaf6e10f16a78544de6372e146a0acf" +checksum = "81f2badbb64e57b404593ee26b752c26991910fd0d81fe6f9a71c1a8309b6c86" dependencies = [ "bstr", "thiserror", @@ -1581,8 +1573,8 @@ dependencies = [ "aho-corasick", "bstr", "log", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", ] [[package]] @@ -1611,6 +1603,23 @@ dependencies = [ "allocator-api2", ] +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "heck" version = "0.5.0" @@ -1634,9 +1643,9 @@ dependencies = [ [[package]] name = "human-panic" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c5a08ed290eac04006e21e63d32e90086b6182c7cd0452d10f4264def1fec9a" +checksum = "80b84a66a325082740043a6c28bbea400c129eac0d3a27673a1de971e44bf1f7" dependencies = [ "anstream", "anstyle", @@ -1680,7 +1689,7 @@ dependencies = [ "globset", "log", "memchr", - "regex-automata 0.4.7", + "regex-automata 0.4.8", "same-file", "walkdir", "winapi-util", @@ -1725,6 +1734,18 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44feda355f4159a7c757171a77de25daf6411e217b4cabd03bd6650690468126" +[[package]] +name = "impl-enum" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fd48df611bdfc457ea8c24c8c26e5c9d64857454fa8221da7db463d134371f3" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "indenter" version = "0.3.3" @@ -1733,12 +1754,12 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown 0.15.0", ] [[package]] @@ -1757,7 +1778,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b23a0c8dfe501baac4adf6ebbfa6eddf8f0c07f56b058cc1288017e32397846c" dependencies = [ "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1768,7 +1789,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1801,6 +1822,31 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +[[package]] +name = "jiff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a45489186a6123c128fdf6016183fcfab7113e1820eb813127e036e287233fb" +dependencies = [ + "jiff-tzdb-platform", + "windows-sys 0.59.0", +] + +[[package]] +name = "jiff-tzdb" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91335e575850c5c4c673b9bd467b0e025f164ca59d0564f69d0c2ee0ffad4653" + +[[package]] +name = "jiff-tzdb-platform" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9835f0060a626fe59f160437bc725491a6af23133ea906500027d1bd2f8f4329" +dependencies = [ + "jiff-tzdb", +] + [[package]] name = "jobserver" version = "0.1.32" @@ -1841,9 +1887,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "libc" -version = "0.2.158" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libfuzzer-sys" @@ -1906,11 +1952,11 @@ dependencies = [ [[package]] name = "lru" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" +checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" dependencies = [ - "hashbrown 0.14.5", + "hashbrown 0.15.0", ] [[package]] @@ -2061,7 +2107,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2113,9 +2159,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ea5043e58958ee56f3e15a90aee535795cd7dfd319846288d93c5b57d85cbe" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "onig" @@ -2209,9 +2255,9 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pathdiff" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +checksum = "d61c5ce1153ab5b689d0c074c4e7fc613e942dfb7dd9eea5ab202d2ad91fe361" [[package]] name = "percent-encoding" @@ -2221,9 +2267,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.12" +version = "2.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c73c26c01b8c87956cea613c907c9d6ecffd8d18a2a5908e5de0adfaa185cea" +checksum = "fdbef9d1d47087a895abd220ed25eb4ad973a5e26f6a4367b038c25e28dfc2d9" dependencies = [ "memchr", "thiserror", @@ -2232,9 +2278,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.12" +version = "2.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "664d22978e2815783adbdd2c588b455b1bd625299ce36b2a99881ac9627e6d8d" +checksum = "4d3a6e3394ec80feb3b6393c725571754c6188490265c61aaf260810d6b95aa0" dependencies = [ "pest", "pest_generator", @@ -2242,22 +2288,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.12" +version = "2.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2d5487022d5d33f4c30d91c22afa240ce2a644e87fe08caad974d4eab6badbe" +checksum = "94429506bde1ca69d1b5601962c73f4172ab4726571a59ea95931218cb0e930e" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] name = "pest_meta" -version = "2.7.12" +version = "2.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0091754bbd0ea592c4deb3a122ce8ecbb0753b738aa82bc055fcc2eccc8d8174" +checksum = "ac8a071862e93690b6e34e9a5fb8e33ff3734473ac0245b27232222c4906a33f" dependencies = [ "once_cell", "pest", @@ -2333,33 +2379,11 @@ dependencies = [ "yansi", ] -[[package]] -name = "proc-macro-error-attr2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" -dependencies = [ - "proc-macro2", - "quote", -] - -[[package]] -name = "proc-macro-error2" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" -dependencies = [ - "proc-macro-error-attr2", - "proc-macro2", - "quote", - "syn 2.0.77", -] - [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" dependencies = [ "unicode-ident", ] @@ -2386,7 +2410,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd" dependencies = [ "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2471,7 +2495,7 @@ dependencies = [ "strum_macros", "unicode-segmentation", "unicode-truncate", - "unicode-width 0.1.13", + "unicode-width 0.1.14", ] [[package]] @@ -2560,9 +2584,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.4" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags 2.6.0", ] @@ -2580,14 +2604,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.6" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", ] [[package]] @@ -2601,13 +2625,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", ] [[package]] @@ -2618,9 +2642,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rgb" @@ -2725,7 +2749,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2742,9 +2766,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -2896,11 +2920,11 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", "rustversion", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2916,9 +2940,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.77" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -2938,7 +2962,7 @@ dependencies = [ "once_cell", "onig", "plist", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", "serde", "serde_derive", "serde_json", @@ -2954,7 +2978,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" dependencies = [ "cfg-expr", - "heck", + "heck 0.5.0", "pkg-config", "toml", "version-compare", @@ -2966,6 +2990,15 @@ version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" +[[package]] +name = "television-derive" +version = "0.1.0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "television-rs" version = "0.1.0" @@ -2984,6 +3017,7 @@ dependencies = [ "human-panic", "ignore", "image", + "impl-enum", "infer", "json5", "lazy_static", @@ -3001,6 +3035,7 @@ dependencies = [ "strip-ansi-escapes", "strum", "syntect", + "television-derive", "tokio", "tokio-stream", "tokio-util", @@ -3014,9 +3049,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ "cfg-if", "fastrand", @@ -3027,32 +3062,32 @@ dependencies = [ [[package]] name = "terminal_size" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +checksum = "4f599bd7ca042cfdf8f4512b277c02ba102247820f9d9d4a9f521f496751a6ef" dependencies = [ "rustix", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3159,7 +3194,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3209,9 +3244,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.20" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", "serde", @@ -3239,7 +3274,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3300,9 +3335,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "ucd-trie" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] name = "unicase" @@ -3315,9 +3350,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-bom" @@ -3333,9 +3368,9 @@ checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] @@ -3354,14 +3389,14 @@ checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf" dependencies = [ "itertools 0.13.0", "unicode-segmentation", - "unicode-width 0.1.13", + "unicode-width 0.1.14", ] [[package]] name = "unicode-width" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "unicode-width" @@ -3414,14 +3449,13 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "vergen" -version = "9.0.0" +version = "9.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c32e7318e93a9ac53693b6caccfb05ff22e04a44c7cf8a279051f24c09da286f" +checksum = "349ed9e45296a581f455bc18039878f409992999bc1d5da12a6800eb18c8752f" dependencies = [ "anyhow", "cargo_metadata", "derive_builder", - "getset", "regex", "rustversion", "time", @@ -3430,9 +3464,9 @@ dependencies = [ [[package]] name = "vergen-gix" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e353ce10596ac5821aaf76e4952360f6d08d3ece9498564d066167bb0f437c94" +checksum = "02ef5d49e57c96e025770171c1c7ee0e30cd6f712f21a1fe501a58be6d069192" dependencies = [ "anyhow", "derive_builder", @@ -3445,13 +3479,12 @@ dependencies = [ [[package]] name = "vergen-lib" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e06bee42361e43b60f363bad49d63798d0f42fb1768091812270eca00c784720" +checksum = "229eaddb0050920816cf051e619affaf18caa3dd512de8de5839ccbc8e53abb0" dependencies = [ "anyhow", "derive_builder", - "getset", "rustversion", ] @@ -3505,9 +3538,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -3516,24 +3549,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3541,22 +3574,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "weezl" @@ -3745,9 +3778,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] @@ -3785,7 +3818,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index e472f52..a58168b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,9 +16,19 @@ categories = [ ] +[[bin]] +bench = false +path = "crates/television/main.rs" +name = "tv" + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[workspace] +members = [ + "crates/television_derive", +] [dependencies] +television-derive = { path = "crates/television_derive" } better-panic = "0.3.0" clap = { version = "4.4.5", features = [ "derive", @@ -30,7 +40,7 @@ clap = { version = "4.4.5", features = [ ] } color-eyre = "0.6.3" config = "0.14.0" -crossterm = { version = "0.28.1", features = ["serde", "event-stream"] } +crossterm = { version = "0.28.1", features = ["serde"] } derive_deref = "1.1.1" devicons = "0.5.4" directories = "5.0.1" @@ -39,6 +49,7 @@ fuzzy-matcher = "0.3.7" human-panic = "2.0.1" ignore = "0.4.23" image = "0.25.2" +impl-enum = "0.3.1" infer = "0.16.0" json5 = "0.4.1" lazy_static = "1.5.0" @@ -81,3 +92,5 @@ overflow-checks = false lto = "thin" panic = "abort" +[target.'cfg(target_os = "macos")'.dependencies] +crossterm = { version = "0.28.1", features = ["serde", "use-dev-tty"] } diff --git a/TODO.md b/TODO.md index a780962..be6a753 100644 --- a/TODO.md +++ b/TODO.md @@ -2,8 +2,9 @@ - [x] preview navigation - [ ] add a way to open the selected file in the default editor - [x] maybe filter out image types etc. for now -- [ ] return selected entry on exit -- [ ] piping custom entries from stdin (e.g. `ls | tv`, what bout choosing previewers in that case? Some AUTO mode?) +- [x] return selected entry on exit +- [x] piping output to another command +- [x] piping custom entries from stdin (e.g. `ls | tv`, what bout choosing previewers in that case? Some AUTO mode?) ## bugs - [x] sanitize input (tabs, \0, etc) (see https://github.com/autobib/nucleo-picker/blob/d51dec9efd523e88842c6eda87a19c0a492f4f36/src/lib.rs#L212-L227) diff --git a/src/action.rs b/crates/television/action.rs similarity index 100% rename from src/action.rs rename to crates/television/action.rs diff --git a/src/app.rs b/crates/television/app.rs similarity index 89% rename from src/app.rs rename to crates/television/app.rs index 50b2ec7..26f6ab1 100644 --- a/src/app.rs +++ b/crates/television/app.rs @@ -57,7 +57,7 @@ use tracing::{debug, info}; use crate::{ action::Action, - cli::UnitTvChannel, + cli::CliTvChannel, components::{television::Television, Component, Entry}, config::Config, event::{Event, EventLoop, Key}, @@ -82,7 +82,9 @@ pub struct App { render_tx: mpsc::UnboundedSender, } -#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[derive( + Default, Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, +)] pub enum Mode { #[default] Help, @@ -92,7 +94,11 @@ pub enum Mode { } impl App { - pub fn new(channel: UnitTvChannel, tick_rate: f64, frame_rate: f64) -> Result { + pub fn new( + channel: CliTvChannel, + tick_rate: f64, + frame_rate: f64, + ) -> Result { let (action_tx, action_rx) = mpsc::unbounded_channel(); let (render_tx, _) = mpsc::unbounded_channel(); let (_, event_rx) = mpsc::unbounded_channel(); @@ -115,7 +121,7 @@ impl App { }) } - pub async fn run(&mut self) -> Result> { + pub async fn run(&mut self, is_output_tty: bool) -> Result> { info!("Starting backend event loop"); let event_loop = EventLoop::new(self.tick_rate, true); self.event_rx = event_loop.rx; @@ -129,7 +135,7 @@ impl App { let config_r = self.config.clone(); let television_r = self.television.clone(); let frame_rate = self.frame_rate; - tokio::spawn(async move { + let rendering_task = tokio::spawn(async move { render( render_rx, //render_tx, @@ -137,6 +143,7 @@ impl App { config_r, television_r, frame_rate, + is_output_tty, ) .await }); @@ -156,6 +163,10 @@ impl App { if self.should_quit { // send a termination signal to the event loop self.event_abort_tx.send(())?; + + // wait for the rendering task to finish + rendering_task.await??; + return Ok(maybe_selected); } } @@ -174,8 +185,12 @@ impl App { Key::Delete => return Action::DeleteNextChar, Key::Left => return Action::GoToPrevChar, Key::Right => return Action::GoToNextChar, - Key::Home | Key::Ctrl('a') => return Action::GoToInputStart, - Key::End | Key::Ctrl('e') => return Action::GoToInputEnd, + Key::Home | Key::Ctrl('a') => { + return Action::GoToInputStart + } + Key::End | Key::Ctrl('e') => { + return Action::GoToInputEnd + } Key::Char(c) => return Action::AddInputChar(c), _ => {} } @@ -221,14 +236,26 @@ impl App { Action::SelectEntry => { self.should_quit = true; self.render_tx.send(RenderingTask::Quit)?; - return Ok(self.television.lock().await.get_selected_entry()); + return Ok(self + .television + .lock() + .await + .get_selected_entry()); + } + Action::ClearScreen => { + self.render_tx.send(RenderingTask::ClearScreen)? + } + Action::Resize(w, h) => { + self.render_tx.send(RenderingTask::Resize(w, h))? + } + Action::Render => { + self.render_tx.send(RenderingTask::Render)? } - Action::ClearScreen => self.render_tx.send(RenderingTask::ClearScreen)?, - Action::Resize(w, h) => self.render_tx.send(RenderingTask::Resize(w, h))?, - Action::Render => self.render_tx.send(RenderingTask::Render)?, _ => {} } - if let Some(action) = self.television.lock().await.update(action.clone()).await? { + if let Some(action) = + self.television.lock().await.update(action.clone()).await? + { self.action_tx.send(action)?; }; } diff --git a/src/cli.rs b/crates/television/cli.rs similarity index 90% rename from src/cli.rs rename to crates/television/cli.rs index 09f4ea2..82b8d39 100644 --- a/src/cli.rs +++ b/crates/television/cli.rs @@ -3,19 +3,21 @@ use clap::{Parser, ValueEnum}; use crate::config::{get_config_dir, get_data_dir}; #[derive(Clone, ValueEnum, Debug, Default, Copy)] -pub enum UnitTvChannel { - #[default] +pub enum CliTvChannel { Env, + #[default] Files, Grep, + Stdin, + Alias, } #[derive(Parser, Debug)] #[command(author, version = version(), about)] pub struct Cli { /// Which channel shall we watch? - #[arg(value_enum)] - pub channel: UnitTvChannel, + #[arg(value_enum, default_value = "files")] + pub channel: CliTvChannel, /// Tick rate, i.e. number of ticks per second #[arg(short, long, value_name = "FLOAT", default_value_t = 50.0)] diff --git a/src/components.rs b/crates/television/components.rs similarity index 95% rename from src/components.rs rename to crates/television/components.rs index b7acc08..d4ee52f 100644 --- a/src/components.rs +++ b/crates/television/components.rs @@ -32,7 +32,10 @@ pub trait Component: Send { /// # Returns /// /// * `Result<()>` - An Ok result or an error. - fn register_action_handler(&mut self, tx: UnboundedSender) -> Result<()> { + fn register_action_handler( + &mut self, + tx: UnboundedSender, + ) -> Result<()> { let _ = tx; // to appease clippy Ok(()) } diff --git a/crates/television/components/channels.rs b/crates/television/components/channels.rs new file mode 100644 index 0000000..7ebdd90 --- /dev/null +++ b/crates/television/components/channels.rs @@ -0,0 +1,41 @@ +use crate::cli::CliTvChannel; +use crate::components::finders::Entry; +use crate::components::finders::{ + AliasFinder, EnvVarFinder, FileFinder, GrepFinder, StdinFinder, +}; + +use super::finders::Finder; + +#[derive(television_derive::Channel, television_derive::FromCliChannel)] +pub enum TvChannel { + Env(EnvChannel), + Files(FilesChannel), + Grep(GrepChannel), + Stdin(StdinChannel), + Alias(AliasChannel), +} + +#[derive(television_derive::ConcreteChannel)] +pub struct EnvChannel { + pub finder: EnvVarFinder, +} + +#[derive(television_derive::ConcreteChannel)] +pub struct FilesChannel { + pub finder: FileFinder, +} + +#[derive(television_derive::ConcreteChannel)] +pub struct GrepChannel { + pub finder: GrepFinder, +} + +#[derive(television_derive::ConcreteChannel)] +pub struct StdinChannel { + pub finder: StdinFinder, +} + +#[derive(television_derive::ConcreteChannel)] +pub struct AliasChannel { + pub finder: AliasFinder, +} diff --git a/src/components/finders.rs b/crates/television/components/finders.rs similarity index 83% rename from src/components/finders.rs rename to crates/television/components/finders.rs index 45de7b2..87f504c 100644 --- a/src/components/finders.rs +++ b/crates/television/components/finders.rs @@ -1,13 +1,17 @@ use devicons::FileIcon; +mod alias; mod env; mod files; mod grep; +mod stdin; // finder types +pub use alias::AliasFinder; pub use env::EnvVarFinder; pub use files::FileFinder; pub use grep::GrepFinder; +pub use stdin::StdinFinder; use super::previewers::PreviewType; @@ -31,10 +35,10 @@ impl Entry { pub fn stdout_repr(&self) -> String { let mut repr = self.name.clone(); if let Some(line_number) = self.line_number { - repr.push_str(&format!(":{}", line_number)); + repr.push_str(&format!(":{line_number}")); } if let Some(preview) = &self.preview { - repr.push_str(&format!("\n{}", preview)); + repr.push_str(&format!("\n{preview}")); } repr } @@ -59,7 +63,11 @@ pub const ENTRY_PLACEHOLDER: Entry = Entry { pub trait Finder { fn find(&mut self, pattern: &str); - fn results(&mut self, num_entries: u32, offset: u32) -> impl Iterator; + fn results( + &mut self, + num_entries: u32, + offset: u32, + ) -> impl Iterator; fn get_result(&self, index: u32) -> Option; diff --git a/crates/television/components/finders/alias.rs b/crates/television/components/finders/alias.rs new file mode 100644 index 0000000..30da2fe --- /dev/null +++ b/crates/television/components/finders/alias.rs @@ -0,0 +1,221 @@ +use std::sync::Arc; + +use devicons::FileIcon; +use nucleo::{Config, Nucleo}; +use tracing::debug; + +use crate::components::{ + finders::{Entry, Finder}, + fuzzy::MATCHER, + previewers::PreviewType, + utils::indices::sep_name_and_value_indices, +}; + +#[derive(Debug, Clone)] +struct Alias { + name: String, + value: String, +} + +pub struct AliasFinder { + matcher: Nucleo, + last_pattern: String, + file_icon: FileIcon, + result_count: u32, + total_count: u32, +} + +const NUM_THREADS: usize = 1; + +const FILE_ICON_STR: &str = "nu"; +const SHELL_ENV_VAR: &str = "SHELL"; + +fn get_current_shell() -> Option { + std::env::var(SHELL_ENV_VAR).ok() +} + +fn get_raw_aliases(shell: &str) -> Vec { + match shell { + "bash" => { + let output = std::process::Command::new("bash") + .arg("-i") + .arg("-c") + .arg("alias") + .output() + .expect("failed to execute process"); + let aliases = String::from_utf8(output.stdout).unwrap(); + aliases + .lines() + .map(std::string::ToString::to_string) + .collect() + } + "zsh" => { + let output = std::process::Command::new("zsh") + .arg("-i") + .arg("-c") + .arg("alias") + .output() + .expect("failed to execute process"); + let aliases = String::from_utf8(output.stdout).unwrap(); + aliases + .lines() + .map(std::string::ToString::to_string) + .collect() + } + _ => Vec::new(), + } +} + +impl AliasFinder { + pub fn new() -> Self { + let raw_shell = get_current_shell().unwrap_or("bash".to_string()); + let shell = raw_shell.split('/').last().unwrap(); + debug!("Current shell: {}", shell); + let raw_aliases = get_raw_aliases(shell); + debug!("Aliases: {:?}", raw_aliases); + + let parsed_aliases = raw_aliases + .iter() + .map(|alias| { + let mut parts = alias.split('='); + let name = parts.next().unwrap().to_string(); + let value = parts.next().unwrap().to_string(); + Alias { name, value } + }) + .collect::>(); + + let matcher = Nucleo::new( + Config::DEFAULT, + Arc::new(|| {}), + Some(NUM_THREADS), + 1, + ); + let injector = matcher.injector(); + + for alias in parsed_aliases { + let _ = injector.push(alias.clone(), |_, cols| { + cols[0] = (alias.name.clone() + &alias.value).into(); + }); + } + + Self { + matcher, + last_pattern: String::new(), + file_icon: FileIcon::from(FILE_ICON_STR), + result_count: 0, + total_count: 0, + } + } + + const MATCHER_TICK_TIMEOUT: u64 = 10; +} + +impl Finder for AliasFinder { + // maybe this could be sort of automatic with a blanket impl (making Finder generic over + // its matcher type or something) + fn find(&mut self, pattern: &str) { + if pattern != self.last_pattern { + self.matcher.pattern.reparse( + 0, + pattern, + nucleo::pattern::CaseMatching::Smart, + nucleo::pattern::Normalization::Smart, + pattern.starts_with(&self.last_pattern), + ); + self.last_pattern = pattern.to_string(); + } + } + + fn results( + &mut self, + num_entries: u32, + offset: u32, + ) -> impl Iterator { + let status = self.matcher.tick(Self::MATCHER_TICK_TIMEOUT); + let snapshot = self.matcher.snapshot(); + if status.changed { + self.result_count = snapshot.matched_item_count(); + self.total_count = snapshot.item_count(); + } + let mut col_indices = Vec::new(); + let mut matcher = MATCHER.lock(); + let icon = self.file_icon; + + snapshot + .matched_items( + offset + ..(num_entries + offset) + .min(snapshot.matched_item_count()), + ) + .map(move |item| { + snapshot.pattern().column_pattern(0).indices( + item.matcher_columns[0].slice(..), + &mut matcher, + &mut col_indices, + ); + col_indices.sort_unstable(); + col_indices.dedup(); + + let ( + name_indices, + value_indices, + should_add_name_indices, + should_add_value_indices, + ) = sep_name_and_value_indices( + &mut col_indices, + u32::try_from(item.data.name.len()).unwrap(), + ); + + Entry { + name: item.data.name.clone(), + display_name: None, + preview: Some(item.data.value.clone()), + name_match_ranges: if should_add_name_indices { + Some( + name_indices + .into_iter() + .map(|i| (i, i + 1)) + .collect(), + ) + } else { + None + }, + preview_match_ranges: if should_add_value_indices { + Some( + value_indices + .into_iter() + .map(|i| (i, i + 1)) + .collect(), + ) + } else { + None + }, + icon: Some(icon), + line_number: None, + preview_type: PreviewType::EnvVar, + } + }) + } + + fn get_result(&self, index: u32) -> Option { + let snapshot = self.matcher.snapshot(); + snapshot.get_matched_item(index).map(|item| Entry { + name: item.data.name.clone(), + display_name: None, + preview: Some(item.data.value.clone()), + name_match_ranges: None, + preview_match_ranges: None, + icon: Some(self.file_icon), + line_number: None, + preview_type: PreviewType::EnvVar, + }) + } + + fn result_count(&self) -> u32 { + self.result_count + } + + fn total_count(&self) -> u32 { + self.total_count + } +} diff --git a/src/components/finders/env.rs b/crates/television/components/finders/env.rs similarity index 74% rename from src/components/finders/env.rs rename to crates/television/components/finders/env.rs index c7cd121..186457c 100644 --- a/src/components/finders/env.rs +++ b/crates/television/components/finders/env.rs @@ -9,6 +9,7 @@ use crate::components::{ finders::{Entry, Finder}, fuzzy::MATCHER, previewers::PreviewType, + utils::indices::sep_name_and_value_indices, }; struct EnvVar { @@ -30,7 +31,12 @@ const FILE_ICON_STR: &str = "config"; impl EnvVarFinder { pub fn new() -> Self { - let matcher = Nucleo::new(Config::DEFAULT, Arc::new(|| {}), Some(NUM_THREADS), 2); + let matcher = Nucleo::new( + Config::DEFAULT, + Arc::new(|| {}), + Some(NUM_THREADS), + 2, + ); let injector = matcher.injector(); for (name, value) in std::env::vars() { let _ = injector.push(EnvVar { name, value }, |e, cols| { @@ -71,7 +77,11 @@ impl Finder for EnvVarFinder { self.total_count } - fn results(&mut self, num_entries: u32, offset: u32) -> impl Iterator { + fn results( + &mut self, + num_entries: u32, + offset: u32, + ) -> impl Iterator { let status = self.matcher.tick(Self::MATCHER_TICK_TIMEOUT); let snapshot = self.matcher.snapshot(); if status.changed { @@ -83,7 +93,11 @@ impl Finder for EnvVarFinder { let icon = self.file_icon; snapshot - .matched_items(offset..(num_entries + offset).min(snapshot.matched_item_count())) + .matched_items( + offset + ..(num_entries + offset) + .min(snapshot.matched_item_count()), + ) .map(move |item| { snapshot.pattern().column_pattern(0).indices( item.matcher_columns[0].slice(..), @@ -108,18 +122,28 @@ impl Finder for EnvVarFinder { display_name: None, preview: Some(item.data.value.clone()), name_match_ranges: if should_add_name_indices { - Some(name_indices.into_iter().map(|i| (i, i + 1)).collect()) + Some( + name_indices + .into_iter() + .map(|i| (i, i + 1)) + .collect(), + ) } else { None }, preview_match_ranges: if should_add_value_indices { - Some(value_indices.into_iter().map(|i| (i, i + 1)).collect()) + Some( + value_indices + .into_iter() + .map(|i| (i, i + 1)) + .collect(), + ) } else { None }, icon: Some(icon), line_number: None, - preview_type: PreviewType::Files, + preview_type: PreviewType::EnvVar, } }) } @@ -135,42 +159,10 @@ impl Finder for EnvVarFinder { preview: Some(value), name_match_ranges: None, preview_match_ranges: None, - icon: None, + icon: Some(self.file_icon), line_number: None, preview_type: PreviewType::EnvVar, } }) } } - -fn sep_name_and_value_indices( - indices: &mut Vec, - name_len: u32, -) -> (Vec, Vec, bool, bool) { - let mut name_indices = Vec::new(); - let mut value_indices = Vec::new(); - let mut should_add_name_indices = false; - let mut should_add_value_indices = false; - - for i in indices.drain(..) { - if i < name_len { - name_indices.push(i); - should_add_name_indices = true; - } else { - value_indices.push(i - name_len); - should_add_value_indices = true; - } - } - - name_indices.sort_unstable(); - name_indices.dedup(); - value_indices.sort_unstable(); - value_indices.dedup(); - - ( - name_indices, - value_indices, - should_add_name_indices, - should_add_value_indices, - ) -} diff --git a/src/components/finders/files.rs b/crates/television/components/finders/files.rs similarity index 87% rename from src/components/finders/files.rs rename to crates/television/components/finders/files.rs index d8350d3..1695ed3 100644 --- a/src/components/finders/files.rs +++ b/crates/television/components/finders/files.rs @@ -23,7 +23,12 @@ pub struct FileFinder { impl FileFinder { pub fn new() -> Self { - let matcher = Nucleo::new(Config::DEFAULT.match_paths(), Arc::new(|| {}), None, 1); + let matcher = Nucleo::new( + Config::DEFAULT.match_paths(), + Arc::new(|| {}), + None, + 1, + ); // start loading files in the background tokio::spawn(load_files( std::env::current_dir().unwrap(), @@ -62,7 +67,11 @@ impl Finder for FileFinder { self.total_count } - fn results(&mut self, num_entries: u32, offset: u32) -> impl Iterator { + fn results( + &mut self, + num_entries: u32, + offset: u32, + ) -> impl Iterator { let status = self.matcher.tick(Self::MATCHER_TICK_TIMEOUT); let snapshot = self.matcher.snapshot(); if status.changed { @@ -73,7 +82,11 @@ impl Finder for FileFinder { let mut matcher = MATCHER.lock(); snapshot - .matched_items(offset..(num_entries + offset).min(snapshot.matched_item_count())) + .matched_items( + offset + ..(num_entries + offset) + .min(snapshot.matched_item_count()), + ) .map(move |item| { snapshot.pattern().column_pattern(0).indices( item.matcher_columns[0].slice(..), @@ -89,7 +102,9 @@ impl Finder for FileFinder { name: path.clone(), display_name: None, preview: None, - name_match_ranges: Some(indices.map(|i| (i, i + 1)).collect()), + name_match_ranges: Some( + indices.map(|i| (i, i + 1)).collect(), + ), preview_match_ranges: None, icon: Some(FileIcon::from(&path)), line_number: None, diff --git a/src/components/finders/grep.rs b/crates/television/components/finders/grep.rs similarity index 80% rename from src/components/finders/grep.rs rename to crates/television/components/finders/grep.rs index 2dc04db..5780579 100644 --- a/src/components/finders/grep.rs +++ b/crates/television/components/finders/grep.rs @@ -17,7 +17,9 @@ use crate::components::{ fuzzy::MATCHER, previewers::PreviewType, utils::{ - files::{is_not_text, is_valid_utf8, walk_builder, DEFAULT_NUM_THREADS}, + files::{ + is_not_text, is_valid_utf8, walk_builder, DEFAULT_NUM_THREADS, + }, strings::preprocess_line, }, }; @@ -88,7 +90,11 @@ impl Finder for GrepFinder { self.total_count } - fn results(&mut self, num_entries: u32, offset: u32) -> impl Iterator { + fn results( + &mut self, + num_entries: u32, + offset: u32, + ) -> impl Iterator { let status = self.matcher.tick(Self::MATCHER_TICK_TIMEOUT); let snapshot = self.matcher.snapshot(); if status.changed { @@ -99,7 +105,11 @@ impl Finder for GrepFinder { let mut matcher = MATCHER.lock(); snapshot - .matched_items(offset..(num_entries + offset).min(snapshot.matched_item_count())) + .matched_items( + offset + ..(num_entries + offset) + .min(snapshot.matched_item_count()), + ) .map(move |item| { snapshot.pattern().column_pattern(0).indices( item.matcher_columns[0].slice(..), @@ -111,13 +121,17 @@ impl Finder for GrepFinder { let indices = indices.drain(..); let line = item.matcher_columns[0].to_string(); - let display_path = item.data.path.to_string_lossy().to_string(); + let display_path = + item.data.path.to_string_lossy().to_string(); Entry { - name: display_path.clone() + &item.data.line_number.to_string(), + name: display_path.clone() + + &item.data.line_number.to_string(), display_name: Some(display_path), preview: Some(line), name_match_ranges: None, - preview_match_ranges: Some(indices.map(|i| (i, i + 1)).collect()), + preview_match_ranges: Some( + indices.map(|i| (i, i + 1)).collect(), + ), icon: Some(FileIcon::from(item.data.path.as_path())), line_number: Some(item.data.line_number), preview_type: PreviewType::Files, @@ -131,7 +145,11 @@ impl Finder for GrepFinder { let display_path = item.data.path.to_string_lossy().to_string(); Entry { name: display_path.clone(), - display_name: Some(display_path.clone() + ":" + &item.data.line_number.to_string()), + display_name: Some( + display_path.clone() + + ":" + + &item.data.line_number.to_string(), + ), preview: None, name_match_ranges: None, preview_match_ranges: None, @@ -162,12 +180,15 @@ async fn load_candidates(path: PathBuf, injector: Injector) { match reader.read(&mut buffer) { Ok(bytes_read) => { if (bytes_read == 0) - || is_not_text(&buffer).unwrap_or(false) + || is_not_text(&buffer) + .unwrap_or(false) || !is_valid_utf8(&buffer) { return ignore::WalkState::Continue; } - reader.seek(std::io::SeekFrom::Start(0)).unwrap(); + reader + .seek(std::io::SeekFrom::Start(0)) + .unwrap(); } Err(_) => { return ignore::WalkState::Continue; @@ -188,9 +209,13 @@ async fn load_candidates(path: PathBuf, injector: Injector) { line_number, ); // Send the line via the async channel - let _ = injector.push(candidate, |c, cols| { - cols[0] = c.line.clone().into(); - }); + let _ = injector.push( + candidate, + |c, cols| { + cols[0] = + c.line.clone().into(); + }, + ); } Err(e) => { info!("Error reading line: {:?}", e); diff --git a/crates/television/components/finders/stdin.rs b/crates/television/components/finders/stdin.rs new file mode 100644 index 0000000..c901fe7 --- /dev/null +++ b/crates/television/components/finders/stdin.rs @@ -0,0 +1,138 @@ +use std::{io::BufRead, sync::Arc}; + +use devicons::FileIcon; +use nucleo::{Config, Nucleo}; +use tracing::debug; + +use crate::components::finders::Entry; +use crate::components::fuzzy::MATCHER; +use crate::components::previewers::PreviewType; + +use super::Finder; + +pub struct StdinFinder { + matcher: Nucleo, + last_pattern: String, + result_count: u32, + total_count: u32, +} + +const NUM_THREADS: usize = 2; + +impl StdinFinder { + pub fn new() -> Self { + let mut lines = Vec::new(); + for line in std::io::stdin().lock().lines().map_while(Result::ok) { + debug!("Read line: {:?}", line); + lines.push(line); + } + let matcher = Nucleo::new( + Config::DEFAULT, + Arc::new(|| {}), + Some(NUM_THREADS), + 1, + ); + let injector = matcher.injector(); + for line in &lines { + let _ = injector.push(line.clone(), |e, cols| { + cols[0] = e.clone().into(); + }); + } + Self { + matcher, + last_pattern: String::new(), + result_count: 0, + total_count: 0, + } + } + + const MATCHER_TICK_TIMEOUT: u64 = 10; +} + +impl Finder for StdinFinder { + // maybe this could be sort of automatic with a blanket impl (making Finder generic over + // its matcher type or something) + fn find(&mut self, pattern: &str) { + if pattern != self.last_pattern { + self.matcher.pattern.reparse( + 0, + pattern, + nucleo::pattern::CaseMatching::Smart, + nucleo::pattern::Normalization::Smart, + pattern.starts_with(&self.last_pattern), + ); + self.last_pattern = pattern.to_string(); + } + } + + fn results( + &mut self, + num_entries: u32, + offset: u32, + ) -> impl Iterator { + let status = self.matcher.tick(Self::MATCHER_TICK_TIMEOUT); + let snapshot = self.matcher.snapshot(); + if status.changed { + self.result_count = snapshot.matched_item_count(); + self.total_count = snapshot.item_count(); + } + let mut indices = Vec::new(); + let mut matcher = MATCHER.lock(); + + snapshot + .matched_items( + offset + ..(num_entries + offset) + .min(snapshot.matched_item_count()), + ) + .map(move |item| { + snapshot.pattern().column_pattern(0).indices( + item.matcher_columns[0].slice(..), + &mut matcher, + &mut indices, + ); + indices.sort_unstable(); + indices.dedup(); + let indices = indices.drain(..); + + let path = item.matcher_columns[0].to_string(); + Entry { + name: path.clone(), + display_name: None, + preview: None, + name_match_ranges: Some( + indices.map(|i| (i, i + 1)).collect(), + ), + preview_match_ranges: None, + icon: Some(FileIcon::from("nu")), + line_number: None, + preview_type: PreviewType::Basic, + } + }) + } + + fn get_result(&self, index: u32) -> Option { + let snapshot = self.matcher.snapshot(); + snapshot.get_matched_item(index).map(|item| { + let path = item.matcher_columns[0].to_string(); + Entry { + name: path.clone(), + display_name: None, + preview: None, + name_match_ranges: None, + preview_match_ranges: None, + icon: Some(FileIcon::from("nu")), + line_number: None, + preview_type: PreviewType::Basic, + } + }) + } + + fn result_count(&self) -> u32 { + self.result_count + } + + fn total_count(&self) -> u32 { + self.total_count + } +} diff --git a/src/components/fuzzy.rs b/crates/television/components/fuzzy.rs similarity index 62% rename from src/components/fuzzy.rs rename to crates/television/components/fuzzy.rs index c3a9672..5d83f63 100644 --- a/src/components/fuzzy.rs +++ b/crates/television/components/fuzzy.rs @@ -15,8 +15,11 @@ impl LazyMutex { } pub fn lock(&self) -> impl DerefMut + '_ { - parking_lot::MutexGuard::map(self.inner.lock(), |val| val.get_or_insert_with(self.init)) + parking_lot::MutexGuard::map(self.inner.lock(), |val| { + val.get_or_insert_with(self.init) + }) } } -pub static MATCHER: LazyMutex = LazyMutex::new(nucleo::Matcher::default); +pub static MATCHER: LazyMutex = + LazyMutex::new(nucleo::Matcher::default); diff --git a/src/components/input.rs b/crates/television/components/input.rs similarity index 94% rename from src/components/input.rs rename to crates/television/components/input.rs index d301f05..eed1bfa 100644 --- a/src/components/input.rs +++ b/crates/television/components/input.rs @@ -82,9 +82,10 @@ impl Input { #[allow(clippy::too_many_lines)] pub fn handle(&mut self, req: InputRequest) -> InputResponse { use InputRequest::{ - DeleteLine, DeleteNextChar, DeleteNextWord, DeletePrevChar, DeletePrevWord, - DeleteTillEnd, GoToEnd, GoToNextChar, GoToNextWord, GoToPrevChar, GoToPrevWord, - GoToStart, InsertChar, SetCursor, + DeleteLine, DeleteNextChar, DeleteNextWord, DeletePrevChar, + DeletePrevWord, DeleteTillEnd, GoToEnd, GoToNextChar, + GoToNextWord, GoToPrevChar, GoToPrevWord, GoToStart, InsertChar, + SetCursor, }; match req { SetCursor(pos) => { @@ -107,7 +108,10 @@ impl Input { .value .chars() .take(self.cursor) - .chain(std::iter::once(c).chain(self.value.chars().skip(self.cursor))) + .chain( + std::iter::once(c) + .chain(self.value.chars().skip(self.cursor)), + ) .collect(); } self.cursor += 1; @@ -175,7 +179,10 @@ impl Input { .value .chars() .rev() - .skip(self.value.chars().count().max(self.cursor) - self.cursor) + .skip( + self.value.chars().count().max(self.cursor) + - self.cursor, + ) .skip_while(|c| !c.is_alphanumeric()) .skip_while(|c| c.is_alphanumeric()) .count(); @@ -242,12 +249,16 @@ impl Input { .value .chars() .rev() - .skip(self.value.chars().count().max(self.cursor) - self.cursor) + .skip( + self.value.chars().count().max(self.cursor) + - self.cursor, + ) .skip_while(|c| !c.is_alphanumeric()) .skip_while(|c| c.is_alphanumeric()) .collect::>(); let rev_len = rev.len(); - self.value = rev.into_iter().rev().chain(remaining).collect(); + self.value = + rev.into_iter().rev().chain(remaining).collect(); self.cursor = rev_len; Some(StateChanged { value: true, @@ -352,7 +363,8 @@ impl Input { while uscroll < scroll { match chars.next() { Some(c) => { - uscroll += unicode_width::UnicodeWidthChar::width(c).unwrap_or(0); + uscroll += + unicode_width::UnicodeWidthChar::width(c).unwrap_or(0); } None => break, } diff --git a/src/components/input/backend.rs b/crates/television/components/input/backend.rs similarity index 89% rename from src/components/input/backend.rs rename to crates/television/components/input/backend.rs index 7b2e73b..3a0b3b7 100644 --- a/src/components/input/backend.rs +++ b/crates/television/components/input/backend.rs @@ -23,13 +23,15 @@ pub fn to_input_request(evt: &CrosstermEvent) -> Option { (Right, KeyModifiers::NONE) => Some(GoToNextChar), //(Right, KeyModifiers::CONTROL) => Some(GoToNextWord), //(Char('u'), KeyModifiers::CONTROL) => Some(DeleteLine), - (Char('w'), KeyModifiers::CONTROL) | (Backspace, KeyModifiers::ALT) => { - Some(DeletePrevWord) - } + (Char('w'), KeyModifiers::CONTROL) + | (Backspace, KeyModifiers::ALT) => Some(DeletePrevWord), (Delete, KeyModifiers::CONTROL) => Some(DeleteNextWord), //(Char('k'), KeyModifiers::CONTROL) => Some(DeleteTillEnd), - (Char('a'), KeyModifiers::CONTROL) | (Home, KeyModifiers::NONE) => Some(GoToStart), - (Char('e'), KeyModifiers::CONTROL) | (End, KeyModifiers::NONE) => Some(GoToEnd), + (Char('a'), KeyModifiers::CONTROL) + | (Home, KeyModifiers::NONE) => Some(GoToStart), + (Char('e'), KeyModifiers::CONTROL) | (End, KeyModifiers::NONE) => { + Some(GoToEnd) + } (Char(c), KeyModifiers::NONE) => Some(InsertChar(c)), (Char(c), KeyModifiers::SHIFT) => Some(InsertChar(c)), (_, _) => None, diff --git a/src/components/previewers.rs b/crates/television/components/previewers.rs similarity index 71% rename from src/components/previewers.rs rename to crates/television/components/previewers.rs index 0e29e7c..596bc98 100644 --- a/src/components/previewers.rs +++ b/crates/television/components/previewers.rs @@ -2,18 +2,22 @@ use std::sync::Arc; use super::finders::Entry; +mod basic; mod cache; mod env; mod files; // previewer types +pub use basic::BasicPreviewer; pub use env::EnvVarPreviewer; pub use files::FilePreviewer; use ratatui_image::protocol::StatefulProtocol; use syntect::highlighting::Style; -#[derive(Debug, Clone, Eq, PartialEq, Hash)] +#[derive(Debug, Clone, Eq, PartialEq, Hash, Default)] pub enum PreviewType { + #[default] + Basic, EnvVar, Files, } @@ -30,7 +34,8 @@ pub enum PreviewContent { PlainTextWrapped(String), } -pub const PREVIEW_NOT_SUPPORTED_MSG: &str = "Preview for this file type is not yet supported"; +pub const PREVIEW_NOT_SUPPORTED_MSG: &str = + "Preview for this file type is not yet supported"; pub const FILE_TOO_LARGE_MSG: &str = "File too large"; /// A preview of an entry. @@ -67,22 +72,25 @@ impl Preview { } pub struct Previewer { - file_previewer: FilePreviewer, - env_var_previewer: EnvVarPreviewer, + basic: BasicPreviewer, + file: FilePreviewer, + env_var: EnvVarPreviewer, } impl Previewer { pub fn new() -> Self { Previewer { - file_previewer: FilePreviewer::new(), - env_var_previewer: EnvVarPreviewer::new(), + basic: BasicPreviewer::new(), + file: FilePreviewer::new(), + env_var: EnvVarPreviewer::new(), } } pub async fn preview(&mut self, entry: &Entry) -> Arc { match entry.preview_type { - PreviewType::EnvVar => self.env_var_previewer.preview(entry), - PreviewType::Files => self.file_previewer.preview(entry).await, + PreviewType::Basic => self.basic.preview(entry), + PreviewType::EnvVar => self.env_var.preview(entry), + PreviewType::Files => self.file.preview(entry).await, } } } diff --git a/crates/television/components/previewers/basic.rs b/crates/television/components/previewers/basic.rs new file mode 100644 index 0000000..7ed0c79 --- /dev/null +++ b/crates/television/components/previewers/basic.rs @@ -0,0 +1,19 @@ +use std::sync::Arc; + +use crate::components::finders::Entry; +use crate::components::previewers::{Preview, PreviewContent}; + +pub struct BasicPreviewer {} + +impl BasicPreviewer { + pub fn new() -> Self { + BasicPreviewer {} + } + + pub fn preview(&self, entry: &Entry) -> Arc { + Arc::new(Preview { + title: entry.name.clone(), + content: PreviewContent::PlainTextWrapped(entry.name.clone()), + }) + } +} diff --git a/src/components/previewers/cache.rs b/crates/television/components/previewers/cache.rs similarity index 100% rename from src/components/previewers/cache.rs rename to crates/television/components/previewers/cache.rs diff --git a/src/components/previewers/env.rs b/crates/television/components/previewers/env.rs similarity index 87% rename from src/components/previewers/env.rs rename to crates/television/components/previewers/env.rs index e43aa28..cf6eb12 100644 --- a/src/components/previewers/env.rs +++ b/crates/television/components/previewers/env.rs @@ -23,10 +23,9 @@ impl EnvVarPreviewer { let preview = Arc::new(Preview { title: entry.name.clone(), content: if let Some(preview) = &entry.preview { - PreviewContent::PlainTextWrapped(maybe_add_newline_after_colon( - preview, - &entry.name, - )) + PreviewContent::PlainTextWrapped( + maybe_add_newline_after_colon(preview, &entry.name), + ) } else { PreviewContent::Empty }, diff --git a/src/components/previewers/files.rs b/crates/television/components/previewers/files.rs similarity index 88% rename from src/components/previewers/files.rs rename to crates/television/components/previewers/files.rs index 8dcac96..1af5b19 100644 --- a/src/components/previewers/files.rs +++ b/crates/television/components/previewers/files.rs @@ -18,7 +18,9 @@ use crate::components::finders; use crate::components::previewers::{Preview, PreviewContent}; use crate::components::utils::files::is_valid_utf8; use crate::components::utils::files::FileType; -use crate::components::utils::files::{get_file_size, is_known_text_extension}; +use crate::components::utils::files::{ + get_file_size, is_known_text_extension, +}; use crate::components::utils::strings::preprocess_line; use super::cache::PreviewCache; @@ -41,7 +43,9 @@ impl FilePreviewer { FilePreviewer { cache: Arc::new(Mutex::new(PreviewCache::default())), syntax_set: Arc::new(syntax_set), - syntax_theme: Arc::new(theme_set.themes["base16-ocean.dark"].clone()), + syntax_theme: Arc::new( + theme_set.themes["base16-ocean.dark"].clone(), + ), image_picker: Arc::new(Mutex::new(image_picker)), } } @@ -52,7 +56,9 @@ impl FilePreviewer { let entry_c = entry.clone(); tokio::spawn(async move { info!("Loading image: {:?}", entry_c.name); - if let Ok(dyn_image) = ImageReader::open(entry_c.name.clone()).unwrap().decode() { + if let Ok(dyn_image) = + ImageReader::open(entry_c.name.clone()).unwrap().decode() + { let image = picker.lock().await.new_resize_protocol(dyn_image); let preview = Arc::new(Preview::new( entry_c.name.clone(), @@ -80,7 +86,8 @@ impl FilePreviewer { "Computing highlights in the background for {:?}", entry_c.name ); - let lines: Vec = reader.lines().map_while(Result::ok).collect(); + let lines: Vec = + reader.lines().map_while(Result::ok).collect(); match compute_highlights( &PathBuf::from(&entry_c.name), @@ -89,7 +96,10 @@ impl FilePreviewer { &syntax_theme, ) { Ok(highlighted_lines) => { - debug!("Successfully computed highlights for {:?}", entry_c.name); + debug!( + "Successfully computed highlights for {:?}", + entry_c.name + ); cache.lock().await.insert( entry_c.name.clone(), Arc::new(Preview::new( @@ -158,7 +168,8 @@ impl FilePreviewer { debug!("No preview in cache for {:?}", entry.name); // check file size - if get_file_size(&path_buf).map_or(false, |s| s > Self::MAX_FILE_SIZE) { + if get_file_size(&path_buf).map_or(false, |s| s > Self::MAX_FILE_SIZE) + { debug!("File too large: {:?}", entry.name); let preview = file_too_large(&entry.name); self.cache_preview(entry.name.clone(), preview.clone()) @@ -175,19 +186,25 @@ impl FilePreviewer { // insert a non-highlighted version of the preview into the cache let reader = BufReader::new(&file); let preview = plain_text_preview(&entry.name, reader); - self.cache_preview(entry.name.clone(), preview.clone()) - .await; + self.cache_preview( + entry.name.clone(), + preview.clone(), + ) + .await; // compute the highlighted version in the background - let mut reader = BufReader::new(file.try_clone().unwrap()); + let mut reader = + BufReader::new(file.try_clone().unwrap()); reader.seek(std::io::SeekFrom::Start(0)).unwrap(); - self.compute_highlighted_text_preview(entry, reader).await; + self.compute_highlighted_text_preview(entry, reader) + .await; preview } Err(e) => { warn!("Error opening file: {:?}", e); let p = not_supported(&entry.name); - self.cache_preview(entry.name.clone(), p.clone()).await; + self.cache_preview(entry.name.clone(), p.clone()) + .await; p } } @@ -278,15 +295,16 @@ fn compute_highlights( syntax_set: &SyntaxSet, syntax_theme: &Theme, ) -> Result>> { - let syntax = syntax_set - .find_syntax_for_file(file_path)? - .unwrap_or_else(|| { - warn!( - "No syntax found for {:?}, defaulting to plain text", - file_path - ); - syntax_set.find_syntax_plain_text() - }); + let syntax = + syntax_set + .find_syntax_for_file(file_path)? + .unwrap_or_else(|| { + warn!( + "No syntax found for {:?}, defaulting to plain text", + file_path + ); + syntax_set.find_syntax_plain_text() + }); let mut highlighter = HighlightLines::new(syntax, syntax_theme); let mut highlighted_lines = Vec::new(); for line in lines { diff --git a/src/components/television.rs b/crates/television/components/television.rs similarity index 85% rename from src/components/television.rs rename to crates/television/components/television.rs index bfc4d82..d915ca6 100644 --- a/src/components/television.rs +++ b/crates/television/components/television.rs @@ -11,24 +11,25 @@ use ratatui::{ Frame, }; use ratatui_image::StatefulImage; -use std::{collections::HashMap, sync::Arc}; +use std::{collections::HashMap, str::FromStr, sync::Arc}; use syntect; use syntect::highlighting::Color as SyntectColor; use tokio::sync::mpsc::UnboundedSender; use crate::components::{ - channels::{get_tv_channel, TvChannel}, + channels::TvChannel, finders::ENTRY_PLACEHOLDER, input::{Input, InputRequest, StateChanged}, previewers::{ - Preview, PreviewContent, Previewer, FILE_TOO_LARGE_MSG, PREVIEW_NOT_SUPPORTED_MSG, + Preview, PreviewContent, Previewer, FILE_TOO_LARGE_MSG, + PREVIEW_NOT_SUPPORTED_MSG, }, ui::{build_results_list, create_layout, get_border_style}, Component, }; use crate::{action::Action, config::Config}; -use crate::{cli::UnitTvChannel, components::finders::Entry}; +use crate::{cli::CliTvChannel, components::finders::Entry}; #[derive(PartialEq, Copy, Clone)] enum Pane { @@ -60,8 +61,8 @@ pub struct Television { const EMPTY_STRING: &str = ""; impl Television { - pub fn new(channel: UnitTvChannel) -> Self { - let mut tv_channel = get_tv_channel(channel); + pub fn new(channel: CliTvChannel) -> Self { + let mut tv_channel = TvChannel::from(channel); tv_channel.find(EMPTY_STRING); Self { @@ -97,8 +98,8 @@ impl Television { if self.channel.result_count() == 0 { return; } - let new_index = - (self.picker_state.selected().unwrap_or(0) + 1) % self.channel.result_count() as usize; + let new_index = (self.picker_state.selected().unwrap_or(0) + 1) + % self.channel.result_count() as usize; self.picker_state.select(Some(new_index)); if new_index == 0 { self.picker_view_offset = 0; @@ -128,13 +129,15 @@ impl Television { return; } let selected = self.picker_state.selected().unwrap_or(0); - let relative_selected = self.relative_picker_state.selected().unwrap_or(0); + let relative_selected = + self.relative_picker_state.selected().unwrap_or(0); if selected > 0 { self.picker_state.select(Some(selected - 1)); self.relative_picker_state .select(Some(relative_selected.saturating_sub(1))); if relative_selected == 0 { - self.picker_view_offset = self.picker_view_offset.saturating_sub(1); + self.picker_view_offset = + self.picker_view_offset.saturating_sub(1); } } else { self.picker_view_offset = (self @@ -288,7 +291,10 @@ const DEFAULT_PREVIEW_GUTTER_FG: Color = Color::Rgb(70, 70, 70); const DEFAULT_PREVIEW_GUTTER_SELECTED_FG: Color = Color::Rgb(255, 150, 150); impl Component for Television { - fn register_action_handler(&mut self, tx: UnboundedSender) -> Result<()> { + fn register_action_handler( + &mut self, + tx: UnboundedSender, + ) -> Result<()> { self.action_tx = Some(tx.clone()); Ok(()) } @@ -330,7 +336,9 @@ impl Component for Television { { self.input.handle_action(&action); match action { - Action::AddInputChar(_) | Action::DeletePrevChar | Action::DeleteNextChar => { + Action::AddInputChar(_) + | Action::DeletePrevChar + | Action::DeleteNextChar => { let new_pattern = self.input.value().to_string(); if new_pattern != self.current_pattern { self.current_pattern.clone_from(&new_pattern); @@ -362,7 +370,8 @@ impl Component for Television { } fn draw(&mut self, frame: &mut Frame, area: Rect) -> Result<()> { - let (results_area, input_area, preview_title_area, preview_area) = create_layout(area); + let (results_area, input_area, preview_title_area, preview_area) = + create_layout(area); self.results_area_height = u32::from(results_area.height); self.preview_pane_height = preview_area.height; @@ -380,7 +389,9 @@ impl Component for Television { .style(Style::default()) .padding(Padding::right(1)); - if self.channel.result_count() > 0 && self.picker_state.selected().is_none() { + if self.channel.result_count() > 0 + && self.picker_state.selected().is_none() + { self.picker_state.select(Some(0)); self.relative_picker_state.select(Some(0)); } @@ -391,7 +402,11 @@ impl Component for Television { ); let results_list = build_results_list(results_block, &entries); - frame.render_stateful_widget(results_list, results_area, &mut self.relative_picker_state); + frame.render_stateful_widget( + results_list, + results_area, + &mut self.relative_picker_state, + ); // bottom left block: input let input_block = Block::default() @@ -415,13 +430,17 @@ impl Component for Television { Constraint::Length(2), Constraint::Fill(1), Constraint::Length( - 3 * ((self.channel.total_count() as f32).log10().ceil() as u16 + 1) + 3, + 3 * ((self.channel.total_count() as f32).log10().ceil() + as u16 + + 1) + + 3, ), ]) .split(input_block_inner); let arrow_block = Block::default(); - let arrow = Paragraph::new(Span::styled("> ", Style::default())).block(arrow_block); + let arrow = Paragraph::new(Span::styled("> ", Style::default())) + .block(arrow_block); frame.render_widget(arrow, inner_input_chunks[0]); let interactive_input_block = Block::default(); @@ -456,25 +475,41 @@ impl Component for Television { frame.set_cursor_position(( // Put cursor past the end of the input text inner_input_chunks[1].x - + u16::try_from((self.input.visual_cursor()).max(scroll) - scroll).unwrap(), + + u16::try_from( + (self.input.visual_cursor()).max(scroll) - scroll, + ) + .unwrap(), // Move one line down, from the border to the input line inner_input_chunks[1].y, )); } // top right block: preview title - let selected_entry = self.get_selected_entry().unwrap_or(ENTRY_PLACEHOLDER); + let selected_entry = + self.get_selected_entry().unwrap_or(ENTRY_PLACEHOLDER); let preview = block_on(self.previewer.preview(&selected_entry)); self.current_preview_total_lines = preview.total_lines(); - let preview_title = Paragraph::new(Line::from(preview.title.clone())) + + let mut preview_title_spans = Vec::new(); + if let Some(icon) = &selected_entry.icon { + preview_title_spans.push(Span::styled( + icon.to_string(), + Style::default().fg(Color::from_str(icon.color).unwrap()), + )); + preview_title_spans.push(Span::raw(" ")); + } + preview_title_spans.push(Span::styled( + preview.title.clone(), + Style::default().fg(DEFAULT_PREVIEW_TITLE_FG), + )); + let preview_title = Paragraph::new(Line::from(preview_title_spans)) .block( Block::default() .borders(Borders::ALL) .border_type(BorderType::Rounded) .border_style(get_border_style(false)), ) - .style(Style::default().fg(DEFAULT_PREVIEW_TITLE_FG)) .alignment(Alignment::Left); frame.render_widget(preview_title, preview_title_area); @@ -491,18 +526,23 @@ impl Component for Television { .style(Style::default()) .padding(Padding::right(1)); - let preview_inner_block = Block::default().style(Style::default()).padding(Padding { - top: 0, - right: 1, - bottom: 0, - left: 1, - }); + let preview_inner_block = + Block::default().style(Style::default()).padding(Padding { + top: 0, + right: 1, + bottom: 0, + left: 1, + }); let inner = preview_outer_block.inner(preview_area); frame.render_widget(preview_outer_block, preview_area); if let PreviewContent::Image(img) = &preview.content { let image_component = StatefulImage::new(None); - frame.render_stateful_widget(image_component, inner, &mut img.clone()); + frame.render_stateful_widget( + image_component, + inner, + &mut img.clone(), + ); } else { let preview_block = self.build_preview_paragraph( preview_inner_block, @@ -589,7 +629,11 @@ impl Television { } // meta PreviewContent::Loading => self - .build_meta_preview_paragraph(inner, "Loading...", Self::FILL_CHAR_EMPTY) + .build_meta_preview_paragraph( + inner, + "Loading...", + Self::FILL_CHAR_EMPTY, + ) .block(preview_block) .alignment(Alignment::Left) .style(Style::default().add_modifier(Modifier::ITALIC)), @@ -603,7 +647,11 @@ impl Television { .alignment(Alignment::Left) .style(Style::default().add_modifier(Modifier::ITALIC)), PreviewContent::FileTooLarge => self - .build_meta_preview_paragraph(inner, FILE_TOO_LARGE_MSG, Self::FILL_CHAR_SLANTED) + .build_meta_preview_paragraph( + inner, + FILE_TOO_LARGE_MSG, + Self::FILL_CHAR_SLANTED, + ) .block(preview_block) .alignment(Alignment::Left) .style(Style::default().add_modifier(Modifier::ITALIC)), @@ -611,9 +659,14 @@ impl Television { } } - fn maybe_init_preview_scroll(&mut self, target_line: Option, height: u16) { + fn maybe_init_preview_scroll( + &mut self, + target_line: Option, + height: u16, + ) { if self.preview_scroll.is_none() { - self.preview_scroll = Some(target_line.unwrap_or(0).saturating_sub(height / 3)); + self.preview_scroll = + Some(target_line.unwrap_or(0).saturating_sub(height / 3)); } } @@ -645,7 +698,11 @@ impl Television { "{} {} {}", fill_char_str.repeat(horizontal_padding), message, - fill_char_str.repeat(inner.width as usize - horizontal_padding - message_len) + fill_char_str.repeat( + inner.width as usize + - horizontal_padding + - message_len + ) ); lines.push(Line::from(line)); } else if i as usize + 1 == vertical_center @@ -655,7 +712,11 @@ impl Television { "{} {} {}", fill_char_str.repeat(horizontal_padding), " ".repeat(message_len), - fill_char_str.repeat(inner.width as usize - horizontal_padding - message_len) + fill_char_str.repeat( + inner.width as usize + - horizontal_padding + - message_len + ) ); lines.push(Line::from(line)); } else { @@ -681,9 +742,15 @@ impl InputActionHandler for Input { /// Handle Key event. fn handle_action(&mut self, action: &Action) -> Option { match action { - Action::AddInputChar(c) => self.handle(InputRequest::InsertChar(*c)), - Action::DeletePrevChar => self.handle(InputRequest::DeletePrevChar), - Action::DeleteNextChar => self.handle(InputRequest::DeleteNextChar), + Action::AddInputChar(c) => { + self.handle(InputRequest::InsertChar(*c)) + } + Action::DeletePrevChar => { + self.handle(InputRequest::DeletePrevChar) + } + Action::DeleteNextChar => { + self.handle(InputRequest::DeleteNextChar) + } Action::GoToPrevChar => self.handle(InputRequest::GoToPrevChar), Action::GoToNextChar => self.handle(InputRequest::GoToNextChar), Action::GoToInputStart => self.handle(InputRequest::GoToStart), @@ -707,16 +774,21 @@ fn compute_paragraph_from_highlighted_lines( .iter() .enumerate() .map(|(i, l)| { - if i < scroll as usize || i >= (scroll + preview_pane_height) as usize { + if i < scroll as usize + || i >= (scroll + preview_pane_height) as usize + { return Line::from(Span::raw(EMPTY_STRING)); } - let line_number = build_line_number_span(i + 1).style(Style::default().fg( - if line_specifier.is_some() && i == line_specifier.unwrap() - 1 { - DEFAULT_PREVIEW_GUTTER_SELECTED_FG - } else { - DEFAULT_PREVIEW_GUTTER_FG - }, - )); + let line_number = + build_line_number_span(i + 1).style(Style::default().fg( + if line_specifier.is_some() + && i == line_specifier.unwrap() - 1 + { + DEFAULT_PREVIEW_GUTTER_SELECTED_FG + } else { + DEFAULT_PREVIEW_GUTTER_FG + }, + )); Line::from_iter( std::iter::once(line_number) .chain(std::iter::once(Span::styled( @@ -726,7 +798,9 @@ fn compute_paragraph_from_highlighted_lines( .chain(l.iter().cloned().map(|sr| { convert_syn_region_to_span( &(sr.0, sr.1.replace('\t', FOUR_SPACES)), - if line_specifier.is_some() && i == line_specifier.unwrap() - 1 { + if line_specifier.is_some() + && i == line_specifier.unwrap() - 1 + { Some(SyntectColor { r: 50, g: 50, @@ -749,8 +823,8 @@ fn convert_syn_region_to_span<'a>( syn_region: &(syntect::highlighting::Style, String), background: Option, ) -> Span<'a> { - let mut style = - Style::default().fg(convert_syn_color_to_ratatui_color(syn_region.0.foreground)); + let mut style = Style::default() + .fg(convert_syn_color_to_ratatui_color(syn_region.0.foreground)); if let Some(background) = background { style = style.bg(convert_syn_color_to_ratatui_color(background)); } diff --git a/src/components/ui.rs b/crates/television/components/ui.rs similarity index 88% rename from src/components/ui.rs rename to crates/television/components/ui.rs index 3deca17..3bb9b23 100644 --- a/src/components/ui.rs +++ b/crates/television/components/ui.rs @@ -7,7 +7,9 @@ use ratatui::{ use std::str::FromStr; use crate::components::finders::Entry; -use crate::components::utils::strings::{next_char_boundary, slice_at_char_boundaries}; +use crate::components::utils::strings::{ + next_char_boundary, slice_at_char_boundaries, +}; use crate::components::utils::ui::centered_rect; // UI size @@ -67,7 +69,10 @@ pub fn create_layout(area: Rect) -> (Rect, Rect, Rect, Rect) { ) } -pub fn build_results_list<'a, 'b>(results_block: Block<'b>, entries: &'a [Entry]) -> List<'a> +pub fn build_results_list<'a, 'b>( + results_block: Block<'b>, + entries: &'a [Entry], +) -> List<'a> where 'b: 'a, { @@ -89,8 +94,15 @@ where .map(|(s, e)| (*s as usize, *e as usize)) { spans.push(Span::styled( - slice_at_char_boundaries(&entry.name, last_match_end, start), - Style::default().fg(DEFAULT_RESULT_NAME_FG).bold().italic(), + slice_at_char_boundaries( + &entry.name, + last_match_end, + start, + ), + Style::default() + .fg(DEFAULT_RESULT_NAME_FG) + .bold() + .italic(), )); spans.push(Span::styled( slice_at_char_boundaries(&entry.name, start, end), @@ -127,7 +139,11 @@ where .map(|(s, e)| (*s as usize, *e as usize)) { spans.push(Span::styled( - slice_at_char_boundaries(preview, last_match_end, start), + slice_at_char_boundaries( + preview, + last_match_end, + start, + ), Style::default().fg(DEFAULT_RESULT_PREVIEW_FG), )); spans.push(Span::styled( diff --git a/src/components/utils.rs b/crates/television/components/utils.rs similarity index 72% rename from src/components/utils.rs rename to crates/television/components/utils.rs index 6c34ace..e87b2a3 100644 --- a/src/components/utils.rs +++ b/crates/television/components/utils.rs @@ -1,3 +1,4 @@ pub mod files; +pub mod indices; pub mod strings; pub mod ui; diff --git a/src/components/utils/files.rs b/crates/television/components/utils/files.rs similarity index 100% rename from src/components/utils/files.rs rename to crates/television/components/utils/files.rs diff --git a/crates/television/components/utils/indices.rs b/crates/television/components/utils/indices.rs new file mode 100644 index 0000000..318277b --- /dev/null +++ b/crates/television/components/utils/indices.rs @@ -0,0 +1,31 @@ +pub fn sep_name_and_value_indices( + indices: &mut Vec, + name_len: u32, +) -> (Vec, Vec, bool, bool) { + let mut name_indices = Vec::new(); + let mut value_indices = Vec::new(); + let mut should_add_name_indices = false; + let mut should_add_value_indices = false; + + for i in indices.drain(..) { + if i < name_len { + name_indices.push(i); + should_add_name_indices = true; + } else { + value_indices.push(i - name_len); + should_add_value_indices = true; + } + } + + name_indices.sort_unstable(); + name_indices.dedup(); + value_indices.sort_unstable(); + value_indices.dedup(); + + ( + name_indices, + value_indices, + should_add_name_indices, + should_add_value_indices, + ) +} diff --git a/src/components/utils/strings.rs b/crates/television/components/utils/strings.rs similarity index 90% rename from src/components/utils/strings.rs rename to crates/television/components/utils/strings.rs index 43d3c09..645c1ab 100644 --- a/src/components/utils/strings.rs +++ b/crates/television/components/utils/strings.rs @@ -17,8 +17,13 @@ pub fn prev_char_boundary(s: &str, start: usize) -> usize { i } -pub fn slice_at_char_boundaries(s: &str, start_byte_index: usize, end_byte_index: usize) -> &str { - &s[prev_char_boundary(s, start_byte_index)..next_char_boundary(s, end_byte_index)] +pub fn slice_at_char_boundaries( + s: &str, + start_byte_index: usize, + end_byte_index: usize, +) -> &str { + &s[prev_char_boundary(s, start_byte_index) + ..next_char_boundary(s, end_byte_index)] } pub fn slice_up_to_char_boundary(s: &str, byte_index: usize) -> &str { @@ -75,7 +80,9 @@ pub fn replace_nonprintable(input: &[u8], tab_width: usize) -> String { output.push_str("␊\x0A"); } // ASCII control characters from 0x00 to 0x1F - NULL_CHARACTER..=UNIT_SEPARATOR_CHARACTER => output.push(*NULL_SYMBOL), + NULL_CHARACTER..=UNIT_SEPARATOR_CHARACTER => { + output.push(*NULL_SYMBOL) + } // control characters from \u{007F} to \u{009F} DELETE_CHARACTER..=APPLICATION_PROGRAM_COMMAND_CHARACTER => { output.push(*NULL_SYMBOL) diff --git a/src/components/utils/ui.rs b/crates/television/components/utils/ui.rs similarity index 100% rename from src/components/utils/ui.rs rename to crates/television/components/utils/ui.rs diff --git a/src/config.rs b/crates/television/config.rs similarity index 94% rename from src/config.rs rename to crates/television/config.rs index d96286e..e227df6 100644 --- a/src/config.rs +++ b/crates/television/config.rs @@ -16,7 +16,7 @@ use crate::{ }; //const CONFIG: &str = include_str!("../.config/config.json5"); -const CONFIG: &str = include_str!("../.config/config.toml"); +const CONFIG: &str = include_str!("../../.config/config.toml"); #[derive(Clone, Debug, Deserialize, Default)] pub struct AppConfig { @@ -37,7 +37,8 @@ pub struct Config { } lazy_static! { - pub static ref PROJECT_NAME: String = env!("CARGO_CRATE_NAME").to_uppercase().to_string(); + pub static ref PROJECT_NAME: String = + env!("CARGO_CRATE_NAME").to_uppercase().to_string(); pub static ref DATA_FOLDER: Option = env::var(format!("{}_DATA", PROJECT_NAME.clone())) .ok() @@ -132,7 +133,10 @@ impl<'de> Deserialize<'de> for KeyBindings { where D: Deserializer<'de>, { - let parsed_map = HashMap::>::deserialize(deserializer)?; + let parsed_map = + HashMap::>::deserialize( + deserializer, + )?; let keybindings = parsed_map .into_iter() @@ -294,7 +298,9 @@ pub fn key_event_to_string(key_event: &KeyEvent) -> String { } pub fn parse_key(raw: &str) -> Result { - if raw.chars().filter(|c| *c == '>').count() != raw.chars().filter(|c| *c == '<').count() { + if raw.chars().filter(|c| *c == '>').count() + != raw.chars().filter(|c| *c == '<').count() + { return Err(format!("Unable to parse `{}`", raw)); } let raw = if !raw.contains("><") { @@ -327,7 +333,10 @@ impl<'de> Deserialize<'de> for Styles { where D: Deserializer<'de>, { - let parsed_map = HashMap::>::deserialize(deserializer)?; + let parsed_map = + HashMap::>::deserialize( + deserializer, + )?; let styles = parsed_map .into_iter() @@ -406,9 +415,12 @@ fn parse_color(s: &str) -> Option { .unwrap_or_default(); Some(Color::Indexed(c)) } else if s.contains("rgb") { - let red = (s.as_bytes()[3] as char).to_digit(10).unwrap_or_default() as u8; - let green = (s.as_bytes()[4] as char).to_digit(10).unwrap_or_default() as u8; - let blue = (s.as_bytes()[5] as char).to_digit(10).unwrap_or_default() as u8; + let red = + (s.as_bytes()[3] as char).to_digit(10).unwrap_or_default() as u8; + let green = + (s.as_bytes()[4] as char).to_digit(10).unwrap_or_default() as u8; + let blue = + (s.as_bytes()[5] as char).to_digit(10).unwrap_or_default() as u8; let c = 16 + red * 36 + green * 6 + blue; Some(Color::Indexed(c)) } else if s == "bold black" { @@ -481,7 +493,8 @@ mod tests { #[test] fn test_process_color_string() { - let (color, modifiers) = process_color_string("underline bold inverse gray"); + let (color, modifiers) = + process_color_string("underline bold inverse gray"); assert_eq!(color, "gray"); assert!(modifiers.contains(Modifier::UNDERLINED)); assert!(modifiers.contains(Modifier::BOLD)); @@ -563,7 +576,10 @@ mod tests { assert_eq!( parse_key_event("ctrl-shift-enter").unwrap(), - KeyEvent::new(KeyCode::Enter, KeyModifiers::CONTROL | KeyModifiers::SHIFT) + KeyEvent::new( + KeyCode::Enter, + KeyModifiers::CONTROL | KeyModifiers::SHIFT + ) ); } diff --git a/src/errors.rs b/crates/television/errors.rs similarity index 92% rename from src/errors.rs rename to crates/television/errors.rs index c9dfbfd..e5259fa 100644 --- a/src/errors.rs +++ b/crates/television/errors.rs @@ -15,7 +15,7 @@ pub fn init() -> Result<()> { .into_hooks(); eyre_hook.install()?; std::panic::set_hook(Box::new(move |panic_info| { - if let Ok(mut t) = crate::tui::Tui::new() { + if let Ok(mut t) = crate::tui::Tui::new(std::io::stderr()) { if let Err(r) = t.exit() { error!("Unable to exit Terminal: {:?}", r); } @@ -27,8 +27,9 @@ pub fn init() -> Result<()> { let metadata = metadata!(); let file_path = handle_dump(&metadata, panic_info); // prints human-panic message - print_msg(file_path, &metadata) - .expect("human-panic: printing error message to console failed"); + print_msg(file_path, &metadata).expect( + "human-panic: printing error message to console failed", + ); eprintln!("{}", panic_hook.panic_report(panic_info)); // prints color-eyre stack trace to stderr } let msg = format!("{}", panic_hook.panic_report(panic_info)); diff --git a/src/event.rs b/crates/television/event.rs similarity index 73% rename from src/event.rs rename to crates/television/event.rs index 0cd62aa..917691d 100644 --- a/src/event.rs +++ b/crates/television/event.rs @@ -1,11 +1,17 @@ +use std::{ + future::Future, + pin::Pin, + task::{Context, Poll as TaskPoll}, + time::Duration, +}; + use crossterm::event::{ KeyCode::{ - BackTab, Backspace, Char, Delete, Down, End, Enter, Esc, Home, Insert, Left, Null, - PageDown, PageUp, Right, Tab, Up, F, + BackTab, Backspace, Char, Delete, Down, End, Enter, Esc, Home, Insert, + Left, Null, PageDown, PageUp, Right, Tab, Up, F, }, KeyEvent, KeyModifiers, }; -use futures::StreamExt; use serde::{Deserialize, Serialize}; use tokio::sync::mpsc; use tracing::warn; @@ -20,7 +26,9 @@ pub enum Event { Tick, } -#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, PartialOrd, Eq, Hash)] +#[derive( + Debug, Clone, Copy, Serialize, Deserialize, PartialEq, PartialOrd, Eq, Hash, +)] pub enum Key { Backspace, Enter, @@ -60,20 +68,51 @@ pub struct EventLoop { //tick_rate: std::time::Duration, } +struct PollFuture { + timeout: Duration, +} + +impl Future for PollFuture { + type Output = bool; + + fn poll( + mut self: Pin<&mut Self>, + cx: &mut Context<'_>, + ) -> TaskPoll { + // Polling crossterm::event::poll, which is a blocking call + // Spawn it in a separate task, to avoid blocking async runtime + match crossterm::event::poll(self.timeout) { + Ok(true) => TaskPoll::Ready(true), + Ok(false) => { + // Register the task to be polled again after a delay to avoid busy-looping + cx.waker().wake_by_ref(); + TaskPoll::Pending + } + Err(_) => TaskPoll::Ready(false), + } + } +} + +async fn poll_event(timeout: Duration) -> bool { + PollFuture { timeout }.await +} + impl EventLoop { pub fn new(tick_rate: f64, init: bool) -> Self { let (tx, rx) = mpsc::unbounded_channel(); let _tx = tx.clone(); - let tick_interval = tokio::time::Duration::from_secs_f64(1.0 / tick_rate); + let tick_interval = + tokio::time::Duration::from_secs_f64(1.0 / tick_rate); let (abort, mut abort_recv) = mpsc::unbounded_channel(); if init { - let mut reader = crossterm::event::EventStream::new(); + //let mut reader = crossterm::event::EventStream::new(); tokio::spawn(async move { loop { + //let event = reader.next(); let delay = tokio::time::sleep(tick_interval); - let event = reader.next(); + let event_available = poll_event(tick_interval); tokio::select! { // if we receive a message on the abort channel, stop the event loop @@ -89,19 +128,20 @@ impl EventLoop { // if the receiver dropped the channel, stop the event loop _ = _tx.closed() => break, // if an event was received, process it - maybe_event = event => { + _ = event_available => { + let maybe_event = crossterm::event::read(); match maybe_event { - Some(Ok(crossterm::event::Event::Key(key))) => { + Ok(crossterm::event::Event::Key(key)) => { let key = convert_raw_event_to_key(key); _tx.send(Event::Input(key)).unwrap_or_else(|_| warn!("Unable to send {:?} event", key)); }, - Some(Ok(crossterm::event::Event::FocusLost)) => { + Ok(crossterm::event::Event::FocusLost) => { _tx.send(Event::FocusLost).unwrap_or_else(|_| warn!("Unable to send FocusLost event")); }, - Some(Ok(crossterm::event::Event::FocusGained)) => { + Ok(crossterm::event::Event::FocusGained) => { _tx.send(Event::FocusGained).unwrap_or_else(|_| warn!("Unable to send FocusGained event")); }, - Some(Ok(crossterm::event::Event::Resize(x, y))) => { + Ok(crossterm::event::Event::Resize(x, y)) => { _tx.send(Event::Resize(x, y)).unwrap_or_else(|_| warn!("Unable to send Resize event")); }, _ => {} diff --git a/src/logging.rs b/crates/television/logging.rs similarity index 100% rename from src/logging.rs rename to crates/television/logging.rs diff --git a/crates/television/main.rs b/crates/television/main.rs new file mode 100644 index 0000000..aa5faf3 --- /dev/null +++ b/crates/television/main.rs @@ -0,0 +1,108 @@ +use std::io::{stdout, IsTerminal, Write}; + +use clap::Parser; +use cli::{Cli, CliTvChannel}; +use color_eyre::Result; +use tracing::{debug, info}; + +use crate::app::App; + +mod action; +mod app; +mod cli; +mod components; +mod config; +mod errors; +mod event; +mod logging; +mod render; +mod tui; + +#[tokio::main(flavor = "multi_thread")] +async fn main() -> Result<()> { + crate::errors::init()?; + crate::logging::init()?; + + let args = Cli::parse(); + + let mut app = App::new( + { + if is_readable_stdin() { + debug!("Using stdin channel"); + CliTvChannel::Stdin + } else { + debug!("Using {:?} channel", args.channel); + args.channel + } + }, + args.tick_rate, + args.frame_rate, + )?; + + if let Some(entry) = app.run(stdout().is_terminal()).await? { + // print entry to stdout + stdout().flush()?; + info!("{:?}", entry); + writeln!(stdout(), "{}", entry.stdout_repr())?; + } + Ok(()) +} + +pub fn is_readable_stdin() -> bool { + use std::io::IsTerminal; + + #[cfg(unix)] + fn imp() -> bool { + use std::{ + fs::File, + os::{fd::AsFd, unix::fs::FileTypeExt}, + }; + + let stdin = std::io::stdin(); + let Ok(fd) = stdin.as_fd().try_clone_to_owned() else { + return false; + }; + let file = File::from(fd); + let Ok(md) = file.metadata() else { + return false; + }; + let ft = md.file_type(); + let is_file = ft.is_file(); + let is_fifo = ft.is_fifo(); + let is_socket = ft.is_socket(); + is_file || is_fifo || is_socket + } + + #[cfg(windows)] + fn imp() -> bool { + let stdin = winapi_util::HandleRef::stdin(); + let typ = match winapi_util::file::typ(stdin) { + Ok(typ) => typ, + Err(err) => { + log::debug!( + "for heuristic stdin detection on Windows, \ + could not get file type of stdin \ + (thus assuming stdin is not readable): {err}", + ); + return false; + } + }; + let is_disk = typ.is_disk(); + let is_pipe = typ.is_pipe(); + let is_readable = is_disk || is_pipe; + log::debug!( + "for heuristic stdin detection on Windows, \ + found that is_disk={is_disk} and is_pipe={is_pipe}, \ + and thus concluded that is_stdin_readable={is_readable}", + ); + is_readable + } + + #[cfg(not(any(unix, windows)))] + fn imp() -> bool { + log::debug!("on non-{{Unix,Windows}}, assuming stdin is not readable"); + false + } + + !std::io::stdin().is_terminal() && imp() +} diff --git a/src/render.rs b/crates/television/render.rs similarity index 76% rename from src/render.rs rename to crates/television/render.rs index 0e92959..db882f4 100644 --- a/src/render.rs +++ b/crates/television/render.rs @@ -1,7 +1,10 @@ use color_eyre::Result; use ratatui::layout::Rect; -use std::sync::Arc; -use tracing::debug; +use std::{ + io::{stderr, stdout, LineWriter}, + sync::Arc, +}; +use tracing::{debug, info, warn}; use tokio::{ select, @@ -25,14 +28,37 @@ pub enum RenderingTask { Quit, } +#[derive(Debug, Clone)] +enum IoStream { + Stdout, + BufferedStderr, +} + +impl IoStream { + fn to_stream(&self) -> Box { + match self { + IoStream::Stdout => Box::new(stdout()), + IoStream::BufferedStderr => Box::new(LineWriter::new(stderr())), + } + } +} + pub async fn render( mut render_rx: mpsc::UnboundedReceiver, action_tx: mpsc::UnboundedSender, config: Config, television: Arc>, frame_rate: f64, + is_output_tty: bool, ) -> Result<()> { - let mut tui = Tui::new()?.frame_rate(frame_rate); + let stream = if is_output_tty { + debug!("Rendering to stdout"); + IoStream::Stdout.to_stream() + } else { + debug!("Rendering to stderr"); + IoStream::BufferedStderr.to_stream() + }; + let mut tui = Tui::new(stream)?.frame_rate(frame_rate); debug!("Entering tui"); tui.enter()?; @@ -56,22 +82,18 @@ pub async fn render( } maybe_task = render_rx.recv() => { if let Some(task) = maybe_task { - debug!("Received task: {:?}", task); match task { RenderingTask::ClearScreen => { tui.terminal.clear()?; } RenderingTask::Render => { let mut television = television.lock().await; - debug!("Drawing television"); - tui.terminal.try_draw(|frame| { - debug!("Drawing frame"); + tui.terminal.draw(|frame| { if let Err(err) = television.draw(frame, frame.area()) { - debug!("Failed to draw: {:?}", err); + warn!("Failed to draw: {:?}", err); let _ = action_tx .send(Action::Error(format!("Failed to draw: {err:?}"))); } - Ok::<() ,std::io::Error>(()) })?; } RenderingTask::Resize(w, h) => { diff --git a/crates/television/tui.rs b/crates/television/tui.rs new file mode 100644 index 0000000..0cb829b --- /dev/null +++ b/crates/television/tui.rs @@ -0,0 +1,113 @@ +use std::{ + io::{stderr, stdout, LineWriter, Write}, + ops::{Deref, DerefMut}, +}; + +use color_eyre::Result; +use crossterm::{ + cursor, execute, + terminal::{ + disable_raw_mode, enable_raw_mode, is_raw_mode_enabled, + EnterAlternateScreen, LeaveAlternateScreen, + }, +}; +use ratatui::{backend::CrosstermBackend, layout::Size}; +use tokio::task::JoinHandle; +use tracing::debug; + +pub struct Tui +where + W: Write, +{ + pub task: JoinHandle<()>, + pub frame_rate: f64, + pub terminal: ratatui::Terminal>, +} + +impl Tui +where + W: Write, +{ + pub fn new(writer: W) -> Result { + Ok(Self { + task: tokio::spawn(async {}), + frame_rate: 60.0, + terminal: ratatui::Terminal::new(CrosstermBackend::new(writer))?, + }) + } + + pub fn frame_rate(mut self, frame_rate: f64) -> Self { + self.frame_rate = frame_rate; + self + } + + pub fn size(&self) -> Result { + Ok(self.terminal.size()?) + } + + pub fn enter(&mut self) -> Result<()> { + enable_raw_mode()?; + let mut buffered_stderr = LineWriter::new(stderr()); + execute!(buffered_stderr, EnterAlternateScreen)?; + self.terminal.clear()?; + execute!(buffered_stderr, cursor::Hide)?; + Ok(()) + } + + pub fn exit(&mut self) -> Result<()> { + if is_raw_mode_enabled()? { + debug!("Exiting terminal"); + + disable_raw_mode()?; + let mut buffered_stderr = LineWriter::new(stderr()); + execute!(buffered_stderr, cursor::Show)?; + execute!(buffered_stderr, LeaveAlternateScreen)?; + } + + Ok(()) + } + + pub fn suspend(&mut self) -> Result<()> { + self.exit()?; + #[cfg(not(windows))] + signal_hook::low_level::raise(signal_hook::consts::signal::SIGTSTP)?; + Ok(()) + } + + pub fn resume(&mut self) -> Result<()> { + self.enter()?; + Ok(()) + } +} + +impl Deref for Tui +where + W: Write, +{ + type Target = ratatui::Terminal>; + + fn deref(&self) -> &Self::Target { + &self.terminal + } +} + +impl DerefMut for Tui +where + W: Write, +{ + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.terminal + } +} + +impl Drop for Tui +where + W: Write, +{ + fn drop(&mut self) { + match self.exit() { + Ok(_) => debug!("Successfully exited terminal"), + Err(e) => debug!("Failed to exit terminal: {:?}", e), + } + } +} diff --git a/crates/television_derive/Cargo.lock b/crates/television_derive/Cargo.lock new file mode 100644 index 0000000..8514ea4 --- /dev/null +++ b/crates/television_derive/Cargo.lock @@ -0,0 +1,46 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "channel_derive" +version = "0.1.0" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "syn" +version = "2.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" diff --git a/crates/television_derive/Cargo.toml b/crates/television_derive/Cargo.toml new file mode 100644 index 0000000..d3f447e --- /dev/null +++ b/crates/television_derive/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "television-derive" +version = "0.1.0" +edition = "2021" + +[dependencies] +proc-macro2 = "1.0.87" +quote = "1.0.37" +syn = "2.0.79" + + +[lib] +proc-macro = true diff --git a/crates/television_derive/src/lib.rs b/crates/television_derive/src/lib.rs new file mode 100644 index 0000000..e81135d --- /dev/null +++ b/crates/television_derive/src/lib.rs @@ -0,0 +1,293 @@ +use proc_macro::TokenStream; +use quote::quote; + +/// A derive macro implementing channel methods for `TvChannel`. +/// +/// This macro generates the following methods for the `TvChannel` enum: +/// +/// ```rust +/// fn find(&mut self, pattern: &str) +/// +/// fn results(&mut self, num_entries: u32, offset: u32) -> Vec +/// +/// fn get_result(&self, index: u32) -> Option +/// +/// fn result_count(&self) -> u32 +/// +/// fn total_count(&self) -> u32 +/// ``` +/// +/// The macro generates a match arm for each variant in the enum, calling the corresponding method +/// on the `Finder` implementation for that variant. +/// +/// # Example +/// ```rust +/// use television_derive::Channel; +/// use crate::components::finders::Entry; +/// +/// #[derive(Channel)] +/// pub enum TvChannel { +/// Env(EnvChannel), +/// Files(FilesChannel), +/// } +/// ``` +/// This will generate the following implementation: +/// ```rust +/// impl TvChannel { +/// pub fn find(&mut self, pattern: &str) { +/// match self { +/// Self::Env(channel) => channel.finder.find(pattern), +/// Self::Files(channel) => channel.finder.find(pattern), +/// } +/// } +/// +/// pub fn results(&mut self, num_entries: u32, offset: u32) -> Vec { +/// match self { +/// Self::Env(channel) => channel.finder.results(num_entries, offset).collect(), +/// Self::Files(channel) => channel.finder.results(num_entries, offset).collect(), +/// } +/// } +/// +/// pub fn get_result(&self, index: u32) -> Option { +/// match self { +/// Self::Env(channel) => channel.finder.get_result(index), +/// Self::Files(channel) => channel.finder.get_result(index), +/// } +/// } +/// +/// pub fn result_count(&self) -> u32 { +/// match self { +/// Self::Env(channel) => channel.finder.result_count(), +/// Self::Files(channel) => channel.finder.result_count(), +/// } +/// } +/// +/// pub fn total_count(&self) -> u32 { +/// match self { +/// Self::Env(channel) => channel.finder.total_count(), +/// Self::Files(channel) => channel.finder.total_count(), +/// } +/// } +/// } +/// ``` +/// +/// # Panics +/// The derive macro will panic if the struct is not an enum or if the enum has no variants. +/// +#[proc_macro_derive(Channel)] +pub fn channel_derive(input: TokenStream) -> TokenStream { + // Construct a representation of Rust code as a syntax tree + // that we can manipulate + let ast = syn::parse(input).unwrap(); + + // Build the trait implementation + impl_channel(&ast) +} + +fn impl_channel(ast: &syn::DeriveInput) -> TokenStream { + let name = &ast.ident; + + // check that the struct is an enum + let variants = if let syn::Data::Enum(data_enum) = &ast.data { + &data_enum.variants + } else { + panic!("#[derive(Channel)] is only defined for enums"); + }; + + // check that the enum has at least one variant + assert!( + !variants.is_empty(), + "#[derive(Channel)] requires at least one variant" + ); + + // Generate the method bodies for each variant in the enum + let find_match_arms = generate_match_arms(variants, "find"); + let results_match_arms = generate_results_match_arms(variants); + let get_result_match_arms = generate_match_arms(variants, "get_result"); + let result_count_match_arms = + generate_match_arms(variants, "result_count"); + let total_count_match_arms = generate_match_arms(variants, "total_count"); + + // Generate the final implementation + let gen = quote! { + impl #name { + pub fn find(&mut self, pattern: &str) { + match self { + #find_match_arms + } + } + + pub fn results(&mut self, num_entries: u32, offset: u32) -> Vec { + match self { + #results_match_arms + } + } + + pub fn get_result(&self, index: u32) -> Option { + match self { + #get_result_match_arms + } + } + + pub fn result_count(&self) -> u32 { + match self { + #result_count_match_arms + } + } + + pub fn total_count(&self) -> u32 { + match self { + #total_count_match_arms + } + } + } + }; + + gen.into() +} + +fn generate_results_match_arms( + variants: &syn::punctuated::Punctuated, +) -> proc_macro2::TokenStream { + let arms = variants.iter().map(|variant| { + let variant_name = &variant.ident; + quote! { + Self::#variant_name(channel) => channel.finder.results(num_entries, offset).collect() + } + }); + + quote! { + #(#arms),* + } +} + +fn generate_match_arms( + variants: &syn::punctuated::Punctuated, + method_name: &str, +) -> proc_macro2::TokenStream { + let method = quote::format_ident!("{method_name}"); + let arms = variants.iter().map(|variant| { + let variant_name = &variant.ident; + let args = method_name_args(method_name); + + quote! { + Self::#variant_name(channel) => channel.finder.#method(#(#args),*) + } + }); + + quote! { + #(#arms),* + } +} + +fn method_name_args(method_name: &str) -> Vec { + match method_name { + "find" => { + vec![quote::format_ident!("pattern")] + } + "get_result" => vec![quote::format_ident!("index")], + _ => vec![], + } +} + +#[proc_macro_derive(ConcreteChannel)] +pub fn concrete_channel_derive(input: TokenStream) -> TokenStream { + // Construct a representation of Rust code as a syntax tree + // that we can manipulate + let ast = syn::parse(input).unwrap(); + + // Build the trait implementation + impl_concrete_channel(&ast) +} + +fn impl_concrete_channel(ast: &syn::DeriveInput) -> TokenStream { + let name = &ast.ident; + + // check that macro is applied to a struct + let syn::Data::Struct(item_struct) = &ast.data else { + panic!("#[derive(ConcreteChannel)] is only defined for structs"); + }; + + // check that the struct has a field named `finder` + let finder_field = item_struct + .fields + .iter() + .find(|field| { + field + .ident + .as_ref() + .map_or(false, |ident| ident == "finder") + }) + .expect("Struct must have a field named `finder`"); + + // Get the type of the finder field + let finder_type = &finder_field.ty; + + quote! { + impl #name { + pub fn new() -> Self { + Self { + finder: #finder_type::new(), + } + } + } + } + .into() +} + +#[proc_macro_derive(FromCliChannel)] +pub fn from_cli_channel_derive(input: TokenStream) -> TokenStream { + // Construct a representation of Rust code as a syntax tree + // that we can manipulate + let ast = syn::parse(input).unwrap(); + + // Build the trait implementation + impl_from_cli_channel(&ast) +} + +fn impl_from_cli_channel(ast: &syn::DeriveInput) -> TokenStream { + // check that the struct is an enum + let variants = if let syn::Data::Enum(data_enum) = &ast.data { + &data_enum.variants + } else { + panic!("#[derive(Channel)] is only defined for enums"); + }; + + // check that the enum has at least one variant + assert!( + !variants.is_empty(), + "#[derive(Channel)] requires at least one variant" + ); + + let arms = variants.iter().map(|variant| { + let variant_name = &variant.ident; + + // Get the inner type of the variant, assuming it is the first field of the variant + if let syn::Fields::Unnamed(fields) = &variant.fields { + if fields.unnamed.len() == 1 { + // Get the inner type of the variant (e.g., EnvChannel) + let inner_type = &fields.unnamed[0].ty; + + quote! { + CliTvChannel::#variant_name => TvChannel::#variant_name(#inner_type::new()) + } + } else { + panic!("Enum variants should have exactly one unnamed field."); + } + } else { + panic!("Enum variants expected to only have unnamed fields."); + } + }); + + let gen = quote! { + impl From for TvChannel { + fn from(channel: CliTvChannel) -> Self { + match channel { + #(#arms),* + } + } + } + }; + + gen.into() +} diff --git a/crates/television_derive/target/.rustc_info.json b/crates/television_derive/target/.rustc_info.json new file mode 100644 index 0000000..b3cad07 --- /dev/null +++ b/crates/television_derive/target/.rustc_info.json @@ -0,0 +1 @@ +{"rustc_fingerprint":17980599022364842445,"outputs":{"15611795083382425170":{"success":true,"status":"","code":0,"stdout":"rustc 1.81.0 (eeb90cda1 2024-09-04)\nbinary: rustc\ncommit-hash: eeb90cda1969383f56a2637cbd3037bdf598841c\ncommit-date: 2024-09-04\nhost: aarch64-apple-darwin\nrelease: 1.81.0\nLLVM version: 18.1.7\n","stderr":""},"16202457509552398077":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n","stderr":""},"1185988223601034215":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/Users/alex/.rustup/toolchains/stable-aarch64-apple-darwin\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"aes\"\ntarget_feature=\"crc\"\ntarget_feature=\"dit\"\ntarget_feature=\"dotprod\"\ntarget_feature=\"dpb\"\ntarget_feature=\"dpb2\"\ntarget_feature=\"fcma\"\ntarget_feature=\"fhm\"\ntarget_feature=\"flagm\"\ntarget_feature=\"fp16\"\ntarget_feature=\"frintts\"\ntarget_feature=\"jsconv\"\ntarget_feature=\"lor\"\ntarget_feature=\"lse\"\ntarget_feature=\"neon\"\ntarget_feature=\"paca\"\ntarget_feature=\"pacg\"\ntarget_feature=\"pan\"\ntarget_feature=\"pmuv3\"\ntarget_feature=\"ras\"\ntarget_feature=\"rcpc\"\ntarget_feature=\"rcpc2\"\ntarget_feature=\"rdm\"\ntarget_feature=\"sb\"\ntarget_feature=\"sha2\"\ntarget_feature=\"sha3\"\ntarget_feature=\"ssbs\"\ntarget_feature=\"vh\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""}},"successes":{}} \ No newline at end of file diff --git a/crates/television_derive/target/CACHEDIR.TAG b/crates/television_derive/target/CACHEDIR.TAG new file mode 100644 index 0000000..20d7c31 --- /dev/null +++ b/crates/television_derive/target/CACHEDIR.TAG @@ -0,0 +1,3 @@ +Signature: 8a477f597d28d172789f06886806bc55 +# This file is a cache directory tag created by cargo. +# For information about cache directory tags see https://bford.info/cachedir/ diff --git a/crates/television_derive/target/debug/.cargo-lock b/crates/television_derive/target/debug/.cargo-lock new file mode 100644 index 0000000..e69de29 diff --git a/crates/television_derive/target/debug/.fingerprint/channel_derive-5e8fb919fdc9892e/dep-lib-channel_derive b/crates/television_derive/target/debug/.fingerprint/channel_derive-5e8fb919fdc9892e/dep-lib-channel_derive new file mode 100644 index 0000000..da1fefe Binary files /dev/null and b/crates/television_derive/target/debug/.fingerprint/channel_derive-5e8fb919fdc9892e/dep-lib-channel_derive differ diff --git a/crates/television_derive/target/debug/.fingerprint/channel_derive-5e8fb919fdc9892e/invoked.timestamp b/crates/television_derive/target/debug/.fingerprint/channel_derive-5e8fb919fdc9892e/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/channel_derive-5e8fb919fdc9892e/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/channel_derive-5e8fb919fdc9892e/lib-channel_derive b/crates/television_derive/target/debug/.fingerprint/channel_derive-5e8fb919fdc9892e/lib-channel_derive new file mode 100644 index 0000000..8b8d658 --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/channel_derive-5e8fb919fdc9892e/lib-channel_derive @@ -0,0 +1 @@ +f4ebb3ca05eda080 \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/channel_derive-5e8fb919fdc9892e/lib-channel_derive.json b/crates/television_derive/target/debug/.fingerprint/channel_derive-5e8fb919fdc9892e/lib-channel_derive.json new file mode 100644 index 0000000..72d76c5 --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/channel_derive-5e8fb919fdc9892e/lib-channel_derive.json @@ -0,0 +1 @@ +{"rustc":14389903092037495548,"features":"[]","declared_features":"[]","target":7526643999243412900,"profile":10029161205263967479,"path":17777289886553719987,"deps":[[8180367827966864057,"syn",false,8196416219374135044],[16925618668213040772,"quote",false,10271263618439775921]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/channel_derive-5e8fb919fdc9892e/dep-lib-channel_derive"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/channel_derive-5e8fb919fdc9892e/output-lib-channel_derive b/crates/television_derive/target/debug/.fingerprint/channel_derive-5e8fb919fdc9892e/output-lib-channel_derive new file mode 100644 index 0000000..1c3c0ba --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/channel_derive-5e8fb919fdc9892e/output-lib-channel_derive @@ -0,0 +1,2 @@ +{"$message_type":"diagnostic","message":"docs for function which may panic missing `# Panics` section","code":{"code":"clippy::missing_panics_doc","explanation":null},"level":"warning","spans":[{"file_name":"src/lib.rs","byte_start":78,"byte_end":134,"line_start":5,"line_end":5,"column_start":1,"column_end":57,"is_primary":true,"text":[{"text":"pub fn channel_derive(input: TokenStream) -> TokenStream {","highlight_start":1,"highlight_end":57}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"first possible panic found here","code":null,"level":"note","spans":[{"file_name":"src/lib.rs","byte_start":245,"byte_end":271,"line_start":8,"line_end":8,"column_start":15,"column_end":41,"is_primary":true,"text":[{"text":" let ast = syn::parse(input).unwrap();","highlight_start":15,"highlight_end":41}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"`-W clippy::missing-panics-doc` implied by `-W clippy::pedantic`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"to override `-W clippy::pedantic` add `#[allow(clippy::missing_panics_doc)]`","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: docs for function which may panic missing `# Panics` section\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/lib.rs:5:1\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m5\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0mpub fn channel_derive(input: TokenStream) -> TokenStream {\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;10mnote\u001b[0m\u001b[0m: first possible panic found here\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/lib.rs:8:15\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m8\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m let ast = syn::parse(input).unwrap();\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;10m^^^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mhelp\u001b[0m\u001b[0m: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `-W clippy::missing-panics-doc` implied by `-W clippy::pedantic`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mhelp\u001b[0m\u001b[0m: to override `-W clippy::pedantic` add `#[allow(clippy::missing_panics_doc)]`\u001b[0m\n\n"} +{"$message_type":"diagnostic","message":"1 warning emitted","code":null,"level":"warning","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: 1 warning emitted\u001b[0m\n\n"} diff --git a/crates/television_derive/target/debug/.fingerprint/channel_derive-7fb3b3130bcedc8b/dep-test-lib-channel_derive b/crates/television_derive/target/debug/.fingerprint/channel_derive-7fb3b3130bcedc8b/dep-test-lib-channel_derive new file mode 100644 index 0000000..da1fefe Binary files /dev/null and b/crates/television_derive/target/debug/.fingerprint/channel_derive-7fb3b3130bcedc8b/dep-test-lib-channel_derive differ diff --git a/crates/television_derive/target/debug/.fingerprint/channel_derive-7fb3b3130bcedc8b/invoked.timestamp b/crates/television_derive/target/debug/.fingerprint/channel_derive-7fb3b3130bcedc8b/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/channel_derive-7fb3b3130bcedc8b/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/channel_derive-7fb3b3130bcedc8b/output-test-lib-channel_derive b/crates/television_derive/target/debug/.fingerprint/channel_derive-7fb3b3130bcedc8b/output-test-lib-channel_derive new file mode 100644 index 0000000..1c3c0ba --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/channel_derive-7fb3b3130bcedc8b/output-test-lib-channel_derive @@ -0,0 +1,2 @@ +{"$message_type":"diagnostic","message":"docs for function which may panic missing `# Panics` section","code":{"code":"clippy::missing_panics_doc","explanation":null},"level":"warning","spans":[{"file_name":"src/lib.rs","byte_start":78,"byte_end":134,"line_start":5,"line_end":5,"column_start":1,"column_end":57,"is_primary":true,"text":[{"text":"pub fn channel_derive(input: TokenStream) -> TokenStream {","highlight_start":1,"highlight_end":57}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"first possible panic found here","code":null,"level":"note","spans":[{"file_name":"src/lib.rs","byte_start":245,"byte_end":271,"line_start":8,"line_end":8,"column_start":15,"column_end":41,"is_primary":true,"text":[{"text":" let ast = syn::parse(input).unwrap();","highlight_start":15,"highlight_end":41}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"`-W clippy::missing-panics-doc` implied by `-W clippy::pedantic`","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"to override `-W clippy::pedantic` add `#[allow(clippy::missing_panics_doc)]`","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: docs for function which may panic missing `# Panics` section\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/lib.rs:5:1\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m5\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0mpub fn channel_derive(input: TokenStream) -> TokenStream {\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;10mnote\u001b[0m\u001b[0m: first possible panic found here\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/lib.rs:8:15\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m8\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m let ast = syn::parse(input).unwrap();\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;10m^^^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mhelp\u001b[0m\u001b[0m: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: `-W clippy::missing-panics-doc` implied by `-W clippy::pedantic`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mhelp\u001b[0m\u001b[0m: to override `-W clippy::pedantic` add `#[allow(clippy::missing_panics_doc)]`\u001b[0m\n\n"} +{"$message_type":"diagnostic","message":"1 warning emitted","code":null,"level":"warning","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[33mwarning\u001b[0m\u001b[0m\u001b[1m: 1 warning emitted\u001b[0m\n\n"} diff --git a/crates/television_derive/target/debug/.fingerprint/channel_derive-7fb3b3130bcedc8b/test-lib-channel_derive b/crates/television_derive/target/debug/.fingerprint/channel_derive-7fb3b3130bcedc8b/test-lib-channel_derive new file mode 100644 index 0000000..cc2ab9f --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/channel_derive-7fb3b3130bcedc8b/test-lib-channel_derive @@ -0,0 +1 @@ +143c40e7f8c2ab0c \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/channel_derive-7fb3b3130bcedc8b/test-lib-channel_derive.json b/crates/television_derive/target/debug/.fingerprint/channel_derive-7fb3b3130bcedc8b/test-lib-channel_derive.json new file mode 100644 index 0000000..4efa07e --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/channel_derive-7fb3b3130bcedc8b/test-lib-channel_derive.json @@ -0,0 +1 @@ +{"rustc":14389903092037495548,"features":"[]","declared_features":"[]","target":7526643999243412900,"profile":16589926208341333925,"path":17777289886553719987,"deps":[[8180367827966864057,"syn",false,8196416219374135044],[16925618668213040772,"quote",false,10271263618439775921]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/channel_derive-7fb3b3130bcedc8b/dep-test-lib-channel_derive"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/channel_derive-a35066bcb3df10a7/invoked.timestamp b/crates/television_derive/target/debug/.fingerprint/channel_derive-a35066bcb3df10a7/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/channel_derive-a35066bcb3df10a7/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/channel_derive-a35066bcb3df10a7/test-lib-channel_derive b/crates/television_derive/target/debug/.fingerprint/channel_derive-a35066bcb3df10a7/test-lib-channel_derive new file mode 100644 index 0000000..604061a --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/channel_derive-a35066bcb3df10a7/test-lib-channel_derive @@ -0,0 +1 @@ +6af783cc4b4e3fa1 \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/channel_derive-a35066bcb3df10a7/test-lib-channel_derive.json b/crates/television_derive/target/debug/.fingerprint/channel_derive-a35066bcb3df10a7/test-lib-channel_derive.json new file mode 100644 index 0000000..a199c26 --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/channel_derive-a35066bcb3df10a7/test-lib-channel_derive.json @@ -0,0 +1 @@ +{"rustc":14389903092037495548,"features":"[]","declared_features":"[]","target":7526643999243412900,"profile":16589926208341333925,"path":17777289886553719987,"deps":[[8180367827966864057,"syn",false,8196416219374135044],[16925618668213040772,"quote",false,10271263618439775921]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/channel_derive-a35066bcb3df10a7/dep-test-lib-channel_derive"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/channel_derive-dc2031a8c46f08b7/invoked.timestamp b/crates/television_derive/target/debug/.fingerprint/channel_derive-dc2031a8c46f08b7/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/channel_derive-dc2031a8c46f08b7/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/channel_derive-dc2031a8c46f08b7/lib-channel_derive b/crates/television_derive/target/debug/.fingerprint/channel_derive-dc2031a8c46f08b7/lib-channel_derive new file mode 100644 index 0000000..7b10c5c --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/channel_derive-dc2031a8c46f08b7/lib-channel_derive @@ -0,0 +1 @@ +932b3208aac8e8ec \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/channel_derive-dc2031a8c46f08b7/lib-channel_derive.json b/crates/television_derive/target/debug/.fingerprint/channel_derive-dc2031a8c46f08b7/lib-channel_derive.json new file mode 100644 index 0000000..aee9841 --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/channel_derive-dc2031a8c46f08b7/lib-channel_derive.json @@ -0,0 +1 @@ +{"rustc":14389903092037495548,"features":"[]","declared_features":"[]","target":7526643999243412900,"profile":10029161205263967479,"path":17777289886553719987,"deps":[[8180367827966864057,"syn",false,8196416219374135044],[16925618668213040772,"quote",false,10271263618439775921]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/channel_derive-dc2031a8c46f08b7/dep-lib-channel_derive"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/proc-macro2-1e5db432941f8ae7/dep-lib-proc_macro2 b/crates/television_derive/target/debug/.fingerprint/proc-macro2-1e5db432941f8ae7/dep-lib-proc_macro2 new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/crates/television_derive/target/debug/.fingerprint/proc-macro2-1e5db432941f8ae7/dep-lib-proc_macro2 differ diff --git a/crates/television_derive/target/debug/.fingerprint/proc-macro2-1e5db432941f8ae7/invoked.timestamp b/crates/television_derive/target/debug/.fingerprint/proc-macro2-1e5db432941f8ae7/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/proc-macro2-1e5db432941f8ae7/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/proc-macro2-1e5db432941f8ae7/lib-proc_macro2 b/crates/television_derive/target/debug/.fingerprint/proc-macro2-1e5db432941f8ae7/lib-proc_macro2 new file mode 100644 index 0000000..ef0e9ff --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/proc-macro2-1e5db432941f8ae7/lib-proc_macro2 @@ -0,0 +1 @@ +0597378a3bc3a079 \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/proc-macro2-1e5db432941f8ae7/lib-proc_macro2.json b/crates/television_derive/target/debug/.fingerprint/proc-macro2-1e5db432941f8ae7/lib-proc_macro2.json new file mode 100644 index 0000000..3851795 --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/proc-macro2-1e5db432941f8ae7/lib-proc_macro2.json @@ -0,0 +1 @@ +{"rustc":14389903092037495548,"features":"[\"proc-macro\"]","declared_features":"[\"default\", \"nightly\", \"proc-macro\", \"span-locations\"]","target":13874121960490935825,"profile":8361196460932112400,"path":6913994213716067446,"deps":[[1688084612972536959,"build_script_build",false,15186161664998666499],[11851334758748276410,"unicode_ident",false,13171138785117072385]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/proc-macro2-1e5db432941f8ae7/dep-lib-proc_macro2"}}],"rustflags":[],"metadata":7635439851376710101,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/proc-macro2-2771d24383a1e016/build-script-build-script-build b/crates/television_derive/target/debug/.fingerprint/proc-macro2-2771d24383a1e016/build-script-build-script-build new file mode 100644 index 0000000..6394b6c --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/proc-macro2-2771d24383a1e016/build-script-build-script-build @@ -0,0 +1 @@ +e181b26938f22894 \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/proc-macro2-2771d24383a1e016/build-script-build-script-build.json b/crates/television_derive/target/debug/.fingerprint/proc-macro2-2771d24383a1e016/build-script-build-script-build.json new file mode 100644 index 0000000..fea0d82 --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/proc-macro2-2771d24383a1e016/build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":14389903092037495548,"features":"[\"proc-macro\"]","declared_features":"[\"default\", \"nightly\", \"proc-macro\", \"span-locations\"]","target":9652763411108993936,"profile":6707562999592697545,"path":12070634434057761320,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/proc-macro2-2771d24383a1e016/dep-build-script-build-script-build"}}],"rustflags":[],"metadata":7635439851376710101,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/proc-macro2-2771d24383a1e016/dep-build-script-build-script-build b/crates/television_derive/target/debug/.fingerprint/proc-macro2-2771d24383a1e016/dep-build-script-build-script-build new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/crates/television_derive/target/debug/.fingerprint/proc-macro2-2771d24383a1e016/dep-build-script-build-script-build differ diff --git a/crates/television_derive/target/debug/.fingerprint/proc-macro2-2771d24383a1e016/invoked.timestamp b/crates/television_derive/target/debug/.fingerprint/proc-macro2-2771d24383a1e016/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/proc-macro2-2771d24383a1e016/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/proc-macro2-30968231008c2290/run-build-script-build-script-build b/crates/television_derive/target/debug/.fingerprint/proc-macro2-30968231008c2290/run-build-script-build-script-build new file mode 100644 index 0000000..1d85533 --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/proc-macro2-30968231008c2290/run-build-script-build-script-build @@ -0,0 +1 @@ +0371e6179315c0d2 \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/proc-macro2-30968231008c2290/run-build-script-build-script-build.json b/crates/television_derive/target/debug/.fingerprint/proc-macro2-30968231008c2290/run-build-script-build-script-build.json new file mode 100644 index 0000000..f8da641 --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/proc-macro2-30968231008c2290/run-build-script-build-script-build.json @@ -0,0 +1 @@ +{"rustc":14389903092037495548,"features":"","declared_features":"","target":0,"profile":0,"path":0,"deps":[[1688084612972536959,"build_script_build",false,10676049240787157473]],"local":[{"RerunIfChanged":{"output":"debug/build/proc-macro2-30968231008c2290/output","paths":["build/probe.rs"]}},{"RerunIfEnvChanged":{"var":"RUSTC_BOOTSTRAP","val":null}}],"rustflags":[],"metadata":0,"config":0,"compile_kind":0} \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/quote-a8bd974a517d1785/dep-lib-quote b/crates/television_derive/target/debug/.fingerprint/quote-a8bd974a517d1785/dep-lib-quote new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/crates/television_derive/target/debug/.fingerprint/quote-a8bd974a517d1785/dep-lib-quote differ diff --git a/crates/television_derive/target/debug/.fingerprint/quote-a8bd974a517d1785/invoked.timestamp b/crates/television_derive/target/debug/.fingerprint/quote-a8bd974a517d1785/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/quote-a8bd974a517d1785/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/quote-a8bd974a517d1785/lib-quote b/crates/television_derive/target/debug/.fingerprint/quote-a8bd974a517d1785/lib-quote new file mode 100644 index 0000000..caa4951 --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/quote-a8bd974a517d1785/lib-quote @@ -0,0 +1 @@ +b1067f6bd7db8a8e \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/quote-a8bd974a517d1785/lib-quote.json b/crates/television_derive/target/debug/.fingerprint/quote-a8bd974a517d1785/lib-quote.json new file mode 100644 index 0000000..7c52249 --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/quote-a8bd974a517d1785/lib-quote.json @@ -0,0 +1 @@ +{"rustc":14389903092037495548,"features":"[\"default\", \"proc-macro\"]","declared_features":"[\"default\", \"proc-macro\"]","target":10650096451693058429,"profile":8361196460932112400,"path":7826173603576530963,"deps":[[1688084612972536959,"proc_macro2",false,8764219535352370949]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/quote-a8bd974a517d1785/dep-lib-quote"}}],"rustflags":[],"metadata":2717943770976187624,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/syn-e90aa3fa411e87ff/dep-lib-syn b/crates/television_derive/target/debug/.fingerprint/syn-e90aa3fa411e87ff/dep-lib-syn new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/crates/television_derive/target/debug/.fingerprint/syn-e90aa3fa411e87ff/dep-lib-syn differ diff --git a/crates/television_derive/target/debug/.fingerprint/syn-e90aa3fa411e87ff/invoked.timestamp b/crates/television_derive/target/debug/.fingerprint/syn-e90aa3fa411e87ff/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/syn-e90aa3fa411e87ff/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/syn-e90aa3fa411e87ff/lib-syn b/crates/television_derive/target/debug/.fingerprint/syn-e90aa3fa411e87ff/lib-syn new file mode 100644 index 0000000..9c80313 --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/syn-e90aa3fa411e87ff/lib-syn @@ -0,0 +1 @@ +04a70b032085bf71 \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/syn-e90aa3fa411e87ff/lib-syn.json b/crates/television_derive/target/debug/.fingerprint/syn-e90aa3fa411e87ff/lib-syn.json new file mode 100644 index 0000000..1980747 --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/syn-e90aa3fa411e87ff/lib-syn.json @@ -0,0 +1 @@ +{"rustc":14389903092037495548,"features":"[\"clone-impls\", \"default\", \"derive\", \"parsing\", \"printing\", \"proc-macro\"]","declared_features":"[\"clone-impls\", \"default\", \"derive\", \"extra-traits\", \"fold\", \"full\", \"parsing\", \"printing\", \"proc-macro\", \"test\", \"visit\", \"visit-mut\"]","target":9575650141617900057,"profile":8361196460932112400,"path":8726087688326474690,"deps":[[1688084612972536959,"proc_macro2",false,8764219535352370949],[11851334758748276410,"unicode_ident",false,13171138785117072385],[16925618668213040772,"quote",false,10271263618439775921]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/syn-e90aa3fa411e87ff/dep-lib-syn"}}],"rustflags":[],"metadata":6886477143387768027,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/unicode-ident-c9d91f5d3d06fab1/dep-lib-unicode_ident b/crates/television_derive/target/debug/.fingerprint/unicode-ident-c9d91f5d3d06fab1/dep-lib-unicode_ident new file mode 100644 index 0000000..1b1cb4d Binary files /dev/null and b/crates/television_derive/target/debug/.fingerprint/unicode-ident-c9d91f5d3d06fab1/dep-lib-unicode_ident differ diff --git a/crates/television_derive/target/debug/.fingerprint/unicode-ident-c9d91f5d3d06fab1/invoked.timestamp b/crates/television_derive/target/debug/.fingerprint/unicode-ident-c9d91f5d3d06fab1/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/unicode-ident-c9d91f5d3d06fab1/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/unicode-ident-c9d91f5d3d06fab1/lib-unicode_ident b/crates/television_derive/target/debug/.fingerprint/unicode-ident-c9d91f5d3d06fab1/lib-unicode_ident new file mode 100644 index 0000000..12fc58b --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/unicode-ident-c9d91f5d3d06fab1/lib-unicode_ident @@ -0,0 +1 @@ +01ec45fef048c9b6 \ No newline at end of file diff --git a/crates/television_derive/target/debug/.fingerprint/unicode-ident-c9d91f5d3d06fab1/lib-unicode_ident.json b/crates/television_derive/target/debug/.fingerprint/unicode-ident-c9d91f5d3d06fab1/lib-unicode_ident.json new file mode 100644 index 0000000..08484b0 --- /dev/null +++ b/crates/television_derive/target/debug/.fingerprint/unicode-ident-c9d91f5d3d06fab1/lib-unicode_ident.json @@ -0,0 +1 @@ +{"rustc":14389903092037495548,"features":"[]","declared_features":"[]","target":12667241341363605998,"profile":8361196460932112400,"path":12085627184887373577,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/unicode-ident-c9d91f5d3d06fab1/dep-lib-unicode_ident"}}],"rustflags":[],"metadata":1159190378059262574,"config":2202906307356721367,"compile_kind":0} \ No newline at end of file diff --git a/crates/television_derive/target/debug/build/proc-macro2-2771d24383a1e016/build-script-build b/crates/television_derive/target/debug/build/proc-macro2-2771d24383a1e016/build-script-build new file mode 100755 index 0000000..d313240 Binary files /dev/null and b/crates/television_derive/target/debug/build/proc-macro2-2771d24383a1e016/build-script-build differ diff --git a/crates/television_derive/target/debug/build/proc-macro2-2771d24383a1e016/build_script_build-2771d24383a1e016 b/crates/television_derive/target/debug/build/proc-macro2-2771d24383a1e016/build_script_build-2771d24383a1e016 new file mode 100755 index 0000000..d313240 Binary files /dev/null and b/crates/television_derive/target/debug/build/proc-macro2-2771d24383a1e016/build_script_build-2771d24383a1e016 differ diff --git a/crates/television_derive/target/debug/build/proc-macro2-2771d24383a1e016/build_script_build-2771d24383a1e016.d b/crates/television_derive/target/debug/build/proc-macro2-2771d24383a1e016/build_script_build-2771d24383a1e016.d new file mode 100644 index 0000000..27fdf31 --- /dev/null +++ b/crates/television_derive/target/debug/build/proc-macro2-2771d24383a1e016/build_script_build-2771d24383a1e016.d @@ -0,0 +1,5 @@ +/Users/alex/code/rust/television-rs/crates/channel_derive/target/debug/build/proc-macro2-2771d24383a1e016/build_script_build-2771d24383a1e016: /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/build.rs + +/Users/alex/code/rust/television-rs/crates/channel_derive/target/debug/build/proc-macro2-2771d24383a1e016/build_script_build-2771d24383a1e016.d: /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/build.rs + +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/build.rs: diff --git a/crates/television_derive/target/debug/build/proc-macro2-30968231008c2290/invoked.timestamp b/crates/television_derive/target/debug/build/proc-macro2-30968231008c2290/invoked.timestamp new file mode 100644 index 0000000..e00328d --- /dev/null +++ b/crates/television_derive/target/debug/build/proc-macro2-30968231008c2290/invoked.timestamp @@ -0,0 +1 @@ +This file has an mtime of when this was started. \ No newline at end of file diff --git a/crates/television_derive/target/debug/build/proc-macro2-30968231008c2290/out/proc_macro2.d b/crates/television_derive/target/debug/build/proc-macro2-30968231008c2290/out/proc_macro2.d new file mode 100644 index 0000000..791f2ae --- /dev/null +++ b/crates/television_derive/target/debug/build/proc-macro2-30968231008c2290/out/proc_macro2.d @@ -0,0 +1,7 @@ +/Users/alex/code/rust/television-rs/crates/channel_derive/target/debug/build/proc-macro2-30968231008c2290/out/libproc_macro2.rmeta: build/probe.rs + +/Users/alex/code/rust/television-rs/crates/channel_derive/target/debug/build/proc-macro2-30968231008c2290/out/proc_macro2.d: build/probe.rs + +build/probe.rs: + +# env-dep:RUSTC_BOOTSTRAP diff --git a/crates/television_derive/target/debug/build/proc-macro2-30968231008c2290/output b/crates/television_derive/target/debug/build/proc-macro2-30968231008c2290/output new file mode 100644 index 0000000..a3cdc7c --- /dev/null +++ b/crates/television_derive/target/debug/build/proc-macro2-30968231008c2290/output @@ -0,0 +1,16 @@ +cargo:rustc-check-cfg=cfg(fuzzing) +cargo:rustc-check-cfg=cfg(no_is_available) +cargo:rustc-check-cfg=cfg(no_literal_byte_character) +cargo:rustc-check-cfg=cfg(no_literal_c_string) +cargo:rustc-check-cfg=cfg(no_source_text) +cargo:rustc-check-cfg=cfg(proc_macro_span) +cargo:rustc-check-cfg=cfg(procmacro2_backtrace) +cargo:rustc-check-cfg=cfg(procmacro2_nightly_testing) +cargo:rustc-check-cfg=cfg(procmacro2_semver_exempt) +cargo:rustc-check-cfg=cfg(randomize_layout) +cargo:rustc-check-cfg=cfg(span_locations) +cargo:rustc-check-cfg=cfg(super_unstable) +cargo:rustc-check-cfg=cfg(wrap_proc_macro) +cargo:rerun-if-changed=build/probe.rs +cargo:rustc-cfg=wrap_proc_macro +cargo:rerun-if-env-changed=RUSTC_BOOTSTRAP diff --git a/crates/television_derive/target/debug/build/proc-macro2-30968231008c2290/root-output b/crates/television_derive/target/debug/build/proc-macro2-30968231008c2290/root-output new file mode 100644 index 0000000..7a8c073 --- /dev/null +++ b/crates/television_derive/target/debug/build/proc-macro2-30968231008c2290/root-output @@ -0,0 +1 @@ +/Users/alex/code/rust/television-rs/crates/channel_derive/target/debug/build/proc-macro2-30968231008c2290/out \ No newline at end of file diff --git a/crates/television_derive/target/debug/build/proc-macro2-30968231008c2290/stderr b/crates/television_derive/target/debug/build/proc-macro2-30968231008c2290/stderr new file mode 100644 index 0000000..e69de29 diff --git a/crates/television_derive/target/debug/deps/channel_derive-5e8fb919fdc9892e.d b/crates/television_derive/target/debug/deps/channel_derive-5e8fb919fdc9892e.d new file mode 100644 index 0000000..b180a71 --- /dev/null +++ b/crates/television_derive/target/debug/deps/channel_derive-5e8fb919fdc9892e.d @@ -0,0 +1,9 @@ +/Users/alex/code/rust/television-rs/crates/channel_derive/target/debug/deps/libchannel_derive-5e8fb919fdc9892e.rmeta: src/lib.rs Cargo.toml + +/Users/alex/code/rust/television-rs/crates/channel_derive/target/debug/deps/channel_derive-5e8fb919fdc9892e.d: src/lib.rs Cargo.toml + +src/lib.rs: +Cargo.toml: + +# env-dep:CLIPPY_ARGS=--no-deps__CLIPPY_HACKERY__-Dclippy::correctness__CLIPPY_HACKERY__-Dclippy::complexity__CLIPPY_HACKERY__-Wclippy::perf__CLIPPY_HACKERY__-Wclippy::pedantic__CLIPPY_HACKERY__ +# env-dep:CLIPPY_CONF_DIR diff --git a/crates/television_derive/target/debug/deps/channel_derive-7fb3b3130bcedc8b.d b/crates/television_derive/target/debug/deps/channel_derive-7fb3b3130bcedc8b.d new file mode 100644 index 0000000..0f76ee9 --- /dev/null +++ b/crates/television_derive/target/debug/deps/channel_derive-7fb3b3130bcedc8b.d @@ -0,0 +1,9 @@ +/Users/alex/code/rust/television-rs/crates/channel_derive/target/debug/deps/libchannel_derive-7fb3b3130bcedc8b.rmeta: src/lib.rs Cargo.toml + +/Users/alex/code/rust/television-rs/crates/channel_derive/target/debug/deps/channel_derive-7fb3b3130bcedc8b.d: src/lib.rs Cargo.toml + +src/lib.rs: +Cargo.toml: + +# env-dep:CLIPPY_ARGS=--no-deps__CLIPPY_HACKERY__-Dclippy::correctness__CLIPPY_HACKERY__-Dclippy::complexity__CLIPPY_HACKERY__-Wclippy::perf__CLIPPY_HACKERY__-Wclippy::pedantic__CLIPPY_HACKERY__ +# env-dep:CLIPPY_CONF_DIR diff --git a/crates/television_derive/target/debug/deps/libchannel_derive-5e8fb919fdc9892e.rmeta b/crates/television_derive/target/debug/deps/libchannel_derive-5e8fb919fdc9892e.rmeta new file mode 100644 index 0000000..aaedf9a Binary files /dev/null and b/crates/television_derive/target/debug/deps/libchannel_derive-5e8fb919fdc9892e.rmeta differ diff --git a/crates/television_derive/target/debug/deps/libchannel_derive-7fb3b3130bcedc8b.rmeta b/crates/television_derive/target/debug/deps/libchannel_derive-7fb3b3130bcedc8b.rmeta new file mode 100644 index 0000000..e69de29 diff --git a/crates/television_derive/target/debug/deps/libproc_macro2-1e5db432941f8ae7.rmeta b/crates/television_derive/target/debug/deps/libproc_macro2-1e5db432941f8ae7.rmeta new file mode 100644 index 0000000..271db0a Binary files /dev/null and b/crates/television_derive/target/debug/deps/libproc_macro2-1e5db432941f8ae7.rmeta differ diff --git a/crates/television_derive/target/debug/deps/libquote-a8bd974a517d1785.rmeta b/crates/television_derive/target/debug/deps/libquote-a8bd974a517d1785.rmeta new file mode 100644 index 0000000..ed855ad Binary files /dev/null and b/crates/television_derive/target/debug/deps/libquote-a8bd974a517d1785.rmeta differ diff --git a/crates/television_derive/target/debug/deps/libsyn-e90aa3fa411e87ff.rmeta b/crates/television_derive/target/debug/deps/libsyn-e90aa3fa411e87ff.rmeta new file mode 100644 index 0000000..6b7b3eb Binary files /dev/null and b/crates/television_derive/target/debug/deps/libsyn-e90aa3fa411e87ff.rmeta differ diff --git a/crates/television_derive/target/debug/deps/libunicode_ident-c9d91f5d3d06fab1.rmeta b/crates/television_derive/target/debug/deps/libunicode_ident-c9d91f5d3d06fab1.rmeta new file mode 100644 index 0000000..7fd31fb Binary files /dev/null and b/crates/television_derive/target/debug/deps/libunicode_ident-c9d91f5d3d06fab1.rmeta differ diff --git a/crates/television_derive/target/debug/deps/proc_macro2-1e5db432941f8ae7.d b/crates/television_derive/target/debug/deps/proc_macro2-1e5db432941f8ae7.d new file mode 100644 index 0000000..3378d16 --- /dev/null +++ b/crates/television_derive/target/debug/deps/proc_macro2-1e5db432941f8ae7.d @@ -0,0 +1,12 @@ +/Users/alex/code/rust/television-rs/crates/channel_derive/target/debug/deps/libproc_macro2-1e5db432941f8ae7.rmeta: /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/lib.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/marker.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/parse.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/rcvec.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/detection.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/fallback.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/extra.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/wrapper.rs + +/Users/alex/code/rust/television-rs/crates/channel_derive/target/debug/deps/proc_macro2-1e5db432941f8ae7.d: /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/lib.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/marker.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/parse.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/rcvec.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/detection.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/fallback.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/extra.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/wrapper.rs + +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/lib.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/marker.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/parse.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/rcvec.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/detection.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/fallback.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/extra.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.87/src/wrapper.rs: diff --git a/crates/television_derive/target/debug/deps/quote-a8bd974a517d1785.d b/crates/television_derive/target/debug/deps/quote-a8bd974a517d1785.d new file mode 100644 index 0000000..174802e --- /dev/null +++ b/crates/television_derive/target/debug/deps/quote-a8bd974a517d1785.d @@ -0,0 +1,11 @@ +/Users/alex/code/rust/television-rs/crates/channel_derive/target/debug/deps/libquote-a8bd974a517d1785.rmeta: /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/lib.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/ext.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/format.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/ident_fragment.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/to_tokens.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/runtime.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/spanned.rs + +/Users/alex/code/rust/television-rs/crates/channel_derive/target/debug/deps/quote-a8bd974a517d1785.d: /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/lib.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/ext.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/format.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/ident_fragment.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/to_tokens.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/runtime.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/spanned.rs + +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/lib.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/ext.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/format.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/ident_fragment.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/to_tokens.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/runtime.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/quote-1.0.37/src/spanned.rs: diff --git a/crates/television_derive/target/debug/deps/syn-e90aa3fa411e87ff.d b/crates/television_derive/target/debug/deps/syn-e90aa3fa411e87ff.d new file mode 100644 index 0000000..286b207 --- /dev/null +++ b/crates/television_derive/target/debug/deps/syn-e90aa3fa411e87ff.d @@ -0,0 +1,46 @@ +/Users/alex/code/rust/television-rs/crates/channel_derive/target/debug/deps/libsyn-e90aa3fa411e87ff.rmeta: /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/lib.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/macros.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/group.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/token.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/attr.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/bigint.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/buffer.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/classify.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/custom_keyword.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/custom_punctuation.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/data.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/derive.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/drops.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/error.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/expr.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/ext.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/fixup.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/generics.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/ident.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/lifetime.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/lit.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/lookahead.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/mac.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/meta.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/op.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/parse.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/discouraged.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/parse_macro_input.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/parse_quote.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/path.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/precedence.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/print.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/punctuated.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/restriction.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/sealed.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/span.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/spanned.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/thread.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/ty.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/verbatim.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/export.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/gen/clone.rs + +/Users/alex/code/rust/television-rs/crates/channel_derive/target/debug/deps/syn-e90aa3fa411e87ff.d: /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/lib.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/macros.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/group.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/token.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/attr.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/bigint.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/buffer.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/classify.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/custom_keyword.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/custom_punctuation.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/data.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/derive.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/drops.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/error.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/expr.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/ext.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/fixup.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/generics.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/ident.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/lifetime.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/lit.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/lookahead.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/mac.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/meta.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/op.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/parse.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/discouraged.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/parse_macro_input.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/parse_quote.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/path.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/precedence.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/print.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/punctuated.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/restriction.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/sealed.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/span.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/spanned.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/thread.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/ty.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/verbatim.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/export.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/gen/clone.rs + +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/lib.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/macros.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/group.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/token.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/attr.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/bigint.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/buffer.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/classify.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/custom_keyword.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/custom_punctuation.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/data.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/derive.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/drops.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/error.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/expr.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/ext.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/fixup.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/generics.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/ident.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/lifetime.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/lit.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/lookahead.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/mac.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/meta.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/op.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/parse.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/discouraged.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/parse_macro_input.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/parse_quote.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/path.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/precedence.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/print.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/punctuated.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/restriction.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/sealed.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/span.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/spanned.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/thread.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/ty.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/verbatim.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/export.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.79/src/gen/clone.rs: diff --git a/crates/television_derive/target/debug/deps/unicode_ident-c9d91f5d3d06fab1.d b/crates/television_derive/target/debug/deps/unicode_ident-c9d91f5d3d06fab1.d new file mode 100644 index 0000000..1bc7fbe --- /dev/null +++ b/crates/television_derive/target/debug/deps/unicode_ident-c9d91f5d3d06fab1.d @@ -0,0 +1,6 @@ +/Users/alex/code/rust/television-rs/crates/channel_derive/target/debug/deps/libunicode_ident-c9d91f5d3d06fab1.rmeta: /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/unicode-ident-1.0.13/src/lib.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/unicode-ident-1.0.13/src/tables.rs + +/Users/alex/code/rust/television-rs/crates/channel_derive/target/debug/deps/unicode_ident-c9d91f5d3d06fab1.d: /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/unicode-ident-1.0.13/src/lib.rs /Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/unicode-ident-1.0.13/src/tables.rs + +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/unicode-ident-1.0.13/src/lib.rs: +/Users/alex/.cargo/registry/src/index.crates.io-6f17d22bba15001f/unicode-ident-1.0.13/src/tables.rs: diff --git a/crates/television_derive/target/debug/incremental/channel_derive-2bvh86t96khr3/s-h0siyr410b-0hh09hq-d233dv1lx7he10tjqmr844z5e/dep-graph.bin b/crates/television_derive/target/debug/incremental/channel_derive-2bvh86t96khr3/s-h0siyr410b-0hh09hq-d233dv1lx7he10tjqmr844z5e/dep-graph.bin new file mode 100644 index 0000000..ca2ba94 Binary files /dev/null and b/crates/television_derive/target/debug/incremental/channel_derive-2bvh86t96khr3/s-h0siyr410b-0hh09hq-d233dv1lx7he10tjqmr844z5e/dep-graph.bin differ diff --git a/crates/television_derive/target/debug/incremental/channel_derive-2bvh86t96khr3/s-h0siyr410b-0hh09hq-d233dv1lx7he10tjqmr844z5e/query-cache.bin b/crates/television_derive/target/debug/incremental/channel_derive-2bvh86t96khr3/s-h0siyr410b-0hh09hq-d233dv1lx7he10tjqmr844z5e/query-cache.bin new file mode 100644 index 0000000..082bc6e Binary files /dev/null and b/crates/television_derive/target/debug/incremental/channel_derive-2bvh86t96khr3/s-h0siyr410b-0hh09hq-d233dv1lx7he10tjqmr844z5e/query-cache.bin differ diff --git a/crates/television_derive/target/debug/incremental/channel_derive-2bvh86t96khr3/s-h0siyr410b-0hh09hq-d233dv1lx7he10tjqmr844z5e/work-products.bin b/crates/television_derive/target/debug/incremental/channel_derive-2bvh86t96khr3/s-h0siyr410b-0hh09hq-d233dv1lx7he10tjqmr844z5e/work-products.bin new file mode 100644 index 0000000..5afa98c Binary files /dev/null and b/crates/television_derive/target/debug/incremental/channel_derive-2bvh86t96khr3/s-h0siyr410b-0hh09hq-d233dv1lx7he10tjqmr844z5e/work-products.bin differ diff --git a/crates/television_derive/target/debug/incremental/channel_derive-2bvh86t96khr3/s-h0siyr410b-0hh09hq.lock b/crates/television_derive/target/debug/incremental/channel_derive-2bvh86t96khr3/s-h0siyr410b-0hh09hq.lock new file mode 100755 index 0000000..e69de29 diff --git a/crates/television_derive/target/debug/incremental/channel_derive-2gjprf3yaroq5/s-h0siyr410b-00abogj-4hxbl24tychasd6t44jta7r0t/dep-graph.bin b/crates/television_derive/target/debug/incremental/channel_derive-2gjprf3yaroq5/s-h0siyr410b-00abogj-4hxbl24tychasd6t44jta7r0t/dep-graph.bin new file mode 100644 index 0000000..569bde4 Binary files /dev/null and b/crates/television_derive/target/debug/incremental/channel_derive-2gjprf3yaroq5/s-h0siyr410b-00abogj-4hxbl24tychasd6t44jta7r0t/dep-graph.bin differ diff --git a/crates/television_derive/target/debug/incremental/channel_derive-2gjprf3yaroq5/s-h0siyr410b-00abogj-4hxbl24tychasd6t44jta7r0t/query-cache.bin b/crates/television_derive/target/debug/incremental/channel_derive-2gjprf3yaroq5/s-h0siyr410b-00abogj-4hxbl24tychasd6t44jta7r0t/query-cache.bin new file mode 100644 index 0000000..54c8656 Binary files /dev/null and b/crates/television_derive/target/debug/incremental/channel_derive-2gjprf3yaroq5/s-h0siyr410b-00abogj-4hxbl24tychasd6t44jta7r0t/query-cache.bin differ diff --git a/crates/television_derive/target/debug/incremental/channel_derive-2gjprf3yaroq5/s-h0siyr410b-00abogj-4hxbl24tychasd6t44jta7r0t/work-products.bin b/crates/television_derive/target/debug/incremental/channel_derive-2gjprf3yaroq5/s-h0siyr410b-00abogj-4hxbl24tychasd6t44jta7r0t/work-products.bin new file mode 100644 index 0000000..5afa98c Binary files /dev/null and b/crates/television_derive/target/debug/incremental/channel_derive-2gjprf3yaroq5/s-h0siyr410b-00abogj-4hxbl24tychasd6t44jta7r0t/work-products.bin differ diff --git a/crates/television_derive/target/debug/incremental/channel_derive-2gjprf3yaroq5/s-h0siyr410b-00abogj.lock b/crates/television_derive/target/debug/incremental/channel_derive-2gjprf3yaroq5/s-h0siyr410b-00abogj.lock new file mode 100755 index 0000000..e69de29 diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..a1ffd27 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1 @@ +max_width = 79 diff --git a/src/components/channels.rs b/src/components/channels.rs deleted file mode 100644 index 5abbb2a..0000000 --- a/src/components/channels.rs +++ /dev/null @@ -1,79 +0,0 @@ -use crate::cli::UnitTvChannel; -use crate::components::finders::Entry; -use crate::components::finders::{EnvVarFinder, FileFinder, GrepFinder}; - -use super::finders::Finder; - -pub enum TvChannel { - Env(EnvChannel), - Files(FilesChannel), - Grep(GrepChannel), -} - -impl TvChannel { - pub fn find(&mut self, pattern: &str) { - match self { - TvChannel::Env(channel) => channel.finder.find(pattern), - TvChannel::Files(channel) => channel.finder.find(pattern), - TvChannel::Grep(channel) => channel.finder.find(pattern), - } - } - - pub fn results(&mut self, num_entries: u32, offset: u32) -> Vec { - match self { - TvChannel::Env(channel) => channel.finder.results(num_entries, offset).collect(), - TvChannel::Files(channel) => channel.finder.results(num_entries, offset).collect(), - TvChannel::Grep(channel) => channel.finder.results(num_entries, offset).collect(), - } - } - - pub fn get_result(&self, index: u32) -> Option { - match self { - TvChannel::Env(channel) => channel.finder.get_result(index), - TvChannel::Files(channel) => channel.finder.get_result(index), - TvChannel::Grep(channel) => channel.finder.get_result(index), - } - } - - pub fn result_count(&self) -> u32 { - match self { - TvChannel::Env(channel) => channel.finder.result_count(), - TvChannel::Files(channel) => channel.finder.result_count(), - TvChannel::Grep(channel) => channel.finder.result_count(), - } - } - - pub fn total_count(&self) -> u32 { - match self { - TvChannel::Env(channel) => channel.finder.total_count(), - TvChannel::Files(channel) => channel.finder.total_count(), - TvChannel::Grep(channel) => channel.finder.total_count(), - } - } -} - -pub fn get_tv_channel(channel: UnitTvChannel) -> TvChannel { - match channel { - UnitTvChannel::Env => TvChannel::Env(EnvChannel { - finder: EnvVarFinder::new(), - }), - UnitTvChannel::Files => TvChannel::Files(FilesChannel { - finder: FileFinder::new(), - }), - UnitTvChannel::Grep => TvChannel::Grep(GrepChannel { - finder: GrepFinder::new(), - }), - } -} - -pub struct EnvChannel { - pub finder: EnvVarFinder, -} - -pub struct FilesChannel { - pub finder: FileFinder, -} - -pub struct GrepChannel { - pub finder: GrepFinder, -} diff --git a/src/main.rs b/src/main.rs deleted file mode 100644 index eb9bd4a..0000000 --- a/src/main.rs +++ /dev/null @@ -1,35 +0,0 @@ -use std::io::{stdout, Write}; - -use clap::Parser; -use cli::Cli; -use color_eyre::Result; -use tracing::info; - -use crate::app::App; - -mod action; -mod app; -mod cli; -mod components; -mod config; -mod errors; -mod event; -mod logging; -mod render; -mod tui; - -#[tokio::main(flavor = "multi_thread")] -async fn main() -> Result<()> { - crate::errors::init()?; - crate::logging::init()?; - - let args = Cli::parse(); - let mut app = App::new(args.channel, args.tick_rate, args.frame_rate)?; - if let Some(entry) = app.run().await? { - // print entry to stdout - stdout().flush()?; - info!("{:?}", entry); - stdout().write_all(entry.stdout_repr().as_bytes())?; - } - Ok(()) -} diff --git a/src/tui.rs b/src/tui.rs deleted file mode 100644 index 6ea84ac..0000000 --- a/src/tui.rs +++ /dev/null @@ -1,113 +0,0 @@ -use std::{ - io::{stderr, stdout, BufWriter, Stderr, Write}, - ops::{Deref, DerefMut}, -}; - -use color_eyre::Result; -use crossterm::{ - cursor, - terminal::{ - disable_raw_mode, enable_raw_mode, is_raw_mode_enabled, EnterAlternateScreen, - LeaveAlternateScreen, - }, - ExecutableCommand, -}; -use ratatui::backend::CrosstermBackend; -use tokio::task::JoinHandle; -use tracing::debug; - -#[derive(Copy, Clone, Debug, Default)] -enum IoStream { - #[default] - Stdout, - BlockBufferedStderr, -} - -impl IoStream { - fn as_stream(&self) -> Result> { - Ok(match self { - IoStream::Stdout => Box::new(stdout()), - IoStream::BlockBufferedStderr => Box::new(BufWriter::new(stderr())), - }) - } -} - -pub struct Tui { - pub io_stream: Box, - pub task: JoinHandle<()>, - pub frame_rate: f64, -} - -impl Tui { - pub fn new() -> Result { - Ok(Self { - io_stream: IoStream::BlockBufferedStderr.as_stream()?, - task: tokio::spawn(async {}), - frame_rate: 60.0, - }) - } - - pub fn frame_rate(mut self, frame_rate: f64) -> Self { - self.frame_rate = frame_rate; - self - } - - pub fn size(&self) -> Result<(u16, u16)> { - Ok(crossterm::terminal::size()?) - } - - pub fn enter(&mut self) -> Result<()> { - enable_raw_mode()?; - - self.io_stream.execute(EnterAlternateScreen)?; - self.io_stream.execute(cursor::Hide)?; - Ok(()) - } - - pub fn exit(&mut self) -> Result<()> { - if is_raw_mode_enabled()? { - debug!("Exiting terminal"); - self.io_stream.flush()?; - self.io_stream.execute(cursor::Show)?; - self.io_stream.execute(LeaveAlternateScreen)?; - disable_raw_mode()?; - } - - Ok(()) - } - - pub fn suspend(&mut self) -> Result<()> { - self.exit()?; - #[cfg(not(windows))] - signal_hook::low_level::raise(signal_hook::consts::signal::SIGTSTP)?; - Ok(()) - } - - pub fn resume(&mut self) -> Result<()> { - self.enter()?; - Ok(()) - } -} - -//impl Deref for Tui { -// type Target = ratatui::Terminal>; -// -// fn deref(&self) -> &Self::Target { -// &self.terminal -// } -//} -// -//impl DerefMut for Tui { -// fn deref_mut(&mut self) -> &mut Self::Target { -// &mut self.terminal -// } -//} -// -//impl Drop for Tui { -// fn drop(&mut self) { -// match self.exit() { -// Ok(_) => debug!("Successfully exited terminal"), -// Err(e) => debug!("Failed to exit terminal: {:?}", e), -// } -// } -//}