diff --git a/Cargo.lock b/Cargo.lock index 932eff9a..4e301cc8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -97,6 +97,137 @@ version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" +[[package]] +name = "async-broadcast" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-channel" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497c00e0fd83a72a79a39fcbd8e3e2f055d6f6c7e025f3b3d91f4f8e76527fb8" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "pin-project-lite", + "slab", +] + +[[package]] +name = "async-io" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" +dependencies = [ + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-lock" +version = "3.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd03604047cee9b6ce9de9f70c6cd540a0520c813cbd49bae61f33ab80ed1dc" +dependencies = [ + "event-listener", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-process" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" +dependencies = [ + "async-channel", + "async-io", + "async-lock", + "async-signal", + "async-task", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "rustix", +] + +[[package]] +name = "async-recursion" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "async-signal" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43c070bbf59cd3570b6b2dd54cd772527c7c3620fce8be898406dd3ed6adc64c" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix", + "signal-hook-registry", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + +[[package]] +name = "async-trait" +version = "0.1.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "atomic-waker" version = "1.1.2" @@ -121,7 +252,7 @@ dependencies = [ "miniz_oxide", "object", "rustc-demangle", - "windows-link 0.2.0", + "windows-link 0.2.1", ] [[package]] @@ -151,6 +282,28 @@ version = "2.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2", +] + +[[package]] +name = "blocking" +version = "1.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e83f8d02be6967315521be875afa792a316e28d57b5a2d401897e2a7921b7f21" +dependencies = [ + "async-channel", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + [[package]] name = "bumpalo" version = "3.19.0" @@ -165,9 +318,9 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "cc" -version = "1.2.39" +version = "1.2.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1354349954c6fc9cb0deab020f27f783cf0b604e8bb754dc4658ecf0d29c35f" +checksum = "ac9fe6cdbb24b6ade63616c0a0688e45bb56732262c158df3c0c4bea4ca47cb7" dependencies = [ "find-msvc-tools", "shlex", @@ -175,9 +328,9 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "cfg_aliases" @@ -196,14 +349,14 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-link 0.2.0", + "windows-link 0.2.1", ] [[package]] name = "clap" -version = "4.5.48" +version = "4.5.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2134bb3ea021b78629caa971416385309e0131b351b25e01dc16fb54e1b5fae" +checksum = "f4512b90fa68d3a9932cea5184017c5d200f5921df706d45e853537dea51508f" dependencies = [ "clap_builder", "clap_derive", @@ -222,9 +375,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.48" +version = "4.5.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ba64afa3c0a6df7fa517765e31314e983f51dda798ffba27b988194fb65dc9" +checksum = "0025e98baa12e766c67ba13ff4695a887a1eba19569aad00a472546795bd6730" dependencies = [ "anstream", "anstyle", @@ -234,18 +387,18 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.58" +version = "4.5.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75bf0b32ad2e152de789bb635ea4d3078f6b838ad7974143e99b99f45a04af4a" +checksum = "2348487adcd4631696ced64ccdb40d38ac4d31cae7f2eec8817fcea1b9d1c43c" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "4.5.47" +version = "4.5.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbfd7eae0b0f1a6e63d4b13c9c478de77c2eb546fba158ad50b4203dc24b9f9c" +checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -255,15 +408,15 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" +checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "clap_mangen" -version = "0.2.29" +version = "0.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b4c3c54b30f0d9adcb47f25f61fcce35c4dd8916638c6b82fbd5f4fb4179e2" +checksum = "263c8214a8e0cb8129f3c62036c50e9c6e15c7bd364c42e0437c492b9293f778" dependencies = [ "clap", "roff", @@ -288,6 +441,15 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "convert_case" version = "0.7.1" @@ -323,6 +485,12 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + [[package]] name = "crossterm" version = "0.29.0" @@ -362,6 +530,15 @@ dependencies = [ "syn", ] +[[package]] +name = "deranged" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a41953f86f8a05768a6cda24def994fd2f424b04ec5c719cf89989779f199071" +dependencies = [ + "powerfmt", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -390,6 +567,16 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" +[[package]] +name = "dispatch2" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89a09f22a6c6069a18470eb92d2298acf25463f14256d24778e1230d789a2aec" +dependencies = [ + "bitflags", + "objc2", +] + [[package]] name = "displaydoc" version = "0.2.5" @@ -457,11 +644,38 @@ dependencies = [ "serde_json", ] +[[package]] +name = "endi" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3d8a32ae18130a3c84dd492d4215c3d913c3b07c6b63c2eb3eb7ff1101ab7bf" + +[[package]] +name = "enumflags2" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" +dependencies = [ + "enumflags2_derive", + "serde", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "env_filter" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "186e05a59d4c50738528153b83b0b0194d3a29507dfec16eccd4b342903397d0" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" dependencies = [ "log", "regex", @@ -499,7 +713,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.1", + "windows-sys 0.61.2", +] + +[[package]] +name = "event-listener" +version = "5.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", ] [[package]] @@ -532,9 +767,9 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "find-msvc-tools" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ced73b1dacfc750a6db6c0a0c3a3853c8b41997e2e2c563dc90804ae6867959" +checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" [[package]] name = "fnv" @@ -605,6 +840,19 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +[[package]] +name = "futures-lite" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + [[package]] name = "futures-sink" version = "0.3.31" @@ -643,21 +891,21 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "wasi 0.11.1+wasi-snapshot-preview1", + "wasi", "wasm-bindgen", ] [[package]] name = "getrandom" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "js-sys", "libc", "r-efi", - "wasi 0.14.7+wasi-0.2.4", + "wasip2", "wasm-bindgen", ] @@ -709,6 +957,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + [[package]] name = "hostname" version = "0.4.1" @@ -840,7 +1094,7 @@ dependencies = [ "js-sys", "log", "wasm-bindgen", - "windows-core", + "windows-core 0.62.2", ] [[package]] @@ -967,9 +1221,9 @@ checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5" [[package]] name = "indexmap" -version = "2.11.4" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" +checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" dependencies = [ "equivalent", "hashbrown 0.16.0", @@ -997,17 +1251,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "io-uring" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046fa2d4d00aea763528b4950358d0ead425372445dc8ff86312b3c69ff7727b" -dependencies = [ - "bitflags", - "cfg-if", - "libc", -] - [[package]] name = "ipnet" version = "2.11.0" @@ -1098,9 +1341,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.176" +version = "0.2.177" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f929b4d672ea937a23a1ab494143d968337a5f47e56d0815df1e0890ddf174" +checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" [[package]] name = "libsqlite3-sys" @@ -1133,11 +1376,10 @@ checksum = "f5e54036fe321fd421e10d732f155734c4e4afd610dd556d9a82833ab3ee0bed" [[package]] name = "lock_api" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" dependencies = [ - "autocfg", "scopeguard", ] @@ -1153,6 +1395,18 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" +[[package]] +name = "mac-notification-sys" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "119c8490084af61b44c9eda9d626475847a186737c0378c85e32d77c33a01cd4" +dependencies = [ + "cc", + "objc2", + "objc2-foundation", + "time", +] + [[package]] name = "matchers" version = "0.2.0" @@ -1168,6 +1422,15 @@ version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + [[package]] name = "miniz_oxide" version = "0.8.9" @@ -1185,7 +1448,7 @@ checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" dependencies = [ "libc", "log", - "wasi 0.11.1+wasi-snapshot-preview1", + "wasi", "windows-sys 0.59.0", ] @@ -1206,6 +1469,7 @@ dependencies = [ "humantime", "inquire", "nix", + "notify-rust", "proptest", "regex", "reqwest", @@ -1236,17 +1500,38 @@ dependencies = [ "cfg-if", "cfg_aliases", "libc", + "memoffset", +] + +[[package]] +name = "notify-rust" +version = "4.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6442248665a5aa2514e794af3b39661a8e73033b1cc5e59899e1276117ee4400" +dependencies = [ + "futures-lite", + "log", + "mac-notification-sys", + "serde", + "tauri-winrt-notification", + "zbus", ] [[package]] name = "nu-ansi-term" -version = "0.50.1" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-traits" version = "0.2.19" @@ -1256,6 +1541,45 @@ dependencies = [ "autocfg", ] +[[package]] +name = "objc2" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c2599ce0ec54857b29ce62166b0ed9b4f6f1a70ccc9a71165b6154caca8c05" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags", + "dispatch2", + "objc2", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags", + "block2", + "libc", + "objc2", + "objc2-core-foundation", +] + [[package]] name = "object" version = "0.37.3" @@ -1283,6 +1607,16 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" +[[package]] +name = "ordered-stream" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" +dependencies = [ + "futures-core", + "pin-project-lite", +] + [[package]] name = "ouroboros" version = "0.18.5" @@ -1313,11 +1647,17 @@ version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c6901729fa79e91a0913333229e9ca5dc725089d1c363b2f4b4760709dc4a52" +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + [[package]] name = "parking_lot" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ "lock_api", "parking_lot_core", @@ -1325,15 +1665,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.11" +version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.52.6", + "windows-link 0.2.1", ] [[package]] @@ -1368,12 +1708,37 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "piper" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + [[package]] name = "pkg-config" version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" +[[package]] +name = "polling" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix", + "windows-sys 0.61.2", +] + [[package]] name = "portable-atomic" version = "1.11.1" @@ -1398,6 +1763,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -1407,6 +1778,15 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "proc-macro-crate" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983" +dependencies = [ + "toml_edit", +] + [[package]] name = "proc-macro2" version = "1.0.101" @@ -1455,6 +1835,15 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +[[package]] +name = "quick-xml" +version = "0.37.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "331e97a1af0bf59823e6eadffe373d7b27f485be8748f71471c662c1f269b7fb" +dependencies = [ + "memchr", +] + [[package]] name = "quinn" version = "0.11.9" @@ -1482,7 +1871,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" dependencies = [ "bytes", - "getrandom 0.3.3", + "getrandom 0.3.4", "lru-slab", "rand", "ring", @@ -1551,7 +1940,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ - "getrandom 0.3.3", + "getrandom 0.3.4", ] [[package]] @@ -1565,18 +1954,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.17" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ "bitflags", ] [[package]] name = "regex" -version = "1.11.3" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b5288124840bee7b386bc413c487869b360b2b4ec421ea56425128692f2a82c" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", @@ -1586,9 +1975,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.11" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "833eb9ce86d40ef33cb1306d8accf7bc8ec2bfea4355cbdebb3df68b40925cad" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -1597,15 +1986,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "reqwest" -version = "0.12.23" +version = "0.12.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d429f34c8092b2d42c7c93cec323bb4adeb7c67698f70839adec842ec10c7ceb" +checksum = "9d0946410b9f7b082a427e4ef5c8ff541a88b357bc6c637c40db3a68ac70a36f" dependencies = [ "base64", "bytes", @@ -1697,14 +2086,14 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.61.1", + "windows-sys 0.61.2", ] [[package]] name = "rustls" -version = "0.23.32" +version = "0.23.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd3c25631629d034ce7cd9940adc9d45762d46de2b0f57193c4443b92c6d4d40" +checksum = "751e04a496ca00bb97a5e043158d23d66b5aabf2e1d5aa2a0aaebb1aafe6f82c" dependencies = [ "once_cell", "ring", @@ -1716,9 +2105,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcff2dd52b58a8d98a70243663a0d234c4e2b79235637849d15913394a247d3" +checksum = "9980d917ebb0c0536119ba501e90834767bffc3d60641457fd84a1f3fd337923" dependencies = [ "openssl-probe", "rustls-pki-types", @@ -1755,9 +2144,9 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "rusty-fork" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2" dependencies = [ "fnv", "quick-error", @@ -1786,7 +2175,7 @@ version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" dependencies = [ - "windows-sys 0.61.1", + "windows-sys 0.61.2", ] [[package]] @@ -1883,6 +2272,17 @@ dependencies = [ "serde_core", ] +[[package]] +name = "serde_repr" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -1991,19 +2391,19 @@ checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" [[package]] name = "socket2" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" +checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] name = "stable_deref_trait" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "static_assertions" @@ -2091,6 +2491,18 @@ dependencies = [ "libc", ] +[[package]] +name = "tauri-winrt-notification" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b1e66e07de489fe43a46678dd0b8df65e0c973909df1b60ba33874e297ba9b9" +dependencies = [ + "quick-xml", + "thiserror", + "windows", + "windows-version", +] + [[package]] name = "tempfile" version = "3.23.0" @@ -2098,10 +2510,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" dependencies = [ "fastrand", - "getrandom 0.3.3", + "getrandom 0.3.4", "once_cell", "rustix", - "windows-sys 0.61.1", + "windows-sys 0.61.2", ] [[package]] @@ -2155,6 +2567,25 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "time" +version = "0.3.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde", + "time-core", +] + +[[package]] +name = "time-core" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" + [[package]] name = "tinystr" version = "0.8.1" @@ -2182,19 +2613,16 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.47.1" +version = "1.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" dependencies = [ - "backtrace", "bytes", - "io-uring", "libc", "mio", "pin-project-lite", - "slab", "socket2", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -2207,6 +2635,36 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml_datetime" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.23.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d" +dependencies = [ + "indexmap", + "toml_datetime", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e" +dependencies = [ + "winnow", +] + [[package]] name = "tower" version = "0.5.2" @@ -2319,6 +2777,17 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "uds_windows" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9" +dependencies = [ + "memoffset", + "tempfile", + "winapi", +] + [[package]] name = "unarray" version = "0.1.4" @@ -2345,9 +2814,9 @@ checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-width" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" [[package]] name = "unicode-xid" @@ -2385,6 +2854,17 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "uuid" +version = "1.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + [[package]] name = "valuable" version = "0.1.1" @@ -2427,15 +2907,6 @@ version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" -[[package]] -name = "wasi" -version = "0.14.7+wasi-0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c" -dependencies = [ - "wasip2", -] - [[package]] name = "wasip2" version = "1.0.1+wasi-0.2.4" @@ -2570,24 +3041,70 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.61.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" +dependencies = [ + "windows-collections", + "windows-core 0.61.2", + "windows-future", + "windows-link 0.1.3", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core 0.61.2", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.1.3", + "windows-result 0.3.4", + "windows-strings 0.4.2", +] + [[package]] name = "windows-core" -version = "0.62.1" +version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6844ee5416b285084d3d3fffd743b925a6c9385455f64f6d4fa3031c4c2749a9" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ "windows-implement", "windows-interface", - "windows-link 0.2.0", - "windows-result", - "windows-strings", + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-future" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", + "windows-threading", ] [[package]] name = "windows-implement" -version = "0.60.1" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edb307e42a74fb6de9bf3a02d9712678b22399c87e6fa869d6dfcd8c1b7754e0" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", @@ -2596,9 +3113,9 @@ dependencies = [ [[package]] name = "windows-interface" -version = "0.59.2" +version = "0.59.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0abd1ddbc6964ac14db11c7213d6532ef34bd9aa042c2e5935f59d7908b46a5" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", @@ -2613,26 +3130,54 @@ checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" [[package]] name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link 0.1.3", +] [[package]] name = "windows-result" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7084dcc306f89883455a206237404d3eaf961e5bd7e0f312f7c91f57eb44167f" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ - "windows-link 0.2.0", + "windows-link 0.2.1", ] [[package]] name = "windows-strings" -version = "0.5.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7218c655a553b0bed4426cf54b20d7ba363ef543b52d515b3e48d7fd55318dda" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link 0.2.0", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link 0.2.1", ] [[package]] @@ -2659,16 +3204,16 @@ version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets 0.53.4", + "windows-targets 0.53.5", ] [[package]] name = "windows-sys" -version = "0.61.1" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f109e41dd4a3c848907eb83d5a42ea98b3769495597450cf6d153507b166f0f" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ - "windows-link 0.2.0", + "windows-link 0.2.1", ] [[package]] @@ -2689,19 +3234,37 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.53.4" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link 0.2.1", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows-threading" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-version" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d42b7b7f66d2a06854650af09cfdf8713e427a439c97ad65a6375318033ac4b" +checksum = "e4060a1da109b9d0326b7262c8e12c84df67cc0dbc9e33cf49e01ccc2eb63631" dependencies = [ - "windows-link 0.2.0", - "windows_aarch64_gnullvm 0.53.0", - "windows_aarch64_msvc 0.53.0", - "windows_i686_gnu 0.53.0", - "windows_i686_gnullvm 0.53.0", - "windows_i686_msvc 0.53.0", - "windows_x86_64_gnu 0.53.0", - "windows_x86_64_gnullvm 0.53.0", - "windows_x86_64_msvc 0.53.0", + "windows-link 0.2.1", ] [[package]] @@ -2712,9 +3275,9 @@ checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_gnullvm" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" [[package]] name = "windows_aarch64_msvc" @@ -2724,9 +3287,9 @@ checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_aarch64_msvc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" [[package]] name = "windows_i686_gnu" @@ -2736,9 +3299,9 @@ checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnu" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" [[package]] name = "windows_i686_gnullvm" @@ -2748,9 +3311,9 @@ checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_gnullvm" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" [[package]] name = "windows_i686_msvc" @@ -2760,9 +3323,9 @@ checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_i686_msvc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" [[package]] name = "windows_x86_64_gnu" @@ -2772,9 +3335,9 @@ checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnu" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" [[package]] name = "windows_x86_64_gnullvm" @@ -2784,9 +3347,9 @@ checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_gnullvm" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" [[package]] name = "windows_x86_64_msvc" @@ -2796,9 +3359,18 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "windows_x86_64_msvc" -version = "0.53.0" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" +dependencies = [ + "memchr", +] [[package]] name = "winsafe" @@ -2861,6 +3433,67 @@ dependencies = [ "synstructure", ] +[[package]] +name = "zbus" +version = "5.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b622b18155f7a93d1cd2dc8c01d2d6a44e08fb9ebb7b3f9e6ed101488bad6c91" +dependencies = [ + "async-broadcast", + "async-executor", + "async-io", + "async-lock", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "enumflags2", + "event-listener", + "futures-core", + "futures-lite", + "hex", + "nix", + "ordered-stream", + "serde", + "serde_repr", + "tracing", + "uds_windows", + "uuid", + "windows-sys 0.61.2", + "winnow", + "zbus_macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "5.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cdb94821ca8a87ca9c298b5d1cbd80e2a8b67115d99f6e4551ac49e42b6a314" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", + "zbus_names", + "zvariant", + "zvariant_utils", +] + +[[package]] +name = "zbus_names" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7be68e64bf6ce8db94f63e72f0c7eb9a60d733f7e0499e628dfab0f84d6bcb97" +dependencies = [ + "serde", + "static_assertions", + "winnow", + "zvariant", +] + [[package]] name = "zerocopy" version = "0.8.27" @@ -2940,3 +3573,43 @@ dependencies = [ "quote", "syn", ] + +[[package]] +name = "zvariant" +version = "5.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2be61892e4f2b1772727be11630a62664a1826b62efa43a6fe7449521cb8744c" +dependencies = [ + "endi", + "enumflags2", + "serde", + "winnow", + "zvariant_derive", + "zvariant_utils", +] + +[[package]] +name = "zvariant_derive" +version = "5.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da58575a1b2b20766513b1ec59d8e2e68db2745379f961f86650655e862d2006" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", + "zvariant_utils", +] + +[[package]] +name = "zvariant_utils" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6949d142f89f6916deca2232cf26a8afacf2b9fdc35ce766105e104478be599" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "syn", + "winnow", +] diff --git a/Cargo.toml b/Cargo.toml index ff58b966..b0ff0ced 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,6 +38,7 @@ hostname = "0.4.1" humantime = "2.3.0" inquire = { default-features = false, version = "0.9.1", features = [ "crossterm" ] } nix = { default-features = false, features = [ "fs", "user" ], version = "0.30.1" } +notify-rust = "4.11.7" regex = "1.11.3" reqwest = { default-features = false, features = [ "rustls-tls-native-roots", diff --git a/src/clean.rs b/src/clean.rs index ca5a4798..35b60056 100644 --- a/src/clean.rs +++ b/src/clean.rs @@ -14,13 +14,15 @@ use nix::{ unistd::{AccessFlags, faccessat}, }; use regex::Regex; -use tracing::{Level, debug, info, instrument, span, warn}; +use tracing::{Level, debug, instrument, span, warn}; use yansi::{Color, Paint}; use crate::{ Result, commands::{Command, ElevationStrategy}, - interface, + interface::{self, NotifyAskMode}, + nh_info, + notify::NotificationSender, }; // Nix impl: @@ -249,7 +251,7 @@ impl interface::CleanMode { Err(err) => { warn!(?err, ?now, "Failed to compare time!"); }, - Ok(val) if val <= args.keep_since.into() => { + Ok(val) if val <= std::time::Duration::from(args.keep_since) => { gcroots_tagged.insert(dst, false); }, Ok(_) => { @@ -333,12 +335,26 @@ impl interface::CleanMode { } // Clean the paths - if args.ask - && !Confirm::new("Confirm the cleanup plan?") - .with_default(false) - .prompt()? - { - bail!("User rejected the cleanup plan"); + if let Some(ask) = &args.ask { + let confirmation = match ask { + NotifyAskMode::Prompt => { + Confirm::new("Confirm the cleanup plan?") + .with_default(false) + .prompt()? + }, + #[cfg(all(unix, not(target_os = "macos")))] + NotifyAskMode::Notify => { + NotificationSender::new( + "nh clean", + "Do you want to confirm the cleanup plan?", + ) + .ask() + }, + }; + + if !confirmation { + bail!("User rejected the cleanup plan"); + } } if !args.dry { @@ -488,7 +504,7 @@ fn cleanable_generations( Err(err) => { warn!(?err, ?now, ?generation, "Failed to compare time!"); }, - Ok(val) if val <= keep_since.into() => { + Ok(val) if val <= std::time::Duration::from(keep_since) => { *tbr = false; }, Ok(_) => {}, @@ -504,7 +520,7 @@ fn cleanable_generations( } fn remove_path_nofail(path: &Path) { - info!("Removing {}", path.to_string_lossy()); + nh_info!("Removing {}", path.to_string_lossy()); if let Err(err) = std::fs::remove_file(path) { warn!(?path, ?err, "Failed to remove path"); } diff --git a/src/commands.rs b/src/commands.rs index 76e9b7c6..4269b823 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -12,10 +12,14 @@ use color_eyre::{ use secrecy::{ExposeSecret, SecretString}; use subprocess::{Exec, ExitStatus, Redirection}; use thiserror::Error; -use tracing::{debug, info, warn}; +use tracing::{debug, warn}; use which::which; -use crate::{installable::Installable, interface::NixBuildPassthroughArgs}; +use crate::{ + installable::Installable, + interface::NixBuildPassthroughArgs, + nh_info, +}; static PASSWORD_CACHE: OnceLock>> = OnceLock::new(); @@ -539,7 +543,7 @@ impl Command { ); if let Some(m) = &self.message { - info!("{m}"); + nh_info!("{m}"); } debug!(?cmd); @@ -589,7 +593,7 @@ impl Command { ); if let Some(m) = &self.message { - info!("{m}"); + nh_info!("{m}"); } debug!(?cmd); @@ -670,7 +674,7 @@ impl Build { /// Returns an error if the build command fails to execute. pub fn run(&self) -> Result<()> { if let Some(m) = &self.message { - info!("{m}"); + nh_info!("{m}"); } let installable_args = self.installable.to_args(); diff --git a/src/darwin.rs b/src/darwin.rs index 55fc17d8..2e56c509 100644 --- a/src/darwin.rs +++ b/src/darwin.rs @@ -1,4 +1,4 @@ -use std::{env, path::PathBuf}; +use std::{env, fmt, path::PathBuf}; use color_eyre::eyre::{Context, bail, eyre}; use tracing::{debug, warn}; @@ -14,8 +14,10 @@ use crate::{ DarwinReplArgs, DarwinSubcommand, DiffType, + NotifyAskMode, }, nixos::toplevel_for, + notify::NotificationSender, update::update, util::{get_hostname, print_dix_diff}, }; @@ -34,7 +36,7 @@ impl DarwinArgs { match self.subcommand { DarwinSubcommand::Switch(args) => args.rebuild(&Switch, elevation), DarwinSubcommand::Build(args) => { - if args.common.ask || args.common.dry { + if args.common.ask.is_some() || args.common.dry { warn!("`--ask` and `--dry` have no effect for `nh darwin build`"); } args.rebuild(&Build, elevation) @@ -49,6 +51,16 @@ enum DarwinRebuildVariant { Build, } +impl fmt::Display for DarwinRebuildVariant { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let s = match self { + DarwinRebuildVariant::Build => "build", + DarwinRebuildVariant::Switch => "switch", + }; + write!(f, "{s}") + } +} + impl DarwinRebuildArgs { fn rebuild( self, @@ -144,13 +156,27 @@ impl DarwinRebuildArgs { let _ = print_dix_diff(&PathBuf::from(CURRENT_PROFILE), &target_profile); } - if self.common.ask && !self.common.dry && !matches!(variant, Build) { - let confirmation = inquire::Confirm::new("Apply the config?") - .with_default(false) - .prompt()?; + if !self.common.dry && !matches!(variant, Build) { + if let Some(ask) = self.common.ask { + let confirmation = match ask { + NotifyAskMode::Prompt => { + inquire::Confirm::new("Apply the config?") + .with_default(false) + .prompt()? + }, + #[cfg(all(unix, not(target_os = "macos")))] + NotifyAskMode::Notify => { + NotificationSender::new( + &format!("nh darwin {variant}"), + "Do you want to apply the Darwin configuration?", + ) + .ask() + }, + }; - if !confirmation { - bail!("User rejected the new config"); + if !confirmation { + bail!("User rejected the new config"); + } } } diff --git a/src/home.rs b/src/home.rs index a67fdb1e..3dafc929 100644 --- a/src/home.rs +++ b/src/home.rs @@ -4,13 +4,22 @@ use color_eyre::{ Result, eyre::{Context, bail, eyre}, }; -use tracing::{debug, info, warn}; +use tracing::{debug, warn}; use crate::{ commands, commands::Command, installable::Installable, - interface::{self, DiffType, HomeRebuildArgs, HomeReplArgs, HomeSubcommand}, + interface::{ + self, + DiffType, + HomeRebuildArgs, + HomeReplArgs, + HomeSubcommand, + NotifyAskMode, + }, + nh_info, + notify::NotificationSender, update::update, util::{get_hostname, print_dix_diff}, }; @@ -26,7 +35,7 @@ impl interface::HomeArgs { match self.subcommand { HomeSubcommand::Switch(args) => args.rebuild(&Switch), HomeSubcommand::Build(args) => { - if args.common.ask || args.common.dry { + if args.common.ask.is_some() || args.common.dry { warn!("`--ask` and `--dry` have no effect for `nh home build`"); } args.rebuild(&Build) @@ -150,16 +159,28 @@ impl HomeRebuildArgs { } if self.common.dry || matches!(variant, Build) { - if self.common.ask { + if self.common.ask.is_some() { warn!("--ask has no effect as dry run was requested"); } return Ok(()); } - if self.common.ask { - let confirmation = inquire::Confirm::new("Apply the config?") - .with_default(false) - .prompt()?; + if let Some(ask) = &self.common.ask { + let confirmation = match ask { + NotifyAskMode::Prompt => { + inquire::Confirm::new("Apply the config?") + .with_default(false) + .prompt()? + }, + #[cfg(all(unix, not(target_os = "macos")))] + NotifyAskMode::Notify => { + NotificationSender::new( + "nh home switch", + "Do you want to apply the Home Manager configuration?", + ) + .ask() + }, + }; if !confirmation { bail!("User rejected the new config"); @@ -167,7 +188,7 @@ impl HomeRebuildArgs { } if let Some(ext) = &self.backup_extension { - info!("Using {} as the backup extension", ext); + nh_info!("Using {} as the backup extension", ext); unsafe { env::set_var("HOME_MANAGER_BACKUP_EXT", ext); } diff --git a/src/interface.rs b/src/interface.rs index a4d615bc..c3eb9348 100644 --- a/src/interface.rs +++ b/src/interface.rs @@ -264,6 +264,15 @@ pub enum DiffType { Never, } +#[derive(Debug, Clone, ValueEnum, PartialEq)] +pub enum NotifyAskMode { + /// Ask in the terminal (stdin prompt) + Prompt, + /// Ask via a desktop notification action + #[cfg(all(unix, not(target_os = "macos")))] + Notify, +} + #[derive(Debug, Args)] pub struct OsRollbackArgs { /// Only print actions, without performing them @@ -271,8 +280,8 @@ pub struct OsRollbackArgs { pub dry: bool, /// Ask for confirmation - #[arg(long, short)] - pub ask: bool, + #[arg(long, short, value_enum, default_missing_value = "prompt", num_args = 0..=1)] + pub ask: Option, /// Explicitly select some specialisation #[arg(long, short)] @@ -303,8 +312,8 @@ pub struct CommonRebuildArgs { pub dry: bool, /// Ask for confirmation - #[arg(long, short)] - pub ask: bool, + #[arg(long, short, default_missing_value = "prompt", num_args = 0..=1)] + pub ask: Option, #[command(flatten)] pub installable: Installable, @@ -435,8 +444,8 @@ pub struct CleanArgs { pub dry: bool, /// Ask for confirmation - #[arg(long, short)] - pub ask: bool, + #[arg(long, short, default_missing_value = "prompt", num_args = 0..=1)] + pub ask: Option, /// Don't run nix store --gc #[arg(long = "no-gc", alias = "nogc")] diff --git a/src/lib.rs b/src/lib.rs index b6b63626..12d21ed2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,6 +11,7 @@ pub mod interface; pub mod json; pub mod logging; pub mod nixos; +pub mod notify; pub mod search; pub mod update; pub mod util; diff --git a/src/logging.rs b/src/logging.rs index 22a34c2b..e9964c5c 100644 --- a/src/logging.rs +++ b/src/logging.rs @@ -31,15 +31,15 @@ where match *level { Level::ERROR => { - write!(writer, "{} ", Paint::new("ERROR").fg(Color::Red))? + write!(writer, "{} ", Paint::new("ERROR").fg(Color::Red))?; }, Level::WARN => write!(writer, "{} ", Paint::new("!").fg(Color::Yellow))?, Level::INFO => write!(writer, "{} ", Paint::new(">").fg(Color::Green))?, Level::DEBUG => { - write!(writer, "{} ", Paint::new("DEBUG").fg(Color::Blue))? + write!(writer, "{} ", Paint::new("DEBUG").fg(Color::Blue))?; }, Level::TRACE => { - write!(writer, "{} ", Paint::new("TRACE").fg(Color::Cyan))? + write!(writer, "{} ", Paint::new("TRACE").fg(Color::Cyan))?; }, } @@ -94,3 +94,25 @@ pub fn setup_logging( Ok(()) } + +#[macro_export] +macro_rules! nh_info { + ($($arg:tt)*) => {{ + use notify_rust::Urgency; + use $crate::notify::NotificationSender; + let message = format!($($arg)*); + tracing::info!($($arg)*); + NotificationSender::new("nh info", &message).urgency(Urgency::Normal).send().unwrap(); + }}; +} + +#[macro_export] +macro_rules! nh_warn { + ($($arg:tt)*) => {{ + use notify_rust::Urgency; + use $crate::notify::NotificationSender; + let message = format!($($arg)*); + tracing::warn!($($arg)*); + NotificationSender::new("nh warn", &message).urgency(Urgency::Normal).send().unwrap(); + }}; +} diff --git a/src/main.rs b/src/main.rs index bc7005a7..396ca181 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,7 @@ mod interface; mod json; mod logging; mod nixos; +mod notify; mod search; mod update; mod util; diff --git a/src/nixos.rs b/src/nixos.rs index 8f7b6f8a..e4146f5a 100644 --- a/src/nixos.rs +++ b/src/nixos.rs @@ -5,7 +5,7 @@ use std::{ }; use color_eyre::eyre::{Context, Result, bail, eyre}; -use tracing::{debug, info, warn}; +use tracing::{debug, warn}; use crate::{ commands::{self, Command, ElevationStrategy}, @@ -14,6 +14,7 @@ use crate::{ interface::{ self, DiffType, + NotifyAskMode, OsBuildVmArgs, OsGenerationsArgs, OsRebuildArgs, @@ -21,6 +22,8 @@ use crate::{ OsRollbackArgs, OsSubcommand::{self}, }, + nh_info, + notify::NotificationSender, update::update, util::{ensure_ssh_key_login, get_hostname, print_dix_diff}, }; @@ -38,7 +41,7 @@ impl interface::OsArgs { OsSubcommand::Test(args) => args.rebuild(&Test, None, elevation), OsSubcommand::Switch(args) => args.rebuild(&Switch, None, elevation), OsSubcommand::Build(args) => { - if args.common.ask || args.common.dry { + if args.common.ask.is_some() || args.common.dry { warn!("`--ask` and `--dry` have no effect for `nh os build`"); } args.rebuild(&Build, None, elevation) @@ -131,7 +134,7 @@ impl OsRebuildArgs { self.handle_dix_diff(&target_profile); if self.common.dry || matches!(variant, Build | BuildVm) { - if self.common.ask { + if self.common.ask.is_some() { warn!("--ask has no effect as dry run was requested"); } @@ -316,10 +319,22 @@ impl OsRebuildArgs { ) -> Result<()> { use OsRebuildVariant::{Boot, Switch, Test}; - if self.common.ask { - let confirmation = inquire::Confirm::new("Apply the config?") - .with_default(false) - .prompt()?; + if let Some(ask) = &self.common.ask { + let confirmation = match ask { + NotifyAskMode::Prompt => { + inquire::Confirm::new("Apply the config?") + .with_default(false) + .prompt()? + }, + #[cfg(all(unix, not(target_os = "macos")))] + NotifyAskMode::Notify => { + NotificationSender::new( + "nh os switch", + "Do you want to apply the NixOS configuration?", + ) + .ask() + }, + }; if !confirmation { bail!("User rejected the new config"); @@ -419,7 +434,7 @@ impl OsRollbackArgs { find_previous_generation()? }; - info!("Rolling back to generation {}", target_generation.number); + nh_info!("Rolling back to generation {}", target_generation.number); // Construct path to the generation let profile_dir = Path::new(SYSTEM_PROFILE).parent().unwrap_or_else(|| { @@ -457,20 +472,32 @@ impl OsRollbackArgs { } if self.dry { - info!( + nh_info!( "Dry run: would roll back to generation {}", target_generation.number ); return Ok(()); } - if self.ask { - let confirmation = inquire::Confirm::new(&format!( - "Roll back to generation {}?", - target_generation.number - )) - .with_default(false) - .prompt()?; + if let Some(ask) = &self.ask { + let confirmation = match ask { + NotifyAskMode::Prompt => { + inquire::Confirm::new(&format!( + "Roll back to generation {}?", + target_generation.number + )) + .with_default(false) + .prompt()? + }, + #[cfg(all(unix, not(target_os = "macos")))] + NotifyAskMode::Notify => { + NotificationSender::new( + "nh os rollback", + &format!("Roll back to generation {}?", target_generation.number), + ) + .ask() + }, + }; if !confirmation { bail!("User rejected the rollback"); @@ -487,7 +514,7 @@ impl OsRollbackArgs { }; // Set the system profile - info!("Setting system profile..."); + nh_info!("Setting system profile..."); // Instead of direct symlink operations, use a command with proper elevation Command::new("ln") @@ -519,7 +546,7 @@ impl OsRollbackArgs { }; // Activate the configuration - info!("Activating..."); + nh_info!("Activating..."); let switch_to_configuration = final_profile.join("bin").join("switch-to-configuration"); @@ -536,7 +563,7 @@ impl OsRollbackArgs { .run() { Ok(()) => { - info!( + nh_info!( "Successfully rolled back to generation {}", target_generation.number ); @@ -643,14 +670,14 @@ fn find_vm_script(out_path: &Path) -> Result { fn print_vm_instructions(out_path: &Path) { match find_vm_script(out_path) { Ok(script) => { - info!( + nh_info!( "Done. The virtual machine can be started by running {}", script.display() ); }, Err(e) => { warn!("VM build completed, but could not find run script: {}", e); - info!( + nh_info!( "Done. The virtual machine script should be at {}/bin/run-*-vm", out_path.display() ); @@ -658,7 +685,7 @@ fn print_vm_instructions(out_path: &Path) { } } -/// Runs the built NixOS VM by executing the VM runner script. +/// Runs the built `NixOS` VM by executing the VM runner script. /// /// Locates the VM runner script in the build output directory and executes it, /// streaming its output to the user. Returns an error if the script cannot be @@ -675,7 +702,7 @@ fn print_vm_instructions(out_path: &Path) { fn run_vm(out_path: &Path) -> Result<()> { let vm_script = find_vm_script(out_path)?; - info!( + nh_info!( "Running VM... Starting virtual machine with {}", vm_script.display() ); diff --git a/src/notify.rs b/src/notify.rs new file mode 100644 index 00000000..150e9779 --- /dev/null +++ b/src/notify.rs @@ -0,0 +1,128 @@ +use std::env; + +use color_eyre::eyre::Result; +use notify_rust::{Notification, Urgency}; + +/// A thin wrapper around [`notify_rust::Notification`] +#[derive(Debug)] +pub struct NotificationSender { + notification: notify_rust::Notification, + urgency: Option, +} + +impl NotificationSender { + /// Creates a new notification with a summary (title) and body (message). + /// + /// # Arguments + /// + /// * `summary` - Short title text displayed in the notification. + /// * `body` - Longer description text shown below the summary. + /// + /// # Returns + /// + /// A [`NotificationSender`] containing a notification ready to be shown. + #[must_use] + pub fn new(summary: &str, body: &str) -> Self { + let mut notification = Notification::new(); + notification.summary(summary); + notification.body(body); + Self { + notification, + urgency: None, + } + } + + /// Sets the urgency level of the notification. + /// + /// # Arguments + /// + /// * `urgency` - The desired [`Urgency`] for the notification. + #[must_use] + pub fn urgency(mut self, urgency: Urgency) -> Self { + self.urgency = Some(urgency); + self + } + + /// Sends the notification to the desktop environment. + /// + /// Notifications will only be sent if the environment variable + /// `NH_NOTIFY` is set to `"1"`. Otherwise, this function does nothing + /// and returns `Ok(())`. + /// + /// On Unix platforms (excluding macOS), the urgency level is set to + /// the value specified with [`NotificationSender::urgency`], or + /// [`Urgency::Normal`] if none was set. + /// + /// # Errors + /// + /// Returns an error if the underlying notification system fails to + /// display the message. + pub fn send(mut self) -> Result<()> { + let enable_notifications = env::var("NH_NOTIFY").is_ok_and(|v| v == "1"); + if !enable_notifications { + return Ok(()); + } + + #[cfg(all(unix, not(target_os = "macos")))] + self + .notification + .urgency(self.urgency.unwrap_or(Urgency::Normal)); + + #[cfg(target_os = "macos")] + { + _ = &mut self; + } + + self.notification.show()?; + Ok(()) + } + + /// Shows a notification asking for user confirmation. + /// + /// On supported Unix platforms (excluding macOS), the notification will + /// present **Accept** and **Reject** actions. The method blocks until + /// the user selects an action, and returns: + /// + /// * `Ok(true)` if the user clicked **Accept**. + /// * `Ok(false)` if the user clicked **Reject** or if actions are not + /// supported on the platform. + /// + /// The urgency level is set to the value specified with + /// [`NotificationSender::urgency`], or [`Urgency::Critical`] if none was set. + /// + /// On unsupported platforms (e.g., macOS, Windows), this function always + /// returns `Ok(false)` since interactive actions are not supported. + /// + /// # Errors + /// + /// Returns an error if the notification cannot be shown. + #[must_use] + pub fn ask(mut self) -> bool { + #[cfg(all(unix, not(target_os = "macos")))] + { + self + .notification + .urgency(self.urgency.unwrap_or(Urgency::Critical)); + self.notification.action("accept", "Accept"); + self.notification.action("reject", "Reject"); + } + + let handle = self.notification.show().unwrap(); + + #[cfg(all(unix, not(target_os = "macos")))] + { + let mut confirmation = false; + handle.wait_for_action(|s| { + confirmation = s == "accept"; + }); + confirmation + } + + #[cfg(target_os = "macos")] + { + _ = &mut self; + _ = handle; + false + } + } +} diff --git a/src/util.rs b/src/util.rs index 78402377..7c2aa77f 100644 --- a/src/util.rs +++ b/src/util.rs @@ -10,9 +10,12 @@ use std::{ use color_eyre::{Result, eyre}; use regex::Regex; -use tracing::{debug, info}; +use tracing::debug; -use crate::commands::{Command, ElevationStrategy}; +use crate::{ + commands::{Command, ElevationStrategy}, + nh_info, +}; #[derive(Debug, Clone, PartialEq)] pub enum NixVariant { @@ -333,7 +336,7 @@ pub fn print_dix_diff( })? { if size_old == size_new { - info!("No version or size changes."); + nh_info!("No version or size changes."); } else { if wrote > 0 { println!(); diff --git a/src/util/platform.rs b/src/util/platform.rs index bab80ddb..4bb9233a 100644 --- a/src/util/platform.rs +++ b/src/util/platform.rs @@ -10,6 +10,7 @@ use tracing::{debug, info, warn}; use crate::commands; use crate::installable::Installable; use crate::interface::NixBuildPassthroughArgs; +use crate::nh_info; /// Resolves an Installable from an environment variable. /// @@ -186,7 +187,7 @@ pub fn confirm_action(ask: bool, dry: bool) -> Result { } if ask { - info!("Apply the config?"); + nh_info!("Apply the config?"); let confirmation = Confirm::new("Apply the config?") .with_default(false) .prompt()?;