From 93c6ffa50ba111495d1880e54b01eb50c0fc9fd6 Mon Sep 17 00:00:00 2001 From: mgunyho <20118130+mgunyho@users.noreply.github.com> Date: Mon, 24 Jul 2023 14:15:34 +0300 Subject: [PATCH 01/15] Update release checklist --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 15f2da60..b4de90fa 100644 --- a/README.md +++ b/README.md @@ -311,8 +311,9 @@ For further details, see the [`rustup` guide](https://rust-lang.github.io/rustup ### Making a new release -Here's a checklist of things to do for a new release. +Here's a checklist of things to do for a new release. The release binaries should be compiled on Linux with a suitably old version of glibc for compatibility (Ubuntu 20.04 LTS as of 2023 July). +- Change to the `develop` branch (all changes should be merged to it) - Run `cargo test` and verify that all tests pass - Update version in `Cargo.toml` - Run `cargo build` so that `Cargo.lock` is also updated, and make a commit with the updated versions. From f08715d9d0d6d04070c67c6768edc30113cb602b Mon Sep 17 00:00:00 2001 From: mgunyho <20118130+mgunyho@users.noreply.github.com> Date: Mon, 24 Jul 2023 14:22:30 +0300 Subject: [PATCH 02/15] Update dependencies --- Cargo.lock | 528 ++++++++++++++++++++++------------------------------- 1 file changed, 220 insertions(+), 308 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7a35a330..776bb532 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,15 +2,32 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" -version = "0.7.18" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] +[[package]] +name = "anstyle" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" + [[package]] name = "autocfg" version = "1.1.0" @@ -23,11 +40,17 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" + [[package]] name = "cc" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] name = "cfg-if" @@ -37,45 +60,50 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.0.32" +version = "4.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7db700bc935f9e43e88d00b0850dae18a63773cfbec6d8e070fccf7fef89a39" +checksum = "5fd304a20bff958a57f04c4e96a2e7594cc4490a0e809cbd48bb6437edaa452d" dependencies = [ - "bitflags", + "clap_builder", "clap_derive", - "clap_lex", "once_cell", +] + +[[package]] +name = "clap_builder" +version = "4.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1" +dependencies = [ + "anstyle", + "clap_lex", "strsim", "terminal_size", ] [[package]] name = "clap_derive" -version = "4.0.21" +version = "4.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014" +checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" dependencies = [ "heck", - "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 2.0.27", ] [[package]] name = "clap_lex" -version = "0.3.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" -dependencies = [ - "os_str_bytes", -] +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" [[package]] name = "crokey" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d4d0222e6b1608e6ded46f004a0e18d892a18dde449aedcef0aec41e525b027" +checksum = "94a9d12db57046a9063a1826dba50c7e77d45aed3e661dbfcf48fc7dc9189732" dependencies = [ "crokey-proc_macros", "crossterm", @@ -85,13 +113,13 @@ dependencies = [ [[package]] name = "crokey-proc_macros" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4832efaa2189caf3fbcf30a96e1f614503140712f7da8da4032ac1c841ac78" +checksum = "7cc92863b630b95cb62f4fc1cef080110cc19a14da0a321fd808a60ddb57c3d3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -100,7 +128,7 @@ version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab9f7409c70a38a56216480fba371ee460207dd8926ccf5b4160591759559170" dependencies = [ - "bitflags", + "bitflags 1.3.2", "crossterm_winapi", "libc", "mio", @@ -112,9 +140,9 @@ dependencies = [ [[package]] name = "crossterm_winapi" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ae1b35a484aa10e07fe0638d02301c5ad24de82d310ccbd2f3693da5f09bf1c" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" dependencies = [ "winapi", ] @@ -130,26 +158,15 @@ dependencies = [ [[package]] name = "dirs-sys" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" dependencies = [ "libc", "redox_users", "winapi", ] -[[package]] -name = "errno" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" -dependencies = [ - "errno-dragonfly", - "libc", - "winapi", -] - [[package]] name = "errno" version = "0.3.1" @@ -158,7 +175,7 @@ checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -173,50 +190,41 @@ dependencies = [ [[package]] name = "fastrand" -version = "1.9.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" [[package]] name = "getrandom" -version = "0.2.4" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi", ] [[package]] -name = "heck" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" - -[[package]] -name = "hermit-abi" -version = "0.3.1" +name = "hashbrown" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] [[package]] -name = "instant" -version = "0.1.12" +name = "heck" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] -name = "io-lifetimes" -version = "0.7.5" +name = "hermit-abi" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] name = "io-lifetimes" @@ -226,38 +234,38 @@ checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] name = "itoa" -version = "1.0.1" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "libc" -version = "0.2.146" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "linux-raw-sys" -version = "0.0.46" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.3.8" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" [[package]] name = "lock_api" -version = "0.4.7" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -265,42 +273,33 @@ dependencies = [ [[package]] name = "log" -version = "0.4.14" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" -dependencies = [ - "cfg-if", -] +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "memchr" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "mio" -version = "0.8.4" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", "log", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.36.1", + "wasi", + "windows-sys", ] [[package]] name = "once_cell" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e" - -[[package]] -name = "os_str_bytes" -version = "6.0.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "parking_lot" @@ -314,66 +313,42 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.3" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.10", + "redox_syscall 0.3.5", "smallvec", - "windows-sys 0.36.1", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", + "windows-targets", ] [[package]] name = "proc-macro2" -version = "1.0.43" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.21" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" dependencies = [ "proc-macro2", ] [[package]] name = "redox_syscall" -version = "0.2.10" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -382,24 +357,37 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] name = "redox_users" -version = "0.4.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ "getrandom", - "redox_syscall 0.2.10", + "redox_syscall 0.2.16", + "thiserror", ] [[package]] name = "regex" -version = "1.6.0" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" dependencies = [ "aho-corasick", "memchr", @@ -408,81 +396,80 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.27" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "rustix" -version = "0.35.9" +version = "0.37.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72c825b8aa8010eb9ee99b75f05e10180b9278d161583034d7574c9d617aeada" +checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" dependencies = [ - "bitflags", - "errno 0.2.8", - "io-lifetimes 0.7.5", + "bitflags 1.3.2", + "errno", + "io-lifetimes", "libc", - "linux-raw-sys 0.0.46", - "windows-sys 0.36.1", + "linux-raw-sys 0.3.8", + "windows-sys", ] [[package]] name = "rustix" -version = "0.37.20" +version = "0.38.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" +checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" dependencies = [ - "bitflags", - "errno 0.3.1", - "io-lifetimes 1.0.11", + "bitflags 2.3.3", + "errno", "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", + "linux-raw-sys 0.4.3", + "windows-sys", ] [[package]] name = "rustversion" -version = "1.0.9" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.9" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.144" +version = "1.0.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" +checksum = "5d25439cd7397d044e2748a6fe2432b5e85db703d6d097bd014b3c0ad1ebff0b" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.144" +version = "1.0.175" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" +checksum = "b23f7ade6f110613c0d63858ddb8b94c1041f550eab58a16b371bdf2c9c80ab4" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.27", ] [[package]] name = "serde_json" -version = "1.0.85" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44" +checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" dependencies = [ "itoa", "ryu", @@ -491,9 +478,9 @@ dependencies = [ [[package]] name = "signal-hook" -version = "0.3.13" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d" +checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" dependencies = [ "libc", "signal-hook-registry", @@ -512,18 +499,18 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ "libc", ] [[package]] name = "smallvec" -version = "1.8.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "smawk" @@ -556,14 +543,25 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn", + "syn 1.0.109", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] name = "syn" -version = "1.0.99" +version = "2.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" +checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0" dependencies = [ "proc-macro2", "quote", @@ -572,16 +570,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.6.0" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" dependencies = [ - "autocfg", "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix 0.37.20", - "windows-sys 0.48.0", + "rustix 0.38.4", + "windows-sys", ] [[package]] @@ -604,51 +601,72 @@ dependencies = [ [[package]] name = "terminal_size" -version = "0.2.2" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ca90c434fd12083d1a6bdcbe9f92a14f96c8a1ba600ba451734ac334521f7a" +checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237" dependencies = [ - "rustix 0.35.9", - "windows-sys 0.42.0", + "rustix 0.37.23", + "windows-sys", ] [[package]] name = "textwrap" -version = "0.15.0" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" +checksum = "b7b3e525a49ec206798b40326a44121291b530c963cfb01018f63e135bac543d" dependencies = [ "smawk", "unicode-linebreak", "unicode-width", ] +[[package]] +name = "thiserror" +version = "1.0.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.27", +] + [[package]] name = "unicode-ident" -version = "1.0.3" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-linebreak" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a52dcaab0c48d931f7cc8ef826fa51690a08e1ea55117ef26f89864f532383f" +checksum = "c5faade31a542b8b35855fff6e8def199853b2da8da256da52f52f1316ee3137" dependencies = [ + "hashbrown", "regex", ] [[package]] name = "unicode-segmentation" -version = "1.9.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] name = "unicode-width" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "version_check" @@ -656,12 +674,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -690,34 +702,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", -] - -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm 0.42.0", - "windows_aarch64_msvc 0.42.0", - "windows_i686_gnu 0.42.0", - "windows_i686_msvc 0.42.0", - "windows_x86_64_gnu 0.42.0", - "windows_x86_64_gnullvm 0.42.0", - "windows_x86_64_msvc 0.42.0", -] - [[package]] name = "windows-sys" version = "0.48.0" @@ -729,127 +713,55 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" - [[package]] name = "windows_aarch64_gnullvm" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" - [[package]] name = "windows_aarch64_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" - [[package]] name = "windows_i686_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" - [[package]] name = "windows_i686_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" - [[package]] name = "windows_x86_64_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" - [[package]] name = "windows_x86_64_gnullvm" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" - [[package]] name = "windows_x86_64_msvc" version = "0.48.0" From 683a8901ea5485045ef2f2245414bcc473c9af42 Mon Sep 17 00:00:00 2001 From: mgunyho <20118130+mgunyho@users.noreply.github.com> Date: Tue, 22 Aug 2023 06:28:41 +0300 Subject: [PATCH 03/15] Update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f99b8a16..c31c9659 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.5.1 (unreleased) + +- Update dependencies + ## 1.5.0 (2023-07-24) - By default, `tere` now only searches folders and not files. This can be changed with the new `--files` option. This replaces the `--folders-only` and `--no-folders-only` options, which are now deprecated. (Github #87 and #88) From 9dabea99d72f9bac13a0f0a22afbe916f4ffde70 Mon Sep 17 00:00:00 2001 From: mgunyho <20118130+mgunyho@users.noreply.github.com> Date: Wed, 23 Aug 2023 16:27:26 +0300 Subject: [PATCH 04/15] Add rexpect to deps --- Cargo.lock | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 1 + 2 files changed, 50 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 776bb532..45447dfa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -99,6 +99,12 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +[[package]] +name = "comma" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55b672471b4e9f9e95499ea597ff64941a309b2cdbffcc46f2cc5e2d971fd335" + [[package]] name = "crokey" version = "0.5.1" @@ -283,6 +289,15 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + [[package]] name = "mio" version = "0.8.8" @@ -295,6 +310,20 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "nix" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset", + "pin-utils", +] + [[package]] name = "once_cell" version = "1.18.0" @@ -324,6 +353,12 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "proc-macro2" version = "1.0.66" @@ -400,6 +435,19 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +[[package]] +name = "rexpect" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01ff60778f96fb5a48adbe421d21bf6578ed58c0872d712e7e08593c195adff8" +dependencies = [ + "comma", + "nix", + "regex", + "tempfile", + "thiserror", +] + [[package]] name = "rustix" version = "0.37.23" @@ -590,6 +638,7 @@ dependencies = [ "crossterm", "dirs", "regex", + "rexpect", "serde", "serde_json", "strum", diff --git a/Cargo.toml b/Cargo.toml index 2d107b93..de168eeb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,6 +29,7 @@ features = ["wrap_help", "suggestions", "std", "derive", "usage"] [dev-dependencies] tempfile = "3.6" +rexpect = "0.5" [profile.release] lto = true From a8c6f4b1e329a9984649653959ce43f9d59e8a01 Mon Sep 17 00:00:00 2001 From: mgunyho <20118130+mgunyho@users.noreply.github.com> Date: Wed, 23 Aug 2023 16:30:07 +0300 Subject: [PATCH 05/15] Add integraiton test for output of exit without cd when presing ctrl-c --- tests/cli.rs | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/cli.rs diff --git a/tests/cli.rs b/tests/cli.rs new file mode 100644 index 00000000..ef336aba --- /dev/null +++ b/tests/cli.rs @@ -0,0 +1,47 @@ +//use regex::bytes::Regex; +use regex::Regex; +use rexpect::error::Error as RexpectError; +use rexpect::session::{spawn as rexpect_spawn, PtySession}; +use std::io::Write; + +/// Strip a string until the 'alternate screen exit' escape code, and return the slice containing +/// the remaining string. +fn strip_until_alternate_screen_exit(text: &str) -> &str { + // \u{1b}[?1049l - exit alternate screen + let ptn = Regex::new(r"\x1b\[\?1049l").unwrap(); + if let Some(m) = ptn.find(text) { + &text[m.end()..] + } else { + text + } +} + +/// Initialize the app and wait until it has entered the alternate screen, and return a handle to +/// the rexpect PtySession, which is ready for input. +fn run_app() -> PtySession { + let mut proc = rexpect_spawn( + // explicitly pass empty history file so we don't get first run prompt + &format!("{} --history-file ''", env!("CARGO_BIN_EXE_tere")), + Some(1_000), + ) + .expect("error spawning process"); + + // \u{1b}[?1049h - enter alternate screen + proc.exp_string("\x1b[?1049h").unwrap(); + proc +} + +#[test] +fn output_on_exit_without_cd() -> Result<(), RexpectError> { + let mut proc = run_app(); + + proc.send_control('c')?; + proc.writer.flush()?; + + let output = proc.exp_eof()?; + let output = strip_until_alternate_screen_exit(&output); + + assert_eq!(output, "tere: Exited without changing folder\r\n"); + + Ok(()) +} From f8f732c75de6890e2edca5758b053214f05760f7 Mon Sep 17 00:00:00 2001 From: mgunyho <20118130+mgunyho@users.noreply.github.com> Date: Thu, 24 Aug 2023 18:18:02 +0300 Subject: [PATCH 06/15] Add test for first run prompt Note: there's no way to mark the test as 'ignored' for now, so the test just passes if you already have a history file. Could maybe be fixed with an env variable... --- tests/cli.rs | 54 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/tests/cli.rs b/tests/cli.rs index ef336aba..518f8d7e 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -1,8 +1,10 @@ //use regex::bytes::Regex; use regex::Regex; use rexpect::error::Error as RexpectError; -use rexpect::session::{spawn as rexpect_spawn, PtySession}; +use rexpect::session::{spawn_command, PtySession}; use std::io::Write; +use std::process::Command; +use tempfile::tempdir; /// Strip a string until the 'alternate screen exit' escape code, and return the slice containing /// the remaining string. @@ -16,21 +18,32 @@ fn strip_until_alternate_screen_exit(text: &str) -> &str { } } -/// Initialize the app and wait until it has entered the alternate screen, and return a handle to -/// the rexpect PtySession, which is ready for input. +/// Initialize the app and wait until it has entered the alternate screen. Returns a handle to the +/// rexpect PtySession, which is ready for input. Panics if initializing the app fails. fn run_app() -> PtySession { - let mut proc = rexpect_spawn( - // explicitly pass empty history file so we don't get first run prompt - &format!("{} --history-file ''", env!("CARGO_BIN_EXE_tere")), - Some(1_000), - ) - .expect("error spawning process"); + let mut cmd = get_cmd(); + // explicitly pass empty history file so we don't get first run prompt + // NOTE: cannot directly chain this with get_cmd(), otherwise we get a mutable ref which we + // can't move into run_app_with_cmd. + cmd.args(["--history-file", ""]); + run_app_with_cmd(cmd) +} + +/// Initialize app with the given Command object and wait until it has entered the alternate screen. +/// Returns a handle to the rexpect PtySession, which is ready for input. Panics if initializing +/// the app fails. +fn run_app_with_cmd(cmd: Command) -> PtySession { + let mut proc = spawn_command(cmd, Some(1_000)).expect("error spawning process"); // \u{1b}[?1049h - enter alternate screen proc.exp_string("\x1b[?1049h").unwrap(); proc } +fn get_cmd() -> Command { + Command::new(env!("CARGO_BIN_EXE_tere")) +} + #[test] fn output_on_exit_without_cd() -> Result<(), RexpectError> { let mut proc = run_app(); @@ -45,3 +58,26 @@ fn output_on_exit_without_cd() -> Result<(), RexpectError> { Ok(()) } + +#[test] +fn first_run_prompt_if_history_file_doesnt_exist() -> Result<(), RexpectError> { + let mut cmd = get_cmd(); + + // set the XDG_CACHE_HOME to point to a temporary folder so that we always get the first run prompt + let tmp = tempdir().expect("error creating temporary folder"); + cmd.env("XDG_CACHE_HOME", tmp.path().as_os_str()); + + let mut proc = run_app_with_cmd(cmd); + proc.send("n")?; + proc.writer.flush()?; + let output = proc.exp_eof()?; + + let ptn = Regex::new("It seems like you are running.*for the first time").unwrap(); + // check that first run prompt message is there + assert!(ptn.find(&output).is_some()); + + // check that having pressed 'n' prints the expected message + assert_eq!(strip_until_alternate_screen_exit(&output), "Cancelled."); + + Ok(()) +} From 0d7eb5befb859b2ee788a55e115320a7475d57f3 Mon Sep 17 00:00:00 2001 From: mgunyho <20118130+mgunyho@users.noreply.github.com> Date: Thu, 24 Aug 2023 21:05:12 +0300 Subject: [PATCH 07/15] Add test for basic launch & exit of app --- tests/cli.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/cli.rs b/tests/cli.rs index 518f8d7e..7ecd4056 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -44,6 +44,26 @@ fn get_cmd() -> Command { Command::new(env!("CARGO_BIN_EXE_tere")) } +#[test] +fn basic_run() -> Result<(), RexpectError> { + let mut cmd = get_cmd(); + let tmp = tempdir().expect("error creating temporary folder"); + cmd.current_dir(tmp.path()) + // note: have to set PWD for this to work... + .env("PWD", tmp.path().as_os_str()); + + let mut proc = run_app_with_cmd(cmd); + // 0x1b == 0o33 == 27 escape + proc.send("\x1b")?; + proc.writer.flush()?; + + let output = proc.exp_eof()?; + let output = strip_until_alternate_screen_exit(&output); + assert_eq!(output, format!("{}\r\n", tmp.path().display())); + + Ok(()) +} + #[test] fn output_on_exit_without_cd() -> Result<(), RexpectError> { let mut proc = run_app(); From 3ce0f042160392347d10a962cdb1dee8c8a6fd1f Mon Sep 17 00:00:00 2001 From: mgunyho <20118130+mgunyho@users.noreply.github.com> Date: Thu, 24 Aug 2023 21:05:26 +0300 Subject: [PATCH 08/15] Add test where we accept the first run prompt --- tests/cli.rs | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/tests/cli.rs b/tests/cli.rs index 7ecd4056..7d0feda1 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -80,7 +80,7 @@ fn output_on_exit_without_cd() -> Result<(), RexpectError> { } #[test] -fn first_run_prompt_if_history_file_doesnt_exist() -> Result<(), RexpectError> { +fn first_run_prompt_cancel() -> Result<(), RexpectError> { let mut cmd = get_cmd(); // set the XDG_CACHE_HOME to point to a temporary folder so that we always get the first run prompt @@ -101,3 +101,39 @@ fn first_run_prompt_if_history_file_doesnt_exist() -> Result<(), RexpectError> { Ok(()) } + +#[test] +fn first_run_prompt_accept() -> Result<(), RexpectError> { + let mut cmd = get_cmd(); + + // set the XDG_CACHE_HOME to point to a temporary folder so that we always get the first run prompt + let tmp = tempdir().expect("error creating temporary folder"); + cmd.env("XDG_CACHE_HOME", tmp.path().as_os_str()) + .current_dir(tmp.path()) + .env("PWD", tmp.path()); + + let mut proc = run_app_with_cmd(cmd); + proc.send("y")?; + proc.writer.flush()?; + + // 0x1b = escape + proc.send("\x1b")?; + proc.writer.flush()?; + + let output = proc.exp_eof()?; + + let ptn = Regex::new("It seems like you are running.*for the first time").unwrap(); + // check that first run prompt message was printed + assert!(ptn.find(&output).is_some()); + + // check that having pressed 'y' and then esc proceeded to the normal operation + // and the history file was created + assert_eq!( + strip_until_alternate_screen_exit(&output), + format!("{}\r\n", tmp.path().display()), + ); + + assert!(tmp.path().join("tere").join("history.json").exists()); + + Ok(()) +} From dddf92911c8020d5906059864d54be8c3c34fca4 Mon Sep 17 00:00:00 2001 From: mgunyho <20118130+mgunyho@users.noreply.github.com> Date: Thu, 24 Aug 2023 21:23:02 +0300 Subject: [PATCH 09/15] Fix tests --- tests/cli.rs | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/tests/cli.rs b/tests/cli.rs index 7d0feda1..88b9b8d4 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -18,17 +18,6 @@ fn strip_until_alternate_screen_exit(text: &str) -> &str { } } -/// Initialize the app and wait until it has entered the alternate screen. Returns a handle to the -/// rexpect PtySession, which is ready for input. Panics if initializing the app fails. -fn run_app() -> PtySession { - let mut cmd = get_cmd(); - // explicitly pass empty history file so we don't get first run prompt - // NOTE: cannot directly chain this with get_cmd(), otherwise we get a mutable ref which we - // can't move into run_app_with_cmd. - cmd.args(["--history-file", ""]); - run_app_with_cmd(cmd) -} - /// Initialize app with the given Command object and wait until it has entered the alternate screen. /// Returns a handle to the rexpect PtySession, which is ready for input. Panics if initializing /// the app fails. @@ -44,9 +33,19 @@ fn get_cmd() -> Command { Command::new(env!("CARGO_BIN_EXE_tere")) } +/// Initialize the app command with the history file explicitly set to empty, so that we don't get +/// the first run prompt +fn get_cmd_no_first_run_prompt() -> Command { + let mut cmd = get_cmd(); + // NOTE: cannot directly chain this with get_cmd(), otherwise we get a mutable ref which we + // can't move out of this function + cmd.args(["--history-file", ""]); + cmd +} + #[test] fn basic_run() -> Result<(), RexpectError> { - let mut cmd = get_cmd(); + let mut cmd = get_cmd_no_first_run_prompt(); let tmp = tempdir().expect("error creating temporary folder"); cmd.current_dir(tmp.path()) // note: have to set PWD for this to work... @@ -66,7 +65,7 @@ fn basic_run() -> Result<(), RexpectError> { #[test] fn output_on_exit_without_cd() -> Result<(), RexpectError> { - let mut proc = run_app(); + let mut proc = run_app_with_cmd(get_cmd_no_first_run_prompt()); proc.send_control('c')?; proc.writer.flush()?; @@ -97,7 +96,7 @@ fn first_run_prompt_cancel() -> Result<(), RexpectError> { assert!(ptn.find(&output).is_some()); // check that having pressed 'n' prints the expected message - assert_eq!(strip_until_alternate_screen_exit(&output), "Cancelled."); + assert_eq!(strip_until_alternate_screen_exit(&output), "Cancelled.\r\n"); Ok(()) } From b5ad578ec19d5458e42676ce6a3f179a04e22c29 Mon Sep 17 00:00:00 2001 From: mgunyho <20118130+mgunyho@users.noreply.github.com> Date: Thu, 24 Aug 2023 21:23:41 +0300 Subject: [PATCH 10/15] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c31c9659..00697836 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 1.5.1 (unreleased) - Update dependencies +- Improved tests ## 1.5.0 (2023-07-24) From 0f099a627dcb6de95452d5b8c5e9a2e806fba0f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Mon, 21 Aug 2023 11:27:58 +0300 Subject: [PATCH 11/15] Properly handle final path errors (#91) --- src/main.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index c707a3ac..5ebb0014 100644 --- a/src/main.rs +++ b/src/main.rs @@ -66,12 +66,14 @@ fn main() -> Result<(), TereError> { Ok((settings, warnings)) })?; - let final_path = TereAppState::init(settings, &warnings) + match TereAppState::init(settings, &warnings) .and_then(|state| TereTui::init(state, &mut stderr)) // actually run the app and return the final path - .and_then(|mut ui| ui.main_event_loop())?; - - Ok((final_path, warnings)) + .and_then(|mut ui| ui.main_event_loop()) + { + Ok(final_path) => Ok((final_path, warnings)), + Err(e) => Err(e), + } } } }; From 4de192c6b6d1d8758e7066782d313e8f77e5c91c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Wed, 23 Aug 2023 20:12:31 +0300 Subject: [PATCH 12/15] Chain together the execution --- src/main.rs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/main.rs b/src/main.rs index 5ebb0014..4d40a96a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -56,24 +56,21 @@ fn main() -> Result<(), TereError> { // enabled. We can finally actually run the application. let mut stderr = std::io::stderr(); - - let (settings, warnings) = stderr + stderr .flush() .map_err(TereError::from) .and_then(|_| TereSettings::parse_cli_args(&cli_args)) .and_then(|(settings, warnings)| { check_first_run_with_prompt(&settings, &mut stderr)?; Ok((settings, warnings)) - })?; - - match TereAppState::init(settings, &warnings) - .and_then(|state| TereTui::init(state, &mut stderr)) - // actually run the app and return the final path - .and_then(|mut ui| ui.main_event_loop()) - { - Ok(final_path) => Ok((final_path, warnings)), - Err(e) => Err(e), - } + }) + .and_then(|(settings, warnings)| { + TereAppState::init(settings, &warnings) + .and_then(|state| TereTui::init(state, &mut stderr)) + // actually run the app and return the final path + .and_then(|mut ui| ui.main_event_loop()) + .map(|final_path| (final_path, warnings)) + }) } } }; From 34dba8589346821543eb997217e7c802830f0662 Mon Sep 17 00:00:00 2001 From: mgunyho <20118130+mgunyho@users.noreply.github.com> Date: Thu, 24 Aug 2023 21:26:02 +0300 Subject: [PATCH 13/15] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00697836..e02f39ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## 1.5.1 (unreleased) +- Fix output formatting when exiting the app without cd, or when canceling the first run prompt (Thanks @orhun, Github #91, #92) - Update dependencies - Improved tests From d8a0b782aeea5122bd000a67867358fdfbfdec29 Mon Sep 17 00:00:00 2001 From: mgunyho <20118130+mgunyho@users.noreply.github.com> Date: Thu, 24 Aug 2023 21:34:25 +0300 Subject: [PATCH 14/15] Bump version number --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 45447dfa..f6d370e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -631,7 +631,7 @@ dependencies = [ [[package]] name = "tere" -version = "1.5.0" +version = "1.5.1" dependencies = [ "clap", "crokey", diff --git a/Cargo.toml b/Cargo.toml index de168eeb..aea0d934 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tere" -version = "1.5.0" +version = "1.5.1" authors = ["Márton Gunyhó "] edition = "2018" description = "Terminal file explorer" From 84acec3f5f1b043c2f196c0907e6b684e86da191 Mon Sep 17 00:00:00 2001 From: mgunyho <20118130+mgunyho@users.noreply.github.com> Date: Thu, 24 Aug 2023 21:34:57 +0300 Subject: [PATCH 15/15] Add release date for 1.5.1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e02f39ad..2deadfbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 1.5.1 (unreleased) +## 1.5.1 (2023-08-24) - Fix output formatting when exiting the app without cd, or when canceling the first run prompt (Thanks @orhun, Github #91, #92) - Update dependencies