From dc9a5ddad2b21cb1d15f5bd31b526f3985deef24 Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 26 Jun 2022 17:00:05 -0400 Subject: [PATCH] update cli --- Cargo.lock | 486 +++++++++-------------------- external/cursive | 2 +- external/cursive-flexi-logger-view | 2 +- external/cursive_buffered_backend | 2 +- veilid-cli/Cargo.toml | 28 +- veilid-cli/src/main.rs | 42 ++- veilid-cli/src/settings.rs | 64 ++-- veilid-cli/src/ui.rs | 17 +- 8 files changed, 236 insertions(+), 407 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9f4d1791..85095f58 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -148,9 +148,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc" +checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" [[package]] name = "arraydeque" @@ -164,12 +164,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - [[package]] name = "arrayvec" version = "0.7.2" @@ -213,9 +207,9 @@ dependencies = [ [[package]] name = "async-global-executor" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd8b508d585e01084059b60f06ade4cb7415cd2e4084b71dd1cb44e7d3fb9880" +checksum = "5262ed948da60dd8956c6c5aca4d4163593dddb7b32d73267c93dab7b2e98940" dependencies = [ "async-channel", "async-executor", @@ -223,6 +217,7 @@ dependencies = [ "async-lock", "blocking", "futures-lite", + "num_cpus", "once_cell", ] @@ -273,9 +268,9 @@ dependencies = [ [[package]] name = "async-std" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52580991739c5cdb36cde8b2a516371c0a3b70dda36d916cc08b82372916808c" +checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" dependencies = [ "async-attributes", "async-channel", @@ -292,7 +287,6 @@ dependencies = [ "kv-log-macro", "log", "memchr", - "num_cpus", "once_cell", "pin-project-lite", "pin-utils", @@ -525,7 +519,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" dependencies = [ "arrayref", - "arrayvec 0.7.2", + "arrayvec", "cc", "cfg-if 1.0.0", "constant_time_eq", @@ -635,7 +629,7 @@ dependencies = [ "lazy_static", "memchr", "regex-automata", - "serde 1.0.137", + "serde", ] [[package]] @@ -808,7 +802,7 @@ checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" dependencies = [ "libc", "num-integer", - "num-traits 0.2.15", + "num-traits", "time 0.1.44", "winapi", ] @@ -865,9 +859,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.5" +version = "3.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53da17d37dba964b9b3ecb5c5a1f193a2762c700e6829201e645b9381c99dc7" +checksum = "9f1fe12880bae935d142c8702d500c63a4e8634b6c3c57ad72bf978fc7b6249a" dependencies = [ "atty", "bitflags", @@ -880,22 +874,13 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5538cd660450ebeb4234cfecf8f2284b844ffc4c50531e66d584ad5b91293613" +checksum = "87eba3c8c7f42ef17f6c659fc7416d0f4758cd3e58861ee63c5fa4a4dde649e4" dependencies = [ "os_str_bytes", ] -[[package]] -name = "cloudabi" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags", -] - [[package]] name = "cmake" version = "0.1.48" @@ -951,22 +936,6 @@ dependencies = [ "cache-padded", ] -[[package]] -name = "config" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b076e143e1d9538dde65da30f8481c2a6c44040edb8e02b9bf1351edb92ce3" -dependencies = [ - "lazy_static", - "nom 5.1.2", - "rust-ini 0.13.0", - "serde 1.0.137", - "serde-hjson", - "serde_json", - "toml", - "yaml-rust", -] - [[package]] name = "config" version = "0.13.1" @@ -979,8 +948,8 @@ dependencies = [ "nom 7.1.1", "pathdiff", "ron", - "rust-ini 0.18.0", - "serde 1.0.137", + "rust-ini", + "serde", "serde_json", "toml", "yaml-rust", @@ -1075,12 +1044,12 @@ dependencies = [ "csv", "itertools", "lazy_static", - "num-traits 0.2.15", + "num-traits", "oorandom", "plotters", "rayon", "regex", - "serde 1.0.137", + "serde", "serde_cbor", "serde_derive", "serde_json", @@ -1100,9 +1069,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53" +checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -1121,39 +1090,39 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c" +checksum = "07db9d94cbd326813772c968ccd25999e5f8ae22f4f8d1b11effa37ef6ce281d" dependencies = [ "autocfg", "cfg-if 1.0.0", "crossbeam-utils", - "lazy_static", "memoffset", + "once_cell", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" +checksum = "7d82ee10ce34d7bc12c2122495e7593a9c41347ecdd64185af4ecf72cb1a7f83" dependencies = [ "cfg-if 1.0.0", - "lazy_static", + "once_cell", ] [[package]] name = "crossterm" -version = "0.21.0" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486d44227f71a1ef39554c0dc47e44b9f4139927c75043312690c3f476d1d788" +checksum = "a2102ea4f781910f8a5b98dd061f4c2023f479ce7bb1236330099ceb5a93cf17" dependencies = [ "bitflags", "crossterm_winapi", "libc", - "mio 0.7.14", - "parking_lot 0.11.2", + "mio", + "parking_lot 0.12.1", "signal-hook", "signal-hook-mio", "winapi", @@ -1161,9 +1130,9 @@ dependencies = [ [[package]] name = "crossterm_winapi" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a6966607622438301997d3dac0d2f6e9a90c68bb6bc1785ea98456ab93c0507" +checksum = "2ae1b35a484aa10e07fe0638d02301c5ad24de82d310ccbd2f3693da5f09bf1c" dependencies = [ "winapi", ] @@ -1204,7 +1173,7 @@ dependencies = [ "csv-core", "itoa 0.4.8", "ryu", - "serde 1.0.137", + "serde", ] [[package]] @@ -1238,7 +1207,7 @@ dependencies = [ [[package]] name = "cursive" -version = "0.17.0-alpha.0" +version = "0.18.0" dependencies = [ "ahash", "cfg-if 1.0.0", @@ -1255,7 +1224,7 @@ dependencies = [ [[package]] name = "cursive-flexi-logger-view" -version = "0.4.1-alpha.0" +version = "0.5.0" dependencies = [ "arraydeque", "cursive", @@ -1263,12 +1232,13 @@ dependencies = [ "flexi_logger", "lazy_static", "log", + "time 0.3.11", "unicode-width", ] [[package]] name = "cursive_buffered_backend" -version = "0.6.0-alpha.0" +version = "0.6.1-pre" dependencies = [ "cursive_core", "enumset", @@ -1280,11 +1250,10 @@ dependencies = [ [[package]] name = "cursive_core" -version = "0.3.0-alpha.0" +version = "0.3.2" dependencies = [ "ahash", "async-std", - "chrono", "crossbeam-channel", "enum-map", "enumset", @@ -1292,6 +1261,7 @@ dependencies = [ "log", "num 0.4.0", "owning_ref", + "time 0.3.11", "toml", "unicode-segmentation", "unicode-width", @@ -1482,18 +1452,18 @@ dependencies = [ [[package]] name = "enum-map" -version = "1.1.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e893a7ba6116821058dec84a6fb14fb2a97cd8ce5fd0f85d5a4e760ecd7329d9" +checksum = "6ddfe61e8040145222887d0d32a939c70c8cae681490d72fb868305e9b40ced8" dependencies = [ "enum-map-derive", ] [[package]] name = "enum-map-derive" -version = "0.6.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84278eae0af6e34ff6c1db44c11634a694aafac559ff3080e4db4e4ac35907aa" +checksum = "00d1c54e25a57236a790ecf051c2befbb57740c9b86c4273eac378ba84d620d6" dependencies = [ "proc-macro2", "quote", @@ -1507,7 +1477,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83c8d82922337cd23a15f88b70d8e4ef5f11da38dd7cdb55e84dd5de99695da0" dependencies = [ "enumflags2_derive", - "serde 1.0.137", + "serde", ] [[package]] @@ -1528,7 +1498,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4799cdb24d48f1f8a7a98d06b7fde65a85a2d1e42b25a889f5406aa1fbefe074" dependencies = [ "enumset_derive", - "serde 1.0.137", + "serde", ] [[package]] @@ -1699,18 +1669,19 @@ checksum = "279fb028e20b3c4c320317955b77c5e0c9701f05a1d309905d6fc702cdc5053e" [[package]] name = "flexi_logger" -version = "0.17.1" +version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab94b6ac8eb69f1496a6993f26f785b5fd6d99b7416023eb2a6175c0b242b1" +checksum = "ee9a6796ff68a1014f6665dac55341820f26e63ec706e58bfaee468cf0ac174f" dependencies = [ + "ansi_term", "atty", - "chrono", "glob", "lazy_static", "log", "regex", + "rustversion", "thiserror", - "yansi", + "time 0.3.11", ] [[package]] @@ -2016,7 +1987,7 @@ name = "hashlink" version = "0.8.0" dependencies = [ "hashbrown 0.12.1", - "serde 1.0.137", + "serde", ] [[package]] @@ -2201,7 +2172,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" dependencies = [ - "serde 1.0.137", + "serde", ] [[package]] @@ -2223,12 +2194,12 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "1.8.2" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6012d540c5baa3589337a98ce73408de9b5a25ec9fc2c6fd6be8f0d39e0ca5a" +checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ "autocfg", - "hashbrown 0.11.2", + "hashbrown 0.12.1", ] [[package]] @@ -2343,7 +2314,7 @@ checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1" dependencies = [ "pest", "pest_derive", - "serde 1.0.137", + "serde", ] [[package]] @@ -2375,7 +2346,7 @@ dependencies = [ "backtrace", "byteorder", "cfg-if 1.0.0", - "clap 3.2.5", + "clap 3.2.6", "core-foundation 0.9.3", "core-foundation-sys 0.8.3", "directories", @@ -2390,9 +2361,9 @@ dependencies = [ "secret-service", "security-framework", "security-framework-sys", - "serde 1.0.137", + "serde", "serde_cbor", - "serial_test 0.7.0", + "serial_test", "simplelog", "snailquote", "tempfile", @@ -2483,19 +2454,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" -[[package]] -name = "lexical-core" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" -dependencies = [ - "arrayvec 0.5.2", - "bitflags", - "cfg-if 1.0.0", - "ryu", - "static_assertions", -] - [[package]] name = "libc" version = "0.2.126" @@ -2537,28 +2495,9 @@ dependencies = [ [[package]] name = "linked-hash-map" -version = "0.3.0" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d262045c5b87c0861b3f004610afd0e2c851e2908d08b6c870cbb9d5f494ecd" -dependencies = [ - "serde 0.8.23", - "serde_test 0.8.23", -] - -[[package]] -name = "linked-hash-map" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" - -[[package]] -name = "lock_api" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" -dependencies = [ - "scopeguard", -] +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "lock_api" @@ -2595,7 +2534,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" dependencies = [ - "linked-hash-map 0.5.4", + "linked-hash-map", ] [[package]] @@ -2663,22 +2602,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.7.14" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" -dependencies = [ - "libc", - "log", - "miow", - "ntapi", - "winapi", -] - -[[package]] -name = "mio" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713d550d9b44d89174e066b7a6217ae06234c10cb47819a88290d2b353c31799" +checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" dependencies = [ "libc", "log", @@ -2686,15 +2612,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "miow" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" -dependencies = [ - "winapi", -] - [[package]] name = "multimap" version = "0.8.3" @@ -2874,8 +2791,8 @@ dependencies = [ name = "no-std-net" version = "0.6.0" dependencies = [ - "serde 1.0.137", - "serde_test 1.0.137", + "serde", + "serde_test", ] [[package]] @@ -2884,7 +2801,6 @@ version = "5.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" dependencies = [ - "lexical-core", "memchr", "version_check", ] @@ -2919,7 +2835,7 @@ dependencies = [ "num-integer", "num-iter", "num-rational 0.3.2", - "num-traits 0.2.15", + "num-traits", ] [[package]] @@ -2928,11 +2844,11 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" dependencies = [ - "num-complex 0.4.1", + "num-complex 0.4.2", "num-integer", "num-iter", - "num-rational 0.4.0", - "num-traits 0.2.15", + "num-rational 0.4.1", + "num-traits", ] [[package]] @@ -2943,7 +2859,7 @@ checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" dependencies = [ "autocfg", "num-integer", - "num-traits 0.2.15", + "num-traits", ] [[package]] @@ -2952,16 +2868,16 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5" dependencies = [ - "num-traits 0.2.15", + "num-traits", ] [[package]] name = "num-complex" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fbc387afefefd5e9e39493299f3069e14a140dd34dc19b4c1c1a8fddb6a790" +checksum = "7ae39348c8bc5fbd7f40c727a9925f03517afd2ab27d46702108b6a7e5414c19" dependencies = [ - "num-traits 0.2.15", + "num-traits", ] [[package]] @@ -2971,7 +2887,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ "autocfg", - "num-traits 0.2.15", + "num-traits", ] [[package]] @@ -2982,7 +2898,7 @@ checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" dependencies = [ "autocfg", "num-integer", - "num-traits 0.2.15", + "num-traits", ] [[package]] @@ -2994,27 +2910,18 @@ dependencies = [ "autocfg", "num-bigint", "num-integer", - "num-traits 0.2.15", + "num-traits", ] [[package]] name = "num-rational" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", "num-integer", - "num-traits 0.2.15", -] - -[[package]] -name = "num-traits" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" -dependencies = [ - "num-traits 0.2.15", + "num-traits", ] [[package]] @@ -3185,12 +3092,12 @@ version = "3.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9182e4a71cae089267ab03e67c99368db7cd877baf50f931e5d6d4b71e195ac0" dependencies = [ - "arrayvec 0.7.2", + "arrayvec", "bitvec", "byte-slice-cast", "impl-trait-for-tuples", "parity-scale-codec-derive", - "serde 1.0.137", + "serde", ] [[package]] @@ -3211,16 +3118,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" -[[package]] -name = "parking_lot" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" -dependencies = [ - "lock_api 0.3.4", - "parking_lot_core 0.7.2", -] - [[package]] name = "parking_lot" version = "0.11.2" @@ -3228,7 +3125,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", - "lock_api 0.4.7", + "lock_api", "parking_lot_core 0.8.5", ] @@ -3238,24 +3135,10 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ - "lock_api 0.4.7", + "lock_api", "parking_lot_core 0.9.3", ] -[[package]] -name = "parking_lot_core" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" -dependencies = [ - "cfg-if 0.1.10", - "cloudabi", - "libc", - "redox_syscall 0.1.57", - "smallvec", - "winapi", -] - [[package]] name = "parking_lot_core" version = "0.8.5" @@ -3265,7 +3148,7 @@ dependencies = [ "cfg-if 1.0.0", "instant", "libc", - "redox_syscall 0.2.13", + "redox_syscall", "smallvec", "winapi", ] @@ -3278,7 +3161,7 @@ checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.13", + "redox_syscall", "smallvec", "windows-sys", ] @@ -3434,7 +3317,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a3fd9ec30b9749ce28cd91f255d569591cdf937fe280c312143e3c4bad6f2a" dependencies = [ - "num-traits 0.2.15", + "num-traits", "plotters-backend", "plotters-svg", "wasm-bindgen", @@ -3544,9 +3427,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.39" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f" +checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" dependencies = [ "unicode-ident", ] @@ -3618,9 +3501,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" +checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" dependencies = [ "proc-macro2", ] @@ -3726,12 +3609,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - [[package]] name = "redox_syscall" version = "0.2.13" @@ -3748,7 +3625,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ "getrandom 0.2.7", - "redox_syscall 0.2.13", + "redox_syscall", "thiserror", ] @@ -3830,7 +3707,7 @@ checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a" dependencies = [ "base64 0.13.0", "bitflags", - "serde 1.0.137", + "serde", ] [[package]] @@ -3850,7 +3727,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bf099a1888612545b683d2661a1940089f6c2e5a8e38979b2159da876bfd956" dependencies = [ "libc", - "serde 1.0.137", + "serde", "serde_json", "winapi", ] @@ -3902,12 +3779,6 @@ dependencies = [ "syn", ] -[[package]] -name = "rust-ini" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" - [[package]] name = "rust-ini" version = "0.18.0" @@ -3969,9 +3840,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" +checksum = "a0a5f7c728f5d284929a1cccb5bc19884422bfe6ef4d6c409da2c41838983fcf" [[package]] name = "ryu" @@ -4031,7 +3902,7 @@ dependencies = [ "lazy_static", "num 0.3.1", "rand 0.8.5", - "serde 1.0.137", + "serde", "sha2", "zbus", "zbus_macros", @@ -4080,12 +3951,6 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" -[[package]] -name = "serde" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8" - [[package]] name = "serde" version = "1.0.137" @@ -4101,20 +3966,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3323f09a748af288c3dc2474ea6803ee81f118321775bffa3ac8f7e65c5e90e7" dependencies = [ - "serde 1.0.137", -] - -[[package]] -name = "serde-hjson" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a3a4e0ea8a88553209f6cc6cfe8724ecad22e1acf372793c27d995290fe74f8" -dependencies = [ - "lazy_static", - "linked-hash-map 0.3.0", - "num-traits 0.1.43", - "regex", - "serde 0.8.23", + "serde", ] [[package]] @@ -4124,7 +3976,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" dependencies = [ "half", - "serde 1.0.137", + "serde", ] [[package]] @@ -4146,7 +3998,7 @@ checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" dependencies = [ "itoa 1.0.2", "ryu", - "serde 1.0.137", + "serde", ] [[package]] @@ -4160,22 +4012,13 @@ dependencies = [ "syn", ] -[[package]] -name = "serde_test" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "110b3dbdf8607ec493c22d5d947753282f3bae73c0f56d322af1e8c78e4c23d5" -dependencies = [ - "serde 0.8.23", -] - [[package]] name = "serde_test" version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe196827aea34242c314d2f0dd49ed00a129225e80dda71b0dbf65d54d25628d" dependencies = [ - "serde 1.0.137", + "serde", ] [[package]] @@ -4186,49 +4029,28 @@ checksum = "707d15895415db6628332b737c838b88c598522e4dc70647e59b72312924aebc" dependencies = [ "indexmap", "ryu", - "serde 1.0.137", + "serde", "yaml-rust", ] [[package]] name = "serial_test" -version = "0.4.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fef5f7c7434b2f2c598adc6f9494648a1e41274a75c0ba4056f680ae0c117fd6" -dependencies = [ - "lazy_static", - "parking_lot 0.10.2", - "serial_test_derive 0.4.0", -] - -[[package]] -name = "serial_test" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d19dbfb999a147cedbfe82f042eb9555f5b0fa4ef95ee4570b74349103d9c9f4" +checksum = "7eec42e7232e5ca56aa59d63af3c7f991fe71ee6a3ddd2d3480834cf3902b007" dependencies = [ + "futures", "lazy_static", "log", "parking_lot 0.12.1", - "serial_test_derive 0.7.0", + "serial_test_derive", ] [[package]] name = "serial_test_derive" -version = "0.4.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d08338d8024b227c62bd68a12c7c9883f5c66780abaef15c550dc56f46ee6515" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serial_test_derive" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb9e2050b2be1d681f8f1c1a528bcfe4e00afa2d8995f713974f5333288659f2" +checksum = "f1b95bb2f4f624565e8fe8140c789af7e2082c0e0561b5a82a1b678baa9703dc" dependencies = [ "proc-macro-error", "proc-macro2", @@ -4330,7 +4152,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" dependencies = [ "libc", - "mio 0.7.14", + "mio", "signal-hook", ] @@ -4357,7 +4179,7 @@ checksum = "48dfff04aade74dd495b007c831cd6f4e0cee19c344dd9dc0884c0289b70a786" dependencies = [ "log", "termcolor", - "time 0.3.9", + "time 0.3.11", ] [[package]] @@ -4368,9 +4190,9 @@ checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" [[package]] name = "smallvec" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +checksum = "cc88c725d61fc6c3132893370cac4a0200e3fedf5da8331c570664b1987f5ca2" [[package]] name = "snailquote" @@ -4404,7 +4226,7 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c530c2b0d0bf8b69304b39fe2001993e267461948b890cd037d8ad4293fa1a0d" dependencies = [ - "lock_api 0.4.7", + "lock_api", ] [[package]] @@ -4451,9 +4273,9 @@ checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142" [[package]] name = "syn" -version = "1.0.96" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf" +checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" dependencies = [ "proc-macro2", "quote", @@ -4474,9 +4296,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.24.3" +version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e6241cec618592e5d52f7ed0c8abba0cd1969a5aa4be7b5351281d922113e1d" +checksum = "7d80929a3b477bce3a64360ca82bfb361eacce1dcb7b1fb31e8e5e181e37c212" dependencies = [ "cfg-if 1.0.0", "core-foundation-sys 0.8.3", @@ -4502,7 +4324,7 @@ dependencies = [ "cfg-if 1.0.0", "fastrand", "libc", - "redox_syscall 0.2.13", + "redox_syscall", "remove_dir_all", "winapi", ] @@ -4573,9 +4395,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.9" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2702e08a7a860f005826c6815dcac101b19b5eb330c27fe4a5928fec1d20ddd" +checksum = "72c91f41dcb2f096c05f0873d667dceec1087ce5bcf984ec8ffb19acddbb3217" dependencies = [ "itoa 1.0.2", "libc", @@ -4604,7 +4426,7 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" dependencies = [ - "serde 1.0.137", + "serde", "serde_json", ] @@ -4632,7 +4454,7 @@ dependencies = [ "bytes 1.1.0", "libc", "memchr", - "mio 0.8.3", + "mio", "num_cpus", "once_cell", "parking_lot 0.12.1", @@ -4709,7 +4531,7 @@ version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" dependencies = [ - "serde 1.0.137", + "serde", ] [[package]] @@ -4757,9 +4579,9 @@ dependencies = [ [[package]] name = "tower" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a89fd63ad6adf737582df5db40d286574513c69a11dac5214dc3b5603d6713e" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ "futures-core", "futures-util", @@ -4783,9 +4605,9 @@ checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62" [[package]] name = "tower-service" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" @@ -4807,7 +4629,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09d48f71a791638519505cefafe162606f706c25592e4bde4d97600c0195312e" dependencies = [ "crossbeam-channel", - "time 0.3.9", + "time 0.3.11", "tracing-subscriber", ] @@ -4824,9 +4646,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7709595b8878a4965ce5e87ebf880a7d39c9afc6837721b21a5a816a8117d921" +checksum = "7b7358be39f2f274f322d2aaed611acc57f382e8eb1e5b48cb9ae30933495ce7" dependencies = [ "once_cell", "valuable", @@ -5042,9 +4864,9 @@ checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" [[package]] name = "unicode-normalization" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +checksum = "81dee68f85cab8cf68dec42158baf3a79a1cdc065a8b103025965d6ccb7f6cbd" dependencies = [ "tinyvec", ] @@ -5141,8 +4963,8 @@ dependencies = [ "capnp-rpc", "capnpc", "cfg-if 1.0.0", - "clap 3.2.5", - "config 0.10.1", + "clap 3.2.6", + "config", "crossbeam-channel", "cursive", "cursive-flexi-logger-view", @@ -5151,10 +4973,10 @@ dependencies = [ "flexi_logger", "futures", "log", - "parking_lot 0.11.2", - "serde 1.0.137", + "parking_lot 0.12.1", + "serde", "serde_derive", - "serial_test 0.4.0", + "serial_test", "thiserror", "veilid-core", ] @@ -5181,7 +5003,7 @@ dependencies = [ "chacha20poly1305", "chrono", "color-eyre", - "config 0.13.1", + "config", "console_error_panic_hook", "curve25519-dalek-ng", "data-encoding", @@ -5223,11 +5045,11 @@ dependencies = [ "rustls-pemfile", "secrecy", "send_wrapper 0.6.0", - "serde 1.0.137", + "serde", "serde-big-array", "serde_cbor", "serde_json", - "serial_test 0.7.0", + "serial_test", "simplelog", "socket2", "static_assertions", @@ -5267,7 +5089,7 @@ dependencies = [ "opentelemetry-otlp", "opentelemetry-semantic-conventions", "parking_lot 0.12.1", - "serde 1.0.137", + "serde", "serde_json", "tracing", "tracing-opentelemetry", @@ -5287,8 +5109,8 @@ dependencies = [ "capnp-rpc", "capnpc", "cfg-if 1.0.0", - "clap 3.2.5", - "config 0.13.1", + "clap 3.2.6", + "config", "ctrlc", "daemonize", "directories", @@ -5303,10 +5125,10 @@ dependencies = [ "opentelemetry-semantic-conventions", "parking_lot 0.12.1", "rpassword 6.0.1", - "serde 1.0.137", + "serde", "serde_derive", "serde_yaml", - "serial_test 0.7.0", + "serial_test", "signal-hook", "signal-hook-async-std", "tracing", @@ -5329,7 +5151,7 @@ dependencies = [ "js-sys", "lazy_static", "send_wrapper 0.6.0", - "serde 1.0.137", + "serde", "serde_json", "tracing", "tracing-subscriber", @@ -5405,7 +5227,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" dependencies = [ "cfg-if 1.0.0", - "serde 1.0.137", + "serde", "serde_json", "wasm-bindgen-macro", ] @@ -5749,15 +5571,9 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" dependencies = [ - "linked-hash-map 0.5.4", + "linked-hash-map", ] -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" - [[package]] name = "zbus" version = "1.9.1" @@ -5775,7 +5591,7 @@ dependencies = [ "once_cell", "polling", "scoped-tls", - "serde 1.0.137", + "serde", "serde_repr", "zbus_macros", "zvariant", @@ -5823,7 +5639,7 @@ dependencies = [ "byteorder", "enumflags2", "libc", - "serde 1.0.137", + "serde", "static_assertions", "zvariant_derive", ] diff --git a/external/cursive b/external/cursive index 74c9d697..f29f750a 160000 --- a/external/cursive +++ b/external/cursive @@ -1 +1 @@ -Subproject commit 74c9d6977af86b2a57d4415c71eacda26f28c6b4 +Subproject commit f29f750aade5a669d90ac9ea3a96e8299c4c66c0 diff --git a/external/cursive-flexi-logger-view b/external/cursive-flexi-logger-view index 1e1542b1..a1ff3623 160000 --- a/external/cursive-flexi-logger-view +++ b/external/cursive-flexi-logger-view @@ -1 +1 @@ -Subproject commit 1e1542b1bb45ba590e604cb9904ef08e5e6bd55d +Subproject commit a1ff362346bd93955d9126893e4f6afb21f00881 diff --git a/external/cursive_buffered_backend b/external/cursive_buffered_backend index 5a093be7..c4a7301b 160000 --- a/external/cursive_buffered_backend +++ b/external/cursive_buffered_backend @@ -1 +1 @@ -Subproject commit 5a093be753db1251c2451e7e0e55d548af4abe1d +Subproject commit c4a7301b865d5af525fad30e76c2c5d121189943 diff --git a/veilid-cli/Cargo.toml b/veilid-cli/Cargo.toml index 7b50b714..0e871df1 100644 --- a/veilid-cli/Cargo.toml +++ b/veilid-cli/Cargo.toml @@ -23,23 +23,23 @@ cursive_buffered_backend = { path = "../external/cursive_buffered_backend" } # cursive-tabs = "0.5.0" clap = "^3" directories = "^4" -log = "^0.4" -futures = "^0.3" -serde = "^1.0.122" -serde_derive = "^1.0.122" -parking_lot = "^0.11" +log = "^0" +futures = "^0" +serde = "^1" +serde_derive = "^1" +parking_lot = "^0" cfg-if = "^1" -capnp = "^0.14" -capnp-rpc = "^0.14" -config = { version = "0.10.1", features = ["yaml"] } -bugsalot = "^0.2" -flexi_logger = "0.17" -thiserror = "^1.0" -crossbeam-channel = "0.5" +capnp = "^0" +capnp-rpc = "^0" +config = { version = "^0", features = ["yaml"] } +bugsalot = "^0" +flexi_logger = "^0" +thiserror = "^1" +crossbeam-channel = "^0" veilid-core = { path = "../veilid-core" } [dev-dependencies] -serial_test = "^0.4" +serial_test = "^0" [build-dependencies] -capnpc = "^0.14" +capnpc = "^0" diff --git a/veilid-cli/src/main.rs b/veilid-cli/src/main.rs index 3fe686a4..79381ce6 100644 --- a/veilid-cli/src/main.rs +++ b/veilid-cli/src/main.rs @@ -8,6 +8,7 @@ use clap::{Arg, ColorChoice, Command}; use flexi_logger::*; use std::ffi::OsStr; use std::net::ToSocketAddrs; +use std::path::Path; mod client_api_connection; mod command_processor; @@ -49,9 +50,9 @@ fn parse_command_line(default_config_path: &OsStr) -> Result Result<(), String> { } // Attempt to load configuration - let mut settings = settings::Settings::new( - matches.occurrences_of("config-file") == 0, - matches.value_of_os("config-file").unwrap(), - ) - .map_err(map_to_string)?; + let settings_path = if let Some(config_file) = matches.value_of_os("config-file") { + if Path::new(config_file).exists() { + Some(config_file) + } else { + None + } + } else { + None + }; + + let mut settings = settings::Settings::new(settings_path) + .map_err(|e| format!("configuration is invalid: {}", e))?; // Set config from command line if matches.occurrences_of("debug") != 0 { @@ -108,17 +116,17 @@ async fn main() -> Result<(), String> { std::fs::create_dir_all(settings.logging.file.directory.clone()) .map_err(map_to_string)?; logger - .log_target(LogTarget::FileAndWriter(flv)) - .suppress_timestamp() - // .format(flexi_logger::colored_default_format) - .directory(settings.logging.file.directory.clone()) + .log_to_file_and_writer( + FileSpec::default() + .directory(settings.logging.file.directory.clone()) + .suppress_timestamp(), + flv, + ) .start() .expect("failed to initialize logger!"); } else { logger - .log_target(LogTarget::Writer(flv)) - .suppress_timestamp() - .format(flexi_logger::colored_default_format) + .log_to_writer(flv) .start() .expect("failed to initialize logger!"); } @@ -126,9 +134,11 @@ async fn main() -> Result<(), String> { std::fs::create_dir_all(settings.logging.file.directory.clone()) .map_err(map_to_string)?; logger - .log_target(LogTarget::File) - .suppress_timestamp() - .directory(settings.logging.file.directory.clone()) + .log_to_file( + FileSpec::default() + .directory(settings.logging.file.directory.clone()) + .suppress_timestamp(), + ) .start() .expect("failed to initialize logger!"); } diff --git a/veilid-cli/src/settings.rs b/veilid-cli/src/settings.rs index 4f4b3719..d75a64da 100644 --- a/veilid-cli/src/settings.rs +++ b/veilid-cli/src/settings.rs @@ -5,7 +5,7 @@ use std::ffi::OsStr; use std::net::{SocketAddr, ToSocketAddrs}; use std::path::{Path, PathBuf}; -pub fn load_default_config(cfg: &mut config::Config) -> Result<(), config::ConfigError> { +pub fn load_default_config() -> Result { let default_config = r###"--- address: "localhost:5959" autoconnect: true @@ -16,7 +16,7 @@ logging: enabled: false file: enabled: true - directory: "" + directory: "%LOGGING_FILE_DIRECTORY%" append: true interface: node_log: @@ -44,21 +44,29 @@ interface: info : "#5cd3c6" warn : "#fedc50" error : "#ff4a15" - "###; - cfg.merge(config::File::from_str( - default_config, - config::FileFormat::Yaml, - )) - .map(drop) + "### + .replace( + "%LOGGING_FILE_DIRECTORY%", + &Settings::get_default_log_directory().to_string_lossy(), + ); + + config::Config::builder() + .add_source(config::File::from_str( + &default_config, + config::FileFormat::Yaml, + )) + .build() } pub fn load_config( - cfg: &mut config::Config, + cfg: config::Config, config_file: &Path, -) -> Result<(), config::ConfigError> { +) -> Result { if let Some(config_file_str) = config_file.to_str() { - cfg.merge(config::File::new(config_file_str, config::FileFormat::Yaml)) - .map(drop) + config::Config::builder() + .add_source(cfg) + .add_source(config::File::new(config_file_str, config::FileFormat::Yaml)) + .build() } else { Err(config::ConfigError::Message( "config file path is not valid UTF-8".to_owned(), @@ -226,38 +234,26 @@ impl Settings { default_log_directory } - pub fn new( - config_file_is_default: bool, - config_file: &OsStr, - ) -> Result { - // Create a config - let mut cfg = config::Config::default(); - + pub fn new(config_file: Option<&OsStr>) -> Result { // Load the default config - load_default_config(&mut cfg)?; - - // Use default log directory for logs - cfg.set( - "logging.file.directory", - Settings::get_default_log_directory().to_str(), - )?; + let mut cfg = load_default_config()?; // Merge in the config file if we have one - let config_file_path = Path::new(config_file); - if !config_file_is_default || config_file_path.exists() { + if let Some(config_file) = config_file { + let config_file_path = Path::new(config_file); // If the user specifies a config file on the command line then it must exist - load_config(&mut cfg, config_file_path)?; + cfg = load_config(cfg, config_file_path)?; } - cfg.try_into() + + // Generate config + cfg.try_deserialize() } } #[test] fn test_default_config() { - let mut cfg = config::Config::default(); - - load_default_config(&mut cfg).unwrap(); - let settings = cfg.try_into::().unwrap(); + let cfg = load_default_config().unwrap(); + let settings = cfg.try_deserialize::().unwrap(); println!("default settings: {:?}", settings); } diff --git a/veilid-cli/src/ui.rs b/veilid-cli/src/ui.rs index 14461a6c..686f7d34 100644 --- a/veilid-cli/src/ui.rs +++ b/veilid-cli/src/ui.rs @@ -14,6 +14,7 @@ use log::*; use std::cell::RefCell; use std::collections::{HashMap, VecDeque}; use std::rc::Rc; +use thiserror::Error; use veilid_core::*; ////////////////////////////////////////////////////////////// @@ -87,6 +88,12 @@ pub struct UI { inner: Handle, } +#[derive(Error, Debug)] +pub enum DumbError { + // #[error("{0}")] + // Message(String), +} + impl UI { ///////////////////////////////////////////////////////////////////////////////////// // Private functions @@ -642,10 +649,10 @@ impl UI { cursive_flexi_logger_view::resize(node_log_scrollback); // Instantiate the cursive runnable - /* + // reduces flicker, but it costs cpu - let mut runnable = CursiveRunnable::new( - || -> Result, UIError> { + let runnable = CursiveRunnable::new( + || -> Result, Box> { let crossterm_backend = cursive::backends::crossterm::Backend::init().unwrap(); let buffered_backend = cursive_buffered_backend::BufferedBackend::new(crossterm_backend); @@ -653,8 +660,8 @@ impl UI { Ok(Box::new(buffered_backend)) }, ); - */ - let runnable = cursive::default(); + //let runnable = cursive::default(); + // Make the callback mechanism easily reachable let cb_sink = runnable.cb_sink().clone();