From 6557e3ba6e5a7823d131d2da72a4a90bbd64f730 Mon Sep 17 00:00:00 2001 From: Razvan Azamfirei Date: Fri, 10 Nov 2023 18:28:33 -0500 Subject: [PATCH] Add support for fish paths and arrays --- .rustfmt.toml | 2 +- Cargo.lock | 525 +++++++++++++++++++++++++++++---------------- Cargo.toml | 34 +-- src/cli.rs | 27 ++- src/convert/mod.rs | 188 +++++++++------- src/main.rs | 20 +- src/structure.rs | 9 +- 7 files changed, 496 insertions(+), 309 deletions(-) diff --git a/.rustfmt.toml b/.rustfmt.toml index 43d4840..4c46e8b 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -1 +1 @@ -newline_style = "Unix" +newline_style = "Unix" \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 21ad34e..f928ad0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.17.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "gimli", ] @@ -27,36 +27,58 @@ dependencies = [ ] [[package]] -name = "ansi_term" -version = "0.12.1" +name = "anstream" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ - "winapi", + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", ] [[package]] -name = "atty" -version = "0.2.14" +name = "anstyle" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" + +[[package]] +name = "anstyle-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" dependencies = [ - "hermit-abi", - "libc", - "winapi", + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys", ] [[package]] -name = "autocfg" -version = "1.1.0" +name = "anstyle-wincon" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" +dependencies = [ + "anstyle", + "windows-sys", +] [[package]] name = "backtrace" -version = "0.3.64" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e121dee8023ce33ab248d9ce1493df03c3b38a659b240096fcbd7048ff9c31f" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", @@ -73,6 +95,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" + [[package]] name = "cc" version = "1.0.73" @@ -87,92 +115,89 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "3.2.7" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b7b16274bb247b45177db843202209b12191b631a14a9d06e41b3777d6ecf14" +checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" dependencies = [ - "atty", - "bitflags", + "clap_builder", "clap_derive", - "clap_lex", - "indexmap", - "once_cell", - "strsim", - "termcolor", - "terminal_size", - "textwrap", ] [[package]] name = "clap-verbosity-flag" -version = "1.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0636f9c040082f8e161555a305f8cec1a1c2828b3d981c812b8c39f4ac00c42c" +checksum = "e5fdbb015d790cfb378aca82caf9cc52a38be96a7eecdb92f31b4366a8afc019" dependencies = [ "clap", "log", ] +[[package]] +name = "clap_builder" +version = "4.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", + "terminal_size", +] + [[package]] name = "clap_complete" -version = "3.2.3" +version = "4.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ead064480dfc4880a10764488415a97fdd36a4cf1bb022d372f02e8faf8386e1" +checksum = "bffe91f06a11b4b9420f62103854e90867812cd5d01557f853c5ee8e791b12ae" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "3.2.7" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759bf187376e1afa7b85b959e6a664a3e7a95203415dba952ad19139e798f902" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ "heck", - "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 2.0.29", ] [[package]] name = "clap_lex" -version = "0.2.2" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5538cd660450ebeb4234cfecf8f2284b844ffc4c50531e66d584ad5b91293613" -dependencies = [ - "os_str_bytes", -] +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "clap_mangen" -version = "0.1.10" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "937efe4451c32be4ccb3e19549cbb1ea5cb85197f39b87a9662ca1d7b1765d1d" +checksum = "d3be86020147691e1d2ef58f75346a3d4d94807bfc473e377d52f09f0f7d77f7" dependencies = [ "clap", "roff", ] [[package]] -name = "colored" -version = "2.0.0" +name = "colorchoice" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" -dependencies = [ - "atty", - "lazy_static", - "winapi", -] +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] -name = "ctor" -version = "0.1.22" +name = "colored" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c" +checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" dependencies = [ - "quote", - "syn", + "is-terminal", + "lazy_static", + "windows-sys", ] [[package]] @@ -183,37 +208,65 @@ checksum = "0e25ea47919b1560c4e3b7fe0aaab9becf5b84a10325ddf7db0f0ba5e1026499" [[package]] name = "dirs" -version = "4.0.0" +version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" dependencies = [ "dirs-sys", ] [[package]] name = "dirs-sys" -version = "0.3.7" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" dependencies = [ "libc", + "option-ext", "redox_users", - "winapi", + "windows-sys", ] [[package]] name = "env_logger" -version = "0.9.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +checksum = "95b3f3e67048839cb0d0781f445682a35113da7121f7c949db0e2be96a4fbece" dependencies = [ - "atty", "humantime", + "is-terminal", "log", "regex", "termcolor", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "exitcode" version = "1.1.2" @@ -233,15 +286,15 @@ dependencies = [ [[package]] name = "gimli" -version = "0.26.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "hashbrown" -version = "0.12.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" [[package]] name = "heck" @@ -251,24 +304,22 @@ checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" [[package]] name = "hermit-abi" -version = "0.1.19" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] name = "human-panic" -version = "1.0.3" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39f357a500abcbd7c5f967c1d45c8838585b36743823b9d43488f24850534e36" +checksum = "7a79a67745be0cb8dd2771f03b24c2f25df98d5471fe7a595d668cfa2e6f843d" dependencies = [ + "anstream", + "anstyle", "backtrace", - "os_type", + "os_info", "serde", "serde_derive", - "termcolor", "toml", "uuid", ] @@ -281,20 +332,31 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "indexmap" -version = "1.9.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ - "autocfg", + "equivalent", "hashbrown", "serde", ] [[package]] name = "indoc" -version = "1.0.6" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05a0bd019339e5d968b37855180087b7b9d512c5046fbd244cf8c95687927d6e" +checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" + +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi", + "rustix", + "windows-sys", +] [[package]] name = "lazy_static" @@ -304,18 +366,21 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.121" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" + +[[package]] +name = "linux-raw-sys" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" [[package]] name = "log" -version = "0.4.17" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "maplit" @@ -325,109 +390,69 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" [[package]] name = "memchr" -version = "2.4.1" +version = "2.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "5486aed0026218e61b8a01d5fbd5a0a134649abb71a0e53b7bc088529dced86e" [[package]] name = "miniz_oxide" -version = "0.4.4" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ "adler", - "autocfg", ] [[package]] name = "object" -version = "0.27.1" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9" +checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" dependencies = [ "memchr", ] [[package]] -name = "once_cell" -version = "1.12.0" +name = "option-ext" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] -name = "os_str_bytes" -version = "6.0.0" +name = "os_info" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" - -[[package]] -name = "os_type" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3df761f6470298359f84fcfb60d86db02acc22c251c37265c07a3d1057d2389" -dependencies = [ - "regex", -] - -[[package]] -name = "output_vt100" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66" +checksum = "006e42d5b888366f1880eda20371fedde764ed2213dc8496f49622fa0c99cd5e" dependencies = [ + "log", + "serde", "winapi", ] [[package]] name = "pretty_assertions" -version = "1.2.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89f989ac94207d048d92db058e4f6ec7342b0971fc58d1271ca148b799b3563" +checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" dependencies = [ - "ansi_term", - "ctor", "diff", - "output_vt100", -] - -[[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", + "yansi", ] [[package]] name = "proc-macro2" -version = "1.0.36" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ - "unicode-xid", + "unicode-ident", ] [[package]] name = "quote" -version = "1.0.17" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632d02bff7f874a36f33ea8bb416cd484b90cc66c1194b1a1110d067a7013f58" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -438,7 +463,7 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ae183fc1b06c149f0c1793e1eb447c8b04bfe46d48e9e48bfb8d2d7ed64ecf0" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -481,24 +506,46 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +[[package]] +name = "rustix" +version = "0.38.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0c3dde1fc030af041adc40e79c0e7fbcf431dd24870053d187d7c66e4b87453" +dependencies = [ + "bitflags 2.4.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "serde" -version = "1.0.137" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.137" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.29", +] + +[[package]] +name = "serde_spanned" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" +dependencies = [ + "serde", ] [[package]] @@ -519,31 +566,33 @@ dependencies = [ ] [[package]] -name = "termcolor" -version = "1.1.3" +name = "syn" +version = "2.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" dependencies = [ - "winapi-util", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "terminal_size" -version = "0.1.17" +name = "termcolor" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ - "libc", - "winapi", + "winapi-util", ] [[package]] -name = "textwrap" -version = "0.15.0" +name = "terminal_size" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" dependencies = [ - "terminal_size", + "rustix", + "windows-sys", ] [[package]] @@ -563,39 +612,70 @@ checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.90", ] [[package]] name = "toml" -version = "0.5.9" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", ] +[[package]] +name = "toml_datetime" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "unicode-ident" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" + [[package]] name = "unicode-xid" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "uuid" -version = "0.8.2" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" dependencies = [ "getrandom", ] -[[package]] -name = "version_check" -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" @@ -633,9 +713,84 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "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.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "winnow" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" +dependencies = [ + "memchr", +] + [[package]] name = "xshe" -version = "0.5.1" +version = "0.6.0" dependencies = [ "clap", "clap-verbosity-flag", @@ -654,3 +809,9 @@ dependencies = [ "serde", "toml", ] + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" diff --git a/Cargo.toml b/Cargo.toml index 4e0c42f..85451a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xshe" -version = "0.5.1" +version = "0.6.0" edition = "2021" description = "Set environment variables across multiple shells with a single configuration file." readme = "README.md" @@ -17,25 +17,25 @@ maintenance = { status = "actively-developed" } # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -clap = { version = "3.2.7", features = ["derive", "env", "wrap_help"] } -clap-verbosity-flag = "1.0.1" +clap = { version = "4.4.7", features = ["derive", "env", "wrap_help"] } +clap-verbosity-flag = "2.1.0" exitcode = "1.1.2" -toml = "0.5.9" -serde = { version = "1.0.137", features = ["derive"] } -indexmap = { version = "1.9.1", features = ["serde"] } -human-panic = "1.0.3" -log = "0.4.17" -env_logger = "0.9.0" -colored = "2.0.0" -dirs = "4.0.0" +toml = { version = "0.8.8", features = ["parse"] } +serde = { version = "1.0.192", features = ["derive"] } +indexmap = { version = "2.1.0", features = ["serde"] } +human-panic = "1.2.2" +log = "0.4.20" +env_logger = "0.10.1" +colored = "2.0.4" +dirs = "5.0.1" [dev-dependencies] -indoc = "1.0.6" +indoc = "2.0.4" maplit = "1.0.2" -pretty_assertions = "1.2.1" +pretty_assertions = "1.4.0" [build-dependencies] -clap = { version = "3.2.7", features = ["derive", "env", "wrap_help"] } -clap-verbosity-flag = "1.0.1" -clap_mangen = "0.1.10" -clap_complete = "3.2.3" +clap = { version = "4.4.7", features = ["derive", "env", "wrap_help"] } +clap-verbosity-flag = "2.1.0" +clap_mangen = "0.2.15" +clap_complete = "4.4.4" diff --git a/src/cli.rs b/src/cli.rs index 1fa556c..7b20c6d 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -13,15 +13,14 @@ //! Defines the CLI interface for Xshe. -use clap::{AppSettings, ArgEnum, ArgGroup, Parser, ValueHint}; +use clap::{ArgGroup, Parser, ValueEnum, ValueHint}; use clap_verbosity_flag::{Verbosity, WarnLevel}; use std::path::PathBuf; // CLI Parser. #[derive(Parser, Debug)] -#[clap(group = ArgGroup::new("mode").multiple(false))] -#[clap(global_setting(AppSettings::DeriveDisplayOrder))] -#[clap(version, arg_required_else_help = true)] +#[command(about, long_about, author, version)] +#[command(arg_required_else_help = true, group = ArgGroup::new("mode").multiple(false))] /// Cross-Shell Environment Variable Manager /// /// Xshe sets shell environment variables across multiple shells with a single configuration file. @@ -37,11 +36,11 @@ pub struct Cli { /// /// You can directly source these files in your shell. /// See for a detailed explanation. - #[clap(arg_enum, index = 1)] + #[arg(value_enum, index = 1)] pub shell: Shell, - #[clap(group = "mode")] - #[clap(short, long, parse(from_os_str), value_name = "FILE", value_hint = ValueHint::FilePath)] + #[arg(short, long, value_name = "FILE", value_hint = ValueHint::FilePath)] + #[arg(env = "XSHE_CONFIG", group = "mode")] /// Specifies a custom location to read from /// /// This defaults to $XDG_CONFIG_HOME, or ~/.config if not set. @@ -51,16 +50,15 @@ pub struct Cli { /// The file must be in TOML format (https://toml.io/en/).") pub file: Option, - #[clap(group = "mode")] - #[clap(short, long, value_name = "TOML", visible_alias = "toml", value_hint = ValueHint::Other)] + #[arg(short, long, value_name = "TOML", value_hint = ValueHint::Other)] + #[arg(visible_alias = "toml", group = "mode")] /// Directly specify TOML to parse /// /// The passed string must be in TOML format (https://toml.io/en/). pub text: Option, - #[clap(group = "mode")] - #[clap(short, long, value_name = "PIPE", alias = "stdin")] - #[clap(verbatim_doc_comment)] + #[arg(short, long, value_name = "PIPE", verbatim_doc_comment)] + #[arg(alias = "stdin", group = "mode", action)] /// Get TOML-formatted data from the standard input /// /// This is normally used to pass a configuration in from a pipe, like so: @@ -68,16 +66,15 @@ pub struct Cli { /// cat xshe.toml | xshe bash /// /// The passed string must be in TOML format (https://toml.io/en/). - #[clap(takes_value = false)] pub pipe: bool, #[clap(flatten)] pub verbose: Verbosity, } -#[derive(ArgEnum, Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(ValueEnum, Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum Shell { Bash, - Zsh, Fish, + Zsh, } diff --git a/src/convert/mod.rs b/src/convert/mod.rs index 9f59090..1ae1730 100644 --- a/src/convert/mod.rs +++ b/src/convert/mod.rs @@ -19,8 +19,7 @@ #![allow(clippy::ptr_arg)] mod parser; - -use clap::ArgEnum; +use clap::ValueEnum; use indexmap::IndexMap; use std::string::String; @@ -30,43 +29,53 @@ use crate::structure::{EnvVariableOption, EnvVariableValue, EnvironmentVariables /// Converts the hash table of `vars` into a script for the given `shell`. pub(crate) fn to_shell_source(vars: &EnvironmentVariables, shell: &Shell) -> String { - let mut output = String::new(); - for (name, variable_option) in vars { - // Check whether the current item is a single environment var or a table of specific shells. - let raw_value = match variable_option { - EnvVariableOption::General(v) => v, - - // If it is a shell specific choice, get the correct value for `shell`, and then... - EnvVariableOption::Specific(map) => match value_for_specific(shell, map) { - Some(v) => v, // ...extract the `EnvVariableValue` if it exists - None => continue, // ...and skip the value if it does not. - }, - }; - - // Convert all forms into a processed string representation. - let value = &match raw_value { - // If the value of the environment variable is `false`, - // then add the "unset" script line to the String and skip the rest of this function. - EnvVariableValue::Set(false) => { - add_script_line::unset_variable(&mut output, shell, name); - continue; - } - - EnvVariableValue::String(string) => expand_value(string.as_str(), shell), - EnvVariableValue::Set(true) => String::from("1"), - EnvVariableValue::Array(array) => { - let v_expanded: Vec = array - .iter() - .map(|value| expand_value(value, shell)) - .collect(); - v_expanded.join(":") + let outputs: Vec = vars + .iter() + .filter_map(|(name, variable_option)| { + // Check whether the current item is a single environment var or a table of + // specific shells. + match variable_option { + EnvVariableOption::General(v) => Some(v), + // If it is a shell specific choice, get the correct value for `shell`, + // and then extract the `EnvVariableValue` if it exists and skip the value + // if it does not + EnvVariableOption::Specific(map) => value_for_specific(shell, map), } - }; - let is_path = matches!(raw_value, EnvVariableValue::Array(_)); + .map(|raw_value| process_variable(shell, name, raw_value)) + }) + .collect(); + outputs.join("\n") + "\n" +} - add_script_line::set_variable(&mut output, shell, name, value, is_path); - } - output +fn process_variable(shell: &Shell, name: &str, raw_value: &EnvVariableValue) -> String { + // If the value of the environment variable is `false`, + // then add the "unset" script line to the String and skip the rest of this function. + let script_line = match raw_value { + EnvVariableValue::Set(false) => add_script_line::unset_variable(shell, name), + EnvVariableValue::Set(true) => add_script_line::set_variable(shell, name, "1", false), + EnvVariableValue::String(string) => { + let expanded_value = expand_value(string, shell); + add_script_line::set_variable(shell, name, &expanded_value, false) + } + EnvVariableValue::Array(array_of_arrays) => { + let flattened_array = array_of_arrays + .iter() + .flat_map(|array| array.iter()) + .map(|value| expand_value(value, shell)) + .collect::>() + .join(":"); + add_script_line::set_variable(shell, name, &flattened_array, false) + } + EnvVariableValue::Path(path) => { + let path_string = path + .iter() + .map(|value| expand_value(value, shell)) + .collect::>() + .join(":"); + add_script_line::set_variable(shell, name, &path_string, true) + } + }; + script_line } // Module for adding a line to the script that will be sourced by the shell. @@ -74,13 +83,7 @@ pub(crate) fn to_shell_source(vars: &EnvironmentVariables, shell: &Shell) -> Str mod add_script_line { use crate::cli::Shell::{self, *}; - pub fn set_variable( - output: &mut String, - shell: &Shell, - name: &str, - value: &str, - is_path: bool, - ) { + pub fn set_variable(shell: &Shell, name: &str, value: &str, is_path: bool) -> String { // Log each processed variable if log_enabled!(log::Level::Trace) { let variable_log_header = match is_path { @@ -91,39 +94,23 @@ mod add_script_line { }; // Select the correct form for the chosen shell. - *output += &match shell { - Bash | Zsh => { - format!("export {}=", name) - } + match shell { + Bash | Zsh => format!("export {}={}", name, value), Fish => { - // Add `--path` to the variable if the variable is represented as a list. - let path = match is_path { - true => " --path", - false => "", - }; - format!("set -gx{path} {} ", name, path = path) + let path_option = if is_path { " --path" } else { "" }; + format!("set -gx{} {} {}", path_option, name, value) } - }; - - *output += value; - *output += "\n"; + } } - pub fn unset_variable(output: &mut String, shell: &Shell, name: &str) { - // Log each processed variable + pub fn unset_variable(shell: &Shell, name: &str) -> String { trace!("Unset: {}", name); // Select the correct form for the chosen shell. - *output += &match shell { - Bash | Zsh => { - format!("unset {}", name) - } - Fish => { - format!("set -ge {}", name) - } - }; - - *output += "\n"; + match shell { + Bash | Zsh => format!("unset {}", name), + Fish => format!("set -ge {}", name), + } } } @@ -133,7 +120,8 @@ fn value_for_specific<'a>( shell: &Shell, map: &'a IndexMap, ) -> Option<&'a EnvVariableValue> { - let shell_name = shell.to_possible_value()?.get_name(); + let binding = shell.to_possible_value()?; + let shell_name = binding.get_name(); map.get(shell_name).or_else(|| map.get("_")) } @@ -144,13 +132,12 @@ fn expand_value(value: &str, shell: &Shell) -> String { let value_parts = parser::parse_value(value); - let mut expanded_value = String::new(); + // Pre-allocate space for the string + let mut expanded_value = String::with_capacity(value.len() * 2); // Handle each part for the specified shell, and concatenate each part together. - for part in value_parts { - let parser::ValuePart { value, kind } = part; - - expanded_value += &match (kind, shell) { + let shell_format = |kind: &ValuePartKind, value: &str| -> String { + match (kind, shell) { (Literal, _) => single_quote(value, shell), (ShellVariable, Bash | Zsh | Fish) => format!(r#""${}""#, value), @@ -163,6 +150,10 @@ fn expand_value(value: &str, shell: &Shell) -> String { } (Home, Fish) => format!("(eval echo \"~{}\")", value), } + }; + + for parser::ValuePart { value, kind } in value_parts { + expanded_value.push_str(&shell_format(&kind, &value)); } expanded_value } @@ -170,7 +161,7 @@ fn expand_value(value: &str, shell: &Shell) -> String { // Surround a string in single quotes in a way that is best suited for a specific shell. // Specifically, Fish shell has a simpler way of escaping single quotes in a single quoted string, // while Bash and Zsh have to do it another way. -fn single_quote(string: String, shell: &Shell) -> String { +fn single_quote(string: &str, shell: &Shell) -> String { match shell { Bash | Zsh => string // Bash and Zsh can't escape any single quotes within a single-quoted string, @@ -262,7 +253,7 @@ mod test_conversion { // language=TOML r#"PATH = ["/usr/local/bin", "/usr/bin", "/bin", "/usr/sbin", "/sbin"]"#, indexmap! { - "PATH".into() => General(EnvVariableValue::Array(vec![ + "PATH".into() => General(EnvVariableValue::Path(vec![ "/usr/local/bin".into(), "/usr/bin".into(), "/bin".into(), @@ -279,6 +270,27 @@ mod test_conversion { ) } + #[test] + fn test_convert_array() { + assert_convert( + // language=TOML + r#"ARRAY = [["array_item_1", "array_item_2", "array_item_3"]]"#, + indexmap! { + "ARRAY".into() => General(EnvVariableValue::Array(vec![vec![ + "array_item_1".into(), + "array_item_2".into(), + "array_item_3".into(), + ]])), + }, + // language=sh + hashmap! { + Bash => r#"export ARRAY='array_item_1':'array_item_2':'array_item_3'"#, + Zsh => r#"export ARRAY='array_item_1':'array_item_2':'array_item_3'"#, + Fish => r#"set -gx ARRAY 'array_item_1':'array_item_2':'array_item_3'"#, + }, + ) + } + #[test] fn test_convert_set() { assert_convert( @@ -500,7 +512,7 @@ mod test_conversion { hashmap! { Bash => r#"export MESSAGE='I '"'"'love'"'"' books'"#, Zsh => r#"export MESSAGE='I '"'"'love'"'"' books'"#, - Fish => r#"set -gx MESSAGE 'I \'love\' books'"#, + Fish => r"set -gx MESSAGE 'I \'love\' books'", }, ) } @@ -515,6 +527,8 @@ mod test_conversion { BAZ.zsh = 'zž' BAZ.fish = ['gone', '$fishing'] BAZ._ = '~other' + ARRAY_TEST = [['$home', 'alone']] + NOTHING_CHANGES = ['$home', 'alone'] TTY = '$(tty)' THE_ECHO = '$(echo "\)")' XSHE_IS_THE_BEST = true # look, idk. @@ -525,9 +539,17 @@ mod test_conversion { "FOO".into() => General(EnvVariableValue::String("bar".into())), "BAZ".into() => Specific(indexmap! { "zsh".into() => EnvVariableValue::String("zž".into()), - "fish".into() => EnvVariableValue::Array(vec!["gone".into(), "$fishing".into()]), + "fish".into() => EnvVariableValue::Path(vec!["gone".into(), "$fishing".into()]), "_".into() => EnvVariableValue::String("~other".into()), }), + "ARRAY_TEST".into() => General(EnvVariableValue::Array(vec![vec![ + "$home".into(), + "alone".into(), + ]])), + "NOTHING_CHANGES".into() => General(EnvVariableValue::Path(vec![ + "$home".into(), + "alone".into(), + ])), "TTY".into() => General(EnvVariableValue::String("$(tty)".into())), "THE_ECHO".into() => General(EnvVariableValue::String(r#"$(echo "\)")"#.into())), "XSHE_IS_THE_BEST".into() => General(EnvVariableValue::Set(true)), @@ -540,6 +562,8 @@ mod test_conversion { Bash => indoc! (r#" export FOO='bar' export BAZ=$(eval echo "~other") + export ARRAY_TEST="$home":'alone' + export NOTHING_CHANGES="$home":'alone' export TTY=$(eval 'tty') export THE_ECHO=$(eval 'echo ")"') export XSHE_IS_THE_BEST=1 @@ -548,6 +572,8 @@ mod test_conversion { Zsh => indoc! (r#" export FOO='bar' export BAZ='zž' + export ARRAY_TEST="$home":'alone' + export NOTHING_CHANGES="$home":'alone' export TTY=$(eval 'tty') export THE_ECHO=$(eval 'echo ")"') export XSHE_IS_THE_BEST=1 @@ -555,6 +581,8 @@ mod test_conversion { Fish => indoc! (r#" set -gx FOO 'bar' set -gx --path BAZ 'gone':"$fishing" + set -gx ARRAY_TEST "$home":'alone' + set -gx --path NOTHING_CHANGES "$home":'alone' set -gx TTY (eval 'tty') set -gx THE_ECHO (eval 'echo ")"') set -gx XSHE_IS_THE_BEST 1 diff --git a/src/main.rs b/src/main.rs index f583b7b..cdc8620 100644 --- a/src/main.rs +++ b/src/main.rs @@ -33,7 +33,7 @@ mod structure; #[macro_use] extern crate log; -use clap::{ArgEnum, Parser}; +use clap::{Parser, ValueEnum}; use human_panic::setup_panic; use indexmap::IndexMap; use std::io::{stdin, ErrorKind, Read}; @@ -88,12 +88,11 @@ fn main() { Err(e) => { // Display the error and exit. error!( - "The file {} is not in a valid TOML format,\nor it is not in the form xshe is expecting.", - file_name, - ); - if let Some((line, column)) = e.line_col() { - error!("Parse error at line {:}, column {:}", line + 1, column + 1); - } + "The file {} is not in a valid TOML format,\n\ + or it is not in the form xshe is expecting.", + file_name + ); + error!("{}", e); exit(exitcode::CONFIG) } }; @@ -130,7 +129,7 @@ fn deprecated_to_specific_shell_source(file_data: &ConfigFile, shell: &Shell) { let shell_specific_output = convert::to_shell_source(&wrap_specific_vars, shell); - print!("{}", shell_specific_output); + print!("{:?}", shell_specific_output); }; } @@ -200,6 +199,7 @@ fn exit_with_file_error(kind: ErrorKind, file_name: &str, file_option_set: bool) exit(exit_code); } +// Deprecated fn get_specific_shell<'a>( shell: &Shell, file_data: &'a ConfigFile, @@ -212,8 +212,8 @@ fn get_specific_shell<'a>( //! ... //! ``` //! This function's output is meant to be passed into `to_shell_source(...)`. - - let field_name = shell.to_possible_value()?.get_name(); + let binding = shell.to_possible_value()?; + let field_name = binding.get_name(); file_data.shell.as_ref()?.get(field_name) } diff --git a/src/structure.rs b/src/structure.rs index a86fe7a..a7faa50 100644 --- a/src/structure.rs +++ b/src/structure.rs @@ -32,22 +32,23 @@ pub(crate) struct ConfigFile { impl ConfigFile { pub(crate) fn load(toml_string: String) -> Result { - toml::from_str(&*toml_string) + toml::from_str(&toml_string) } } #[derive(Deserialize, Debug, Clone, Eq, PartialEq)] #[serde(untagged)] pub(crate) enum EnvVariableOption { - Specific(IndexMap), General(EnvVariableValue), + Specific(IndexMap), } /// Enum of possible environment variable value types. #[derive(Deserialize, Debug, Clone, Eq, PartialEq)] #[serde(untagged)] pub(crate) enum EnvVariableValue { - String(String), - Array(Vec), + Array(Vec>), + Path(Vec), Set(bool), + String(String), }