From 5c3ef96de30f793ccbf8f5d7670f6d94b7878239 Mon Sep 17 00:00:00 2001 From: Hugo Wang Date: Sun, 22 Sep 2024 21:40:16 +0800 Subject: [PATCH] update deps to support latest Rust --- CHANGELOG.md | 4 + Cargo.lock | 391 ++++++++++++++++++++++++------------------ Cargo.toml | 13 +- src/core.rs | 185 +++++++++----------- src/libs/mod.rs | 14 ++ src/libs/pipes.rs | 12 ++ src/libs/progopts.rs | 23 +++ src/libs/term_size.rs | 1 - src/main.rs | 36 ++-- src/types.rs | 4 +- 10 files changed, 376 insertions(+), 307 deletions(-) create mode 100644 src/libs/pipes.rs create mode 100644 src/libs/progopts.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index f38b8d0..f782f78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # cicada Release Notes +## 0.9.39 - 2024.09.22 + +- upgraded deps to support latest Rust. + ## 0.9.38 - 2023.08.12 - Supports more colors in the prompt. diff --git a/Cargo.lock b/Cargo.lock index 9cf6d7c..8782f78 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,35 +4,30 @@ version = 3 [[package]] name = "ahash" -version = "0.8.3" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "once_cell", "version_check", + "zerocopy", ] [[package]] name = "aho-corasick" -version = "1.0.3" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8f9420f797f2d9e935edf629310eb938a0d839f984e25327f3c7eed22300c" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] -[[package]] -name = "allocator-api2" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" - [[package]] name = "arrayref" -version = "0.3.7" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" [[package]] name = "arrayvec" @@ -42,9 +37,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "base64" @@ -60,9 +55,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "blake2b_simd" @@ -86,11 +81,11 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.82" +version = "1.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" +checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" dependencies = [ - "libc", + "shlex", ] [[package]] @@ -99,18 +94,24 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "cicada" -version = "0.9.38" +version = "0.9.39" dependencies = [ "clap 3.2.25", - "errno 0.3.2", + "errno 0.3.9", "exec", "glob", "lazy_static", "libc", "linefeed", - "nix", + "nix 0.29.0", "pest", "pest_derive", "regex", @@ -141,7 +142,7 @@ dependencies = [ "bitflags 1.3.2", "clap_lex", "indexmap", - "textwrap 0.16.0", + "textwrap 0.16.1", ] [[package]] @@ -161,21 +162,18 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "crypto-common" @@ -189,9 +187,12 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.7" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7684a49fb1af197853ef7b2ee694bc1f5b4179556f1e5710e1760c5db6f5e929" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] [[package]] name = "digest" @@ -230,7 +231,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" dependencies = [ "libc", - "redox_users 0.4.3", + "redox_users 0.4.6", "winapi", ] @@ -247,11 +248,10 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.2" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ - "errno-dragonfly", "libc", "windows-sys", ] @@ -278,9 +278,9 @@ dependencies = [ [[package]] name = "fallible-iterator" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" [[package]] name = "fallible-streaming-iterator" @@ -317,9 +317,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -340,21 +340,20 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", - "allocator-api2", ] [[package]] name = "hashlink" -version = "0.8.3" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "312f66718a2d7789ffef4f4b7b213138ed9f1eb3aa1d0d82fc99f88fb3ffd26f" +checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" dependencies = [ - "hashbrown 0.14.0", + "hashbrown 0.14.5", ] [[package]] @@ -378,21 +377,31 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.6.0", + "libc", +] [[package]] name = "libsqlite3-sys" -version = "0.26.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326" +checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" dependencies = [ "cc", "pkg-config", @@ -418,18 +427,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "memoffset" -version = "0.7.1" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" -dependencies = [ - "autocfg", -] +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "minimal-lexical" @@ -443,9 +443,9 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c624fa1b7aab6bd2aff6e9b18565cc0363b6d45cbcd7465c9ed5e3740ebf097" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.6.0", "libc", - "nix", + "nix 0.26.4", "smallstr", "terminfo", "unicode-normalization", @@ -455,16 +455,25 @@ dependencies = [ [[package]] name = "nix" -version = "0.26.2" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" dependencies = [ "bitflags 1.3.2", "cfg-if", "libc", - "memoffset", - "pin-utils", - "static_assertions", +] + +[[package]] +name = "nix" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +dependencies = [ + "bitflags 2.6.0", + "cfg-if", + "cfg_aliases", + "libc", ] [[package]] @@ -477,26 +486,32 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num_threads" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" dependencies = [ "libc", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "os_str_bytes" -version = "6.5.1" +version = "6.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" +checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" [[package]] name = "pest" @@ -581,16 +596,16 @@ dependencies = [ ] [[package]] -name = "pin-utils" -version = "0.1.0" +name = "pkg-config" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] -name = "pkg-config" -version = "0.3.27" +name = "powerfmt" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "proc-macro-error" @@ -618,18 +633,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.32" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -655,15 +670,6 @@ version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_users" version = "0.3.5" @@ -671,26 +677,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" dependencies = [ "getrandom 0.1.16", - "redox_syscall 0.1.57", + "redox_syscall", "rust-argon2", ] [[package]] name = "redox_users" -version = "0.4.3" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ - "getrandom 0.2.10", - "redox_syscall 0.2.16", + "getrandom 0.2.15", + "libredox", "thiserror", ] [[package]] name = "regex" -version = "1.9.3" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", @@ -700,9 +706,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", @@ -711,17 +717,17 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "rusqlite" -version = "0.29.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "549b9d036d571d42e6e85d1c1425e2ac83491075078ca9a15be021c56b1641f2" +checksum = "7753b721174eb8ff87a9a0e799e2d7bc3749323e773db92e0984debb00019d6e" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.6.0", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -743,26 +749,46 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.183" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.210" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", "digest", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "siphasher" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] name = "smallstr" @@ -775,15 +801,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" - -[[package]] -name = "static_assertions" -version = "1.1.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "structopt" @@ -822,9 +842,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.28" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -855,54 +875,56 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" +checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" [[package]] name = "thiserror" -version = "1.0.44" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.44" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.77", ] [[package]] name = "time" -version = "0.3.25" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fdd63d58b18d663fbdf70e049f00a22c8e42be082203be7f26589213cd75ea" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "libc", + "num-conv", "num_threads", + "powerfmt", "serde", "time-core", ] [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ "tinyvec_macros", ] @@ -915,9 +937,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "ucd-trie" @@ -927,38 +949,38 @@ checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.10.1" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" [[package]] name = "uuid" -version = "1.4.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" dependencies = [ - "getrandom 0.2.10", + "getrandom 0.2.15", "serde", ] @@ -970,9 +992,9 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wasi" @@ -1010,22 +1032,23 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" -version = "0.48.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", "windows_i686_gnu", + "windows_i686_gnullvm", "windows_i686_msvc", "windows_x86_64_gnu", "windows_x86_64_gnullvm", @@ -1034,45 +1057,51 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "yaml-rust" @@ -1082,3 +1111,23 @@ checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" dependencies = [ "linked-hash-map", ] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] diff --git a/Cargo.toml b/Cargo.toml index 5838dc8..01fbdcd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ edition = "2021" build = "src/build.rs" name = "cicada" -version = "0.9.38" +version = "0.9.39" authors = ["Hugo Wang "] description = "A simple Bash-like Unix shell." @@ -26,11 +26,10 @@ doc = false errno = "0.3.0" exec = "0.3.0" glob = "0.3.0" -lazy_static = "1.4.0" +lazy_static = "1.5.0" libc = "0.2.0" linefeed = "0.6.0" -nix = "0.26.0" -# todo: upgrade pest to 2.4 +# todo: upgrade pest to 2.7+ pest = "=2.3.1" pest_derive = "2.0" regex = "1" @@ -38,6 +37,10 @@ yaml-rust = "0.4.0" uuid = { version = "1.4", features = ["serde", "v4"] } structopt = { version = "0.3", default-features = false } +[dependencies.nix] +version = "0.29.0" +features = ["fs", "process", "signal"] + [dependencies.clap] # todo: upgrade clap to 4.x version = "=3.2" @@ -45,7 +48,7 @@ default-features = false features = ["std"] [dependencies.rusqlite] -version = "0.29" +version = "0.32" features = ["bundled"] [dependencies.time] diff --git a/src/core.rs b/src/core.rs index 9cbc88e..db379dc 100644 --- a/src/core.rs +++ b/src/core.rs @@ -2,11 +2,13 @@ use std::env; use std::ffi::{CStr, CString}; use std::fs::File; use std::io::{Read, Write}; -use std::os::unix::io::{FromRawFd, RawFd}; +use std::os::unix::io::FromRawFd; +use std::os::fd::RawFd; use std::process; use libc; -use nix::unistd::{execve, pipe, ForkResult}; +use nix::unistd::{execve, ForkResult}; +use libs::pipes::pipe; use crate::builtins; use crate::calculator; @@ -154,16 +156,16 @@ pub fn run_pipeline( } } } + if errored_pipes { // release fds that already created when errors occurred - unsafe { - for fds in pipes { - libc::close(fds.0); - libc::close(fds.1); - } + for fds in pipes { + libs::close(fds.0); + libs::close(fds.1); } return (false, CommandResult::error()); } + if pipes.len() + 1 != length { println!("cicada: invalid command: unmatched pipes count"); return (false, CommandResult::error()); @@ -198,10 +200,8 @@ pub fn run_pipeline( Ok(fds) => fds_capture_stderr = Some(fds), Err(e) => { if let Some(fds) = fds_capture_stdout { - unsafe { - libc::close(fds.0); - libc::close(fds.1); - } + libs::close(fds.0); + libs::close(fds.1); } println_stderr!("cicada: pipeline3: {}", e); return (false, CommandResult::error()); @@ -280,6 +280,7 @@ fn _run_single_command( let pipes_count = pipes.len(); let mut fds_stdin = None; let cmd = cl.commands.get(idx_cmd).unwrap(); + if cmd.has_here_string() { match pipe() { Ok(fds) => fds_stdin = Some(fds), @@ -302,32 +303,26 @@ fn _run_single_command( if idx_cmd > 0 { for i in 0..idx_cmd - 1 { let fds = pipes[i]; - unsafe { - libc::close(fds.0); - libc::close(fds.1); - } + libs::close(fds.0); + libs::close(fds.1); } } // close pipes unrelated to current child (right side) for i in idx_cmd + 1..pipes_count { let fds = pipes[i]; - unsafe { - libc::close(fds.0); - libc::close(fds.1); - } + libs::close(fds.0); + libs::close(fds.1); } // close pipe fds for capturing stdout/stderr // (they're only used in last child) if idx_cmd < pipes_count { - unsafe { - if let Some(fds) = fds_capture_stdout { - libc::close(fds.0); - libc::close(fds.1); - } - if let Some(fds) = fds_capture_stderr { - libc::close(fds.0); - libc::close(fds.1); - } + if let Some(fds) = fds_capture_stdout { + libs::close(fds.0); + libs::close(fds.1); + } + if let Some(fds) = fds_capture_stderr { + libs::close(fds.0); + libs::close(fds.1); } } @@ -345,19 +340,15 @@ fn _run_single_command( // (in child) replace stdin/stdout with read/write ends of pipe if idx_cmd > 0 { let fds_prev = pipes[idx_cmd - 1]; - unsafe { - libc::dup2(fds_prev.0, 0); - libc::close(fds_prev.0); - libc::close(fds_prev.1); - } + libs::dup2(fds_prev.0, 0); + libs::close(fds_prev.0); + libs::close(fds_prev.1); } if idx_cmd < pipes_count { let fds = pipes[idx_cmd]; - unsafe { - libc::dup2(fds.1, 1); - libc::close(fds.1); - libc::close(fds.0); - } + libs::dup2(fds.1, 1); + libs::close(fds.1); + libs::close(fds.0); } if cmd.has_redirect_from() { @@ -366,20 +357,17 @@ fn _run_single_command( if fd == -1 { process::exit(1); } - unsafe { - libc::dup2(fd, 0); - libc::close(fd); - } + + libs::dup2(fd, 0); + libs::close(fd); } } if cmd.has_here_string() { if let Some(fds) = fds_stdin { - unsafe { - libc::close(fds.1); - libc::dup2(fds.0, 0); - libc::close(fds.0); - } + libs::close(fds.1); + libs::dup2(fds.0, 0); + libs::close(fds.0); } } @@ -390,34 +378,30 @@ fn _run_single_command( let op_ = &item.1; let to_ = &item.2; if to_ == "&1" && from_ == "2" { - unsafe { - if idx_cmd < pipes_count { - libc::dup2(1, 2); - } else if !options.capture_output { - let fd = libc::dup(1); - if fd == -1 { - println_stderr!("cicada: dup error"); - process::exit(1); - } - libc::dup2(fd, 2); - } else { - // note: capture output with redirections does not - // make much sense + if idx_cmd < pipes_count { + libs::dup2(1, 2); + } else if !options.capture_output { + let fd = libs::dup(1); + if fd == -1 { + println_stderr!("cicada: dup error"); + process::exit(1); } + libs::dup2(fd, 2); + } else { + // note: capture output with redirections does not + // make much sense } } else if to_ == "&2" && from_ == "1" { - unsafe { - if idx_cmd < pipes_count || !options.capture_output { - let fd = libc::dup(2); - if fd == -1 { - println_stderr!("cicada: dup error"); - process::exit(1); - } - libc::dup2(fd, 1); - } else { - // note: capture output with redirections does not - // make much sense + if idx_cmd < pipes_count || !options.capture_output { + let fd = libs::dup(2); + if fd == -1 { + println_stderr!("cicada: dup error"); + process::exit(1); } + libs::dup2(fd, 1); + } else { + // note: capture output with redirections does not + // make much sense } } else { let append = op_ == ">>"; @@ -429,14 +413,10 @@ fn _run_single_command( } if from_ == "1" { - unsafe { - libc::dup2(fd, 1); - } + libs::dup2(fd, 1); stdout_redirected = true; } else { - unsafe { - libc::dup2(fd, 2); - } + libs::dup2(fd, 2); stderr_redirected = true; } } @@ -450,20 +430,18 @@ fn _run_single_command( // capture output of last process if needed. if idx_cmd == pipes_count && options.capture_output { - unsafe { - if !stdout_redirected { - if let Some(fds) = fds_capture_stdout { - libc::close(fds.0); - libc::dup2(fds.1, 1); - libc::close(fds.1); - } + if !stdout_redirected { + if let Some(fds) = fds_capture_stdout { + libs::close(fds.0); + libs::dup2(fds.1, 1); + libs::close(fds.1); } - if !stderr_redirected { - if let Some(fds) = fds_capture_stderr { - libc::close(fds.0); - libc::dup2(fds.1, 2); - libc::close(fds.1); - } + } + if !stderr_redirected { + if let Some(fds) = fds_capture_stderr { + libs::close(fds.0); + libs::dup2(fds.1, 2); + libs::close(fds.1); } } } @@ -566,7 +544,7 @@ fn _run_single_command( if redirect_from.0 == "<<<" { if let Some(fds) = fds_stdin { unsafe { - libc::close(fds.0); + libs::close(fds.0); let mut f = File::from_raw_fd(fds.1); match f.write_all(redirect_from.1.clone().as_bytes()) { @@ -577,8 +555,6 @@ fn _run_single_command( Ok(_) => {} Err(e) => println_stderr!("cicada: write_all: {}", e), } - - libc::close(fds.1); } } } @@ -587,16 +563,12 @@ fn _run_single_command( // (in parent) close unused pipe ends if idx_cmd < pipes_count { let fds = pipes[idx_cmd]; - unsafe { - libc::close(fds.1); - } + libs::close(fds.1); } if idx_cmd > 0 { - unsafe { - // close pipe end only after dupped in the child - let fds = pipes[idx_cmd - 1]; - libc::close(fds.0); - } + // close pipe end only after dupped in the child + let fds = pipes[idx_cmd - 1]; + libs::close(fds.0); } if idx_cmd == pipes_count && options.capture_output { @@ -605,22 +577,21 @@ fn _run_single_command( unsafe { if let Some(fds) = fds_capture_stdout { - libc::close(fds.1); - let mut f_out = File::from_raw_fd(fds.0); - match f_out.read_to_string(&mut s_out) { + libs::close(fds.1); + + let mut f = File::from_raw_fd(fds.0); + match f.read_to_string(&mut s_out) { Ok(_) => {} Err(e) => println_stderr!("cicada: readstr: {}", e), } - libc::close(fds.0); } if let Some(fds) = fds_capture_stderr { - libc::close(fds.1); + libs::close(fds.1); let mut f_err = File::from_raw_fd(fds.0); match f_err.read_to_string(&mut s_err) { Ok(_) => {} Err(e) => println_stderr!("cicada: readstr: {}", e), } - libc::close(fds.0); } } diff --git a/src/libs/mod.rs b/src/libs/mod.rs index cf78596..7f4fd2f 100644 --- a/src/libs/mod.rs +++ b/src/libs/mod.rs @@ -4,3 +4,17 @@ pub mod os_type; pub mod path; pub mod re; pub mod term_size; +pub mod progopts; +pub mod pipes; + +pub fn close(fd: i32) { + unsafe { libc::close(fd); } +} + +pub fn dup(fd: i32) -> i32 { + unsafe { libc::dup(fd) } +} + +pub fn dup2(src: i32, dst: i32) { + unsafe { libc::dup2(src, dst); } +} diff --git a/src/libs/pipes.rs b/src/libs/pipes.rs new file mode 100644 index 0000000..8e7973e --- /dev/null +++ b/src/libs/pipes.rs @@ -0,0 +1,12 @@ +// via: nix v0.26.4. We do not want to use OwnedFd in newer version nix. +use std::os::fd::RawFd; +use nix::Error; +use std::mem; +use libc::c_int; + +pub fn pipe() -> std::result::Result<(RawFd, RawFd), Error> { + let mut fds = mem::MaybeUninit::<[c_int; 2]>::uninit(); + let res = unsafe { libc::pipe(fds.as_mut_ptr() as *mut c_int) }; + Error::result(res)?; + unsafe { Ok((fds.assume_init()[0], fds.assume_init()[1])) } +} diff --git a/src/libs/progopts.rs b/src/libs/progopts.rs new file mode 100644 index 0000000..b114dd6 --- /dev/null +++ b/src/libs/progopts.rs @@ -0,0 +1,23 @@ +pub fn is_login(args: &Vec) -> bool { + if args.len() > 0 && args[0].starts_with("-") { + return true; + } + + if args.len() > 1 && (args[1] == "--login" || args[1] == "-l") { + return true; + } + + false +} + +pub fn is_script(args: &Vec) -> bool { + args.len() > 1 && !args[1].starts_with("-") +} + +pub fn is_command_string(args: &Vec) -> bool { + args.len() > 1 && args[1] == "-c" +} + +pub fn is_non_tty() -> bool { + unsafe { libc::isatty(0) == 0 } +} diff --git a/src/libs/term_size.rs b/src/libs/term_size.rs index 89deac7..2b0e3e7 100644 --- a/src/libs/term_size.rs +++ b/src/libs/term_size.rs @@ -9,7 +9,6 @@ static TIOCGWINSZ: c_ulong = 0x5413; #[cfg(any( target_os = "macos", target_os = "ios", - target_os = "bitrig", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", diff --git a/src/main.rs b/src/main.rs index 79a72b7..fe5e0f0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -60,36 +60,28 @@ fn main() { let mut sh = shell::Shell::new(); let args: Vec = env::args().collect(); - // only load RC in a login shell - if args.len() > 0 && args[0].starts_with("-") { + + if libs::progopts::is_login(&args) { rcfile::load_rc_files(&mut sh); sh.is_login = true; } - if args.len() > 1 { - if !args[1].starts_with("-") { - log!("run script: {:?} ", &args); - scripting::run_script(&mut sh, &args); - return; - } + if libs::progopts::is_script(&args) { + log!("run script: {:?} ", &args); + scripting::run_script(&mut sh, &args); + return; + } - // this section handles `cicada -c 'echo hi && echo yoo'`, + if libs::progopts::is_command_string(&args) { + // handles `cicada -c 'echo hi && echo yoo'`, // e.g. it could be triggered from Vim (`:!ls` etc). - if args[1] == "-c" { - let line = tools::env_args_to_command_line(); - log!("run with -c args: {}", &line); - execute::run_command_line(&mut sh, &line, false, false); - return; - } - - if args[1] == "--login" || args[1] == "-l" { - rcfile::load_rc_files(&mut sh); - sh.is_login = true; - } + let line = tools::env_args_to_command_line(); + log!("run with -c args: {}", &line); + execute::run_command_line(&mut sh, &line, false, false); + return; } - let isatty: bool = unsafe { libc::isatty(0) == 1 }; - if !isatty { + if libs::progopts::is_non_tty() { // cases like open a new MacVim window, // (i.e. CMD+N) on an existing one execute::run_procs_for_non_tty(&mut sh); diff --git a/src/types.rs b/src/types.rs index c2ce586..c74d324 100644 --- a/src/types.rs +++ b/src/types.rs @@ -53,7 +53,7 @@ impl WaitStatus { } pub fn get_errno(&self) -> nix::Error { - nix::Error::from_i32(self.2) + nix::Error::from_raw(self.2) } pub fn is_exited(&self) -> bool { @@ -259,6 +259,7 @@ impl Job { } } +#[allow(dead_code)] #[derive(Clone, Debug, Default)] pub struct CommandResult { pub gid: i32, @@ -296,6 +297,7 @@ impl CommandResult { } } +#[allow(dead_code)] #[derive(Clone, Debug, Default)] pub struct CommandOptions { pub background: bool,