diff --git a/Cargo.lock b/Cargo.lock index e6cef1232b..d15ecdf729 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,19 +4,13 @@ version = 3 [[package]] name = "addr2line" -version = "0.22.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "adler2" version = "2.0.0" @@ -88,9 +82,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.18" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" [[package]] name = "alphanumeric-sort" @@ -134,9 +128,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.15" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", @@ -149,49 +143,58 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.4" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" + +[[package]] +name = "arbitrary" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" +dependencies = [ + "derive_arbitrary", +] [[package]] name = "arboard" -version = "3.4.0" +version = "3.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb4009533e8ff8f1450a5bcbc30f4242a1d34442221f72314bea1f5dc9c7f89" +checksum = "df099ccb16cd014ff054ac1bf392c67feeef57164b05c42f037cd40f5d4357f4" dependencies = [ "clipboard-win", "log", @@ -258,9 +261,9 @@ dependencies = [ [[package]] name = "async-stream" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" dependencies = [ "async-stream-impl", "futures-core", @@ -269,9 +272,9 @@ dependencies = [ [[package]] name = "async-stream-impl" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", @@ -280,9 +283,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.81" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", @@ -312,9 +315,9 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "avro-schema" @@ -332,17 +335,17 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.73" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", - "miniz_oxide 0.7.4", + "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -354,12 +357,6 @@ dependencies = [ "backtrace", ] -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -368,16 +365,14 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bindgen" -version = "0.69.4" +version = "0.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" dependencies = [ "bitflags 2.6.0", "cexpr", "clang-sys", - "itertools 0.12.1", - "lazy_static", - "lazycell", + "itertools 0.13.0", "proc-macro2", "quote", "regex", @@ -448,9 +443,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.5.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" +checksum = "2506947f73ad44e344215ccd6403ac2ae18cd8e046e581a441bf8d199f257f03" dependencies = [ "borsh-derive", "cfg_aliases 0.2.1", @@ -458,16 +453,15 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.5.1" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" +checksum = "c2593a3b8b938bd68373196c9832f516be11fa487ef4ae745eb282e6a56a7244" dependencies = [ "once_cell", "proc-macro-crate", "proc-macro2", "quote", "syn 2.0.87", - "syn_derive", ] [[package]] @@ -499,9 +493,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" +checksum = "1a68f1f47cdf0ec8ee4b941b2eee2a80cb796db73118c0dd09ac63fbe405be22" dependencies = [ "memchr", "regex-automata", @@ -516,9 +510,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byte-unit" -version = "5.1.4" +version = "5.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ac19bdf0b2665407c39d82dbc937e951e7e2001609f0fb32edd0af45a2d63e" +checksum = "e1cd29c3c585209b0cbc7309bfe3ed7efd8c84c21b7af29c8bfae908f8777174" dependencies = [ "rust_decimal", "serde", @@ -555,18 +549,18 @@ checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce" [[package]] name = "bytemuck" -version = "1.17.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fd4c6dcc3b0aea2f5c0b4b82c2b15fe39ddbc76041a310848f4706edf76bb31" +checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.7.1" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc8b54b395f2fcfbb3d90c47b01c7f444d94d05bdeb775811dec868ac3bbc26" +checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec" dependencies = [ "proc-macro2", "quote", @@ -593,16 +587,15 @@ checksum = "a3e368af43e418a04d52505cf3dbc23dda4e3407ae2fa99fd0e4f308ce546acc" [[package]] name = "calamine" -version = "0.24.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a3a315226fdc5b1c3e33521073e1712a05944bc0664d665ff1f6ff0396334da" +checksum = "138646b9af2c5d7f1804ea4bf93afc597737d2bd4f7341d67c48b03316976eb1" dependencies = [ "byteorder", "chrono", "codepage", "encoding_rs", "log", - "once_cell", "quick-xml 0.31.0", "serde", "zip", @@ -625,9 +618,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.14" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d2eb3cd3d1bf4529e31c215ee6f93ec5a3d536d9f578f93d9d33ee19562932" +checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" dependencies = [ "jobserver", "libc", @@ -678,7 +671,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1f927b07c74ba84c7e5fe4db2baeb3e996ab2688992e39ac68ce3220a677c7e" dependencies = [ - "base64 0.22.1", + "base64", "encoding_rs", ] @@ -773,9 +766,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.16" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" +checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" dependencies = [ "clap_builder", "clap_derive", @@ -783,22 +776,22 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.15" +version = "4.5.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" dependencies = [ "anstream", "anstyle", "clap_lex", "strsim", - "terminal_size", + "terminal_size 0.4.0", ] [[package]] name = "clap_derive" -version = "4.5.13" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck", "proc-macro2", @@ -808,9 +801,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" [[package]] name = "clipboard-win" @@ -832,9 +825,9 @@ dependencies = [ [[package]] name = "colorchoice" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "colorz" @@ -847,14 +840,14 @@ dependencies = [ [[package]] name = "comfy-table" -version = "7.1.1" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b34115915337defe99b2aff5c2ce6771e5fbc4079f4b506301f5cf394c8452f7" +checksum = "24f165e7b643266ea80cb858aed492ad9280e3e05ce24d4a99d7d7b889b6a4d9" dependencies = [ - "crossterm 0.27.0", + "crossterm 0.28.1", "strum", "strum_macros", - "unicode-width", + "unicode-width 0.2.0", ] [[package]] @@ -894,7 +887,7 @@ dependencies = [ "encode_unicode", "lazy_static", "libc", - "unicode-width", + "unicode-width 0.1.11", "windows-sys 0.52.0", ] @@ -920,18 +913,18 @@ dependencies = [ [[package]] name = "const_format" -version = "0.2.32" +version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673" +checksum = "50c655d81ff1114fb0dcdea9225ea9f0cc712a6f8d189378e82bdf62a473a64b" dependencies = [ "const_format_proc_macros", ] [[package]] name = "const_format_proc_macros" -version = "0.2.32" +version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500" +checksum = "eff1a44b93f47b1bac19a27932f5c591e43d1ba357ee4f61526c8a25603f0eb1" dependencies = [ "proc-macro2", "quote", @@ -956,9 +949,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.13" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" +checksum = "0ca741a962e1b0bff6d724a1a0958b686406e853bb14061f218562e1896f95e6" dependencies = [ "libc", ] @@ -1113,9 +1106,9 @@ dependencies = [ [[package]] name = "csv" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" +checksum = "acdc4883a9c96732e4733212c01447ebd805833b7275a73ca3ee080fd77afdaf" dependencies = [ "csv-core", "itoa", @@ -1144,9 +1137,9 @@ dependencies = [ [[package]] name = "curl" -version = "0.4.46" +version = "0.4.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e2161dd6eba090ff1594084e95fd67aeccf04382ffea77999ea94ed42ec67b6" +checksum = "d9fb4d13a1be2b58f14d60adba57c9834b78c62fd86c3e76a148f732686e9265" dependencies = [ "curl-sys", "libc", @@ -1159,9 +1152,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.74+curl-8.9.0" +version = "0.4.78+curl-8.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8af10b986114528fcdc4b63b6f5f021b7057618411046a4de2ba0f0149a097bf" +checksum = "8eec768341c5c7789611ae51cf6c459099f22e64a5d5d0ce4892434e33821eaf" dependencies = [ "cc", "libc", @@ -1198,6 +1191,17 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "derive_arbitrary" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "derive_more" version = "0.99.18" @@ -1218,7 +1222,7 @@ dependencies = [ "console", "fuzzy-matcher", "shell-words", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1264,6 +1268,17 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "dlib" version = "0.5.2" @@ -1372,9 +1387,9 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "encoding_rs" -version = "0.8.34" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ "cfg-if", ] @@ -1452,9 +1467,9 @@ dependencies = [ [[package]] name = "error-code" -version = "3.2.0" +version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0474425d51df81997e2f90a21591180b38eccf27292d755f3e30750225c175b" +checksum = "a5d9305ccc6942a704f4335694ecd3de2ea531b114ac2d51f5f843750787a92f" [[package]] name = "ethnum" @@ -1493,9 +1508,9 @@ checksum = "95765f67b4b18863968b4a1bd5bb576f732b29a4a28c7cd84c09fa3e2875f33c" [[package]] name = "fastrand" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "fd-lock" @@ -1510,11 +1525,11 @@ dependencies = [ [[package]] name = "file-id" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6584280525fb2059cba3db2c04abf947a1a29a45ddae89f3870f8281704fafc9" +checksum = "6bc904b9bbefcadbd8e3a9fb0d464a9b979de6324c03b3c663e8994f46a5be36" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -1528,9 +1543,9 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.24" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf401df4a4e3872c4fe8151134cf483738e74b67fc934d6532c882b3d24a4550" +checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" dependencies = [ "cfg-if", "libc", @@ -1546,12 +1561,12 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.32" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c0596c1eac1f9e04ed902702e9878208b336edc9d6fddc8a48387349bab3666" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", - "miniz_oxide 0.8.0", + "miniz_oxide", ] [[package]] @@ -1569,6 +1584,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" + [[package]] name = "foreign-types" version = "0.3.2" @@ -1626,9 +1647,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -1641,9 +1662,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -1651,15 +1672,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -1668,15 +1689,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", @@ -1685,21 +1706,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -1766,9 +1787,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.29.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "git2" @@ -1875,9 +1896,14 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] [[package]] name = "hashlink" @@ -1995,9 +2021,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "httpdate" @@ -2014,7 +2040,7 @@ dependencies = [ "chrono", "pest", "pest_derive", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -2025,9 +2051,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" dependencies = [ "bytes", "futures-channel", @@ -2045,9 +2071,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.7" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ "bytes", "futures-util", @@ -2060,9 +2086,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.60" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -2087,17 +2113,146 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b7cab7543a8b7729a19e2c04309f902861293dcdae6558dfbeb634454d279f6" dependencies = [ - "thiserror", + "thiserror 1.0.69", +] + +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", ] [[package]] name = "idna" -version = "0.5.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", ] [[package]] @@ -2107,21 +2262,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.15.0", + "hashbrown 0.15.1", "serde", ] [[package]] name = "indicatif" -version = "0.17.8" +version = "0.17.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" +checksum = "cbf675b85ed934d3c67b5c5469701eec7db22689d0a2139d856e0925fa28b281" dependencies = [ "console", - "instant", "number_prefix", "portable-atomic", - "unicode-width", + "unicode-width 0.2.0", + "web-time", ] [[package]] @@ -2144,15 +2299,6 @@ dependencies = [ "libc", ] -[[package]] -name = "instant" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" -dependencies = [ - "cfg-if", -] - [[package]] name = "interprocess" version = "2.2.1" @@ -2216,9 +2362,9 @@ checksum = "06d198e9919d9822d5f7083ba8530e04de87841eaf21ead9af8f2304efd57c89" [[package]] name = "is_executable" -version = "1.0.1" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa9acdc6d67b75e626ad644734e8bc6df893d9cd2a834129065d3dd6158ea9c8" +checksum = "d4a1b5bad6f9072935961dfbf1cced2f3d129963d091b6f69f007fe04e758ae2" dependencies = [ "winapi", ] @@ -2285,9 +2431,9 @@ checksum = "72167d68f5fce3b8655487b8038691a3c9984ee769590f93f2a631f4ad64e4f5" [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -2329,17 +2475,11 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "lexical-core" -version = "0.8.5" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cde5de06e8d4c2faabc400238f9ae1c74d5412d03a7bd067645ccbc47070e46" +checksum = "0431c65b318a590c1de6b8fd6e72798c92291d27762d94c9e6c37ed7a73d8458" dependencies = [ "lexical-parse-float", "lexical-parse-integer", @@ -2350,9 +2490,9 @@ dependencies = [ [[package]] name = "lexical-parse-float" -version = "0.8.5" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f" +checksum = "eb17a4bdb9b418051aa59d41d65b1c9be5affab314a872e5ad7f06231fb3b4e0" dependencies = [ "lexical-parse-integer", "lexical-util", @@ -2361,9 +2501,9 @@ dependencies = [ [[package]] name = "lexical-parse-integer" -version = "0.8.6" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9" +checksum = "5df98f4a4ab53bf8b175b363a34c7af608fe31f93cc1fb1bf07130622ca4ef61" dependencies = [ "lexical-util", "static_assertions", @@ -2371,18 +2511,18 @@ dependencies = [ [[package]] name = "lexical-util" -version = "0.8.5" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc" +checksum = "85314db53332e5c192b6bca611fb10c114a80d1b831ddac0af1e9be1b9232ca0" dependencies = [ "static_assertions", ] [[package]] name = "lexical-write-float" -version = "0.8.5" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accabaa1c4581f05a3923d1b4cfd124c329352288b7b9da09e766b0668116862" +checksum = "6e7c3ad4e37db81c1cbe7cf34610340adc09c322871972f74877a712abc6c809" dependencies = [ "lexical-util", "lexical-write-integer", @@ -2391,9 +2531,9 @@ dependencies = [ [[package]] name = "lexical-write-integer" -version = "0.8.5" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1b6f3d1f4422866b68192d62f77bc5c700bee84f3069f2469d7bc8c77852446" +checksum = "eb89e9f6958b83258afa3deed90b5de9ef68eef090ad5086c791cd2345610162" dependencies = [ "lexical-util", "static_assertions", @@ -2451,9 +2591,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.8" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" [[package]] name = "libmimalloc-sys" @@ -2467,9 +2607,9 @@ dependencies = [ [[package]] name = "libproc" -version = "0.14.8" +version = "0.14.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae9ea4b75e1a81675429dafe43441df1caea70081e82246a8cccf514884a88bb" +checksum = "e78a09b56be5adbcad5aa1197371688dc6bb249a26da3bca2011ee2fb987ebfb" dependencies = [ "bindgen", "errno", @@ -2514,9 +2654,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.19" +version = "1.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc53a7799a7496ebc9fd29f31f7df80e83c9bda5299768af5f9e59eeea74647" +checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" dependencies = [ "cc", "libc", @@ -2539,6 +2679,12 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "litemap" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704" + [[package]] name = "lock_api" version = "0.4.12" @@ -2549,6 +2695,12 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "lockfree-object-pool" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e" + [[package]] name = "log" version = "0.4.22" @@ -2557,11 +2709,11 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "lru" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" +checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" dependencies = [ - "hashbrown 0.14.5", + "hashbrown 0.15.1", ] [[package]] @@ -2575,9 +2727,9 @@ dependencies = [ [[package]] name = "lsp-server" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248f65b78f6db5d8e1b1604b4098a28b43d21a8eb1deeca22b1c421b276c7095" +checksum = "550446e84739dcaf6d48a4a093973850669e13e8a34d8f8d64851041be267cd9" dependencies = [ "crossbeam-channel", "log", @@ -2600,19 +2752,18 @@ dependencies = [ [[package]] name = "lz4" -version = "1.26.0" +version = "1.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "958b4caa893816eea05507c20cfe47574a43d9a697138a7872990bba8a0ece68" +checksum = "4d1febb2b4a79ddd1980eede06a8f7902197960aa0383ffcfdd62fe723036725" dependencies = [ - "libc", "lz4-sys", ] [[package]] name = "lz4-sys" -version = "1.10.0" +version = "1.11.1+lz4-1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109de74d5d2353660401699a4174a4ff23fcc649caf553df71933c7fb45ad868" +checksum = "6bd8c0d6c6ed0cd30b3652886bb8711dc4bb01d637a68105a3d5158039b418e6" dependencies = [ "cc", "libc", @@ -2709,13 +2860,13 @@ dependencies = [ "cfg-if", "miette-derive", "owo-colors", - "supports-color 3.0.0", + "supports-color 3.0.1", "supports-hyperlinks", "supports-unicode", - "terminal_size", + "terminal_size 0.3.0", "textwrap", - "thiserror", - "unicode-width", + "thiserror 1.0.69", + "unicode-width 0.1.11", ] [[package]] @@ -2760,15 +2911,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" -[[package]] -name = "miniz_oxide" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" -dependencies = [ - "adler", -] - [[package]] name = "miniz_oxide" version = "0.8.0" @@ -3135,7 +3277,7 @@ name = "nu-command" version = "0.100.1" dependencies = [ "alphanumeric-sort", - "base64 0.22.1", + "base64", "bracoxide", "brotli", "byteorder", @@ -3197,7 +3339,7 @@ dependencies = [ "pretty_assertions", "print-positions", "procfs", - "quick-xml 0.32.0", + "quick-xml 0.37.0", "quickcheck", "quickcheck_macros", "rand", @@ -3216,13 +3358,13 @@ dependencies = [ "sysinfo 0.32.0", "tabled", "tempfile", - "terminal_size", + "terminal_size 0.4.0", "titlecase", "toml 0.8.19", "trash", "umask", "unicode-segmentation", - "unicode-width", + "unicode-width 0.1.11", "ureq", "url", "uu_cp", @@ -3237,7 +3379,7 @@ dependencies = [ "v_htmlescape", "wax", "which", - "windows", + "windows 0.56.0", "winreg", ] @@ -3261,7 +3403,7 @@ dependencies = [ "nu-path", "nu-protocol", "nu-utils", - "terminal_size", + "terminal_size 0.4.0", ] [[package]] @@ -3285,8 +3427,8 @@ dependencies = [ "nu-utils", "ratatui", "strip-ansi-escapes", - "terminal_size", - "unicode-width", + "terminal_size 0.4.0", + "unicode-width 0.1.11", ] [[package]] @@ -3368,7 +3510,7 @@ dependencies = [ "nu-protocol", "nu-utils", "serde", - "thiserror", + "thiserror 2.0.3", "typetag", ] @@ -3383,7 +3525,7 @@ dependencies = [ "rmp-serde", "serde", "serde_json", - "windows", + "windows 0.56.0", ] [[package]] @@ -3399,7 +3541,7 @@ dependencies = [ "nu-utils", "serde", "typetag", - "windows", + "windows 0.56.0", ] [[package]] @@ -3474,7 +3616,7 @@ dependencies = [ "strum", "strum_macros", "tempfile", - "thiserror", + "thiserror 2.0.3", "typetag", "windows-sys 0.48.0", ] @@ -3504,7 +3646,7 @@ dependencies = [ "ntapi", "procfs", "sysinfo 0.32.0", - "windows", + "windows 0.56.0", ] [[package]] @@ -3518,7 +3660,7 @@ dependencies = [ "nu-protocol", "nu-utils", "tabled", - "terminal_size", + "terminal_size 0.4.0", ] [[package]] @@ -3526,7 +3668,7 @@ name = "nu-term-grid" version = "0.100.1" dependencies = [ "nu-utils", - "unicode-width", + "unicode-width 0.1.11", ] [[package]] @@ -3887,9 +4029,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.3" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] @@ -3914,18 +4056,15 @@ checksum = "80adb31078122c880307e9cdfd4e3361e6545c319f9b9dcafcb03acd3b51a575" [[package]] name = "once_cell" -version = "1.20.1" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" -dependencies = [ - "portable-atomic", -] +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "open" -version = "5.3.0" +version = "5.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a877bf6abd716642a53ef1b89fb498923a4afca5c754f9050b4d081c05c4b3" +checksum = "3ecd52f0b8d15c40ce4820aa251ed5de032e5d91fab27f7db2f40d42a8bdf69c" dependencies = [ "is-wsl", "libc", @@ -3934,9 +4073,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.66" +version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" dependencies = [ "bitflags 2.6.0", "cfg-if", @@ -3966,18 +4105,18 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.3.1+3.3.1" +version = "300.4.0+3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7259953d42a81bf137fbbd73bd30a8e1914d6dce43c2b90ed575783a22608b91" +checksum = "a709e02f2b4aca747929cca5ed248880847c650233cf8b8cdc48f40aaf4898a6" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.103" +version = "0.9.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ "cc", "libc", @@ -4008,7 +4147,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a6229bad892b46b0dcfaaeb18ad0d2e56400f5aaea05b768bde96e73676cf75" dependencies = [ - "unicode-width", + "unicode-width 0.1.11", ] [[package]] @@ -4023,9 +4162,9 @@ dependencies = [ [[package]] name = "owo-colors" -version = "4.0.0" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caff54706df99d2a78a5a4e3455ff45448d81ef1bb63c22cd14052ca0e993a3f" +checksum = "fb37767f6569cd834a413442455e0f066d0d522de8630436e2a1761d9726ba56" [[package]] name = "papergrid" @@ -4037,7 +4176,7 @@ dependencies = [ "ansitok", "bytecount", "fnv", - "unicode-width", + "unicode-width 0.1.11", ] [[package]] @@ -4101,9 +4240,9 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pathdiff" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +checksum = "d61c5ce1153ab5b689d0c074c4e7fc613e942dfb7dd9eea5ab202d2ad91fe361" [[package]] name = "percent-encoding" @@ -4119,20 +4258,20 @@ checksum = "f658886ed52e196e850cfbbfddab9eaa7f6d90dd0929e264c31e5cec07e09e57" [[package]] name = "pest" -version = "2.7.11" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd53dff83f26735fdc1ca837098ccf133605d794cdae66acfc2bfac3ec809d95" +checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" dependencies = [ "memchr", - "thiserror", + "thiserror 1.0.69", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.7.11" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a548d2beca6773b1c244554d36fcf8548a8a58e74156968211567250e48e49a" +checksum = "d214365f632b123a47fd913301e14c946c61d1c183ee245fa76eb752e59a02dd" dependencies = [ "pest", "pest_generator", @@ -4140,9 +4279,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.11" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c93a82e8d145725dcbaf44e5ea887c8a869efdcc28706df2d08c69e17077183" +checksum = "eb55586734301717aea2ac313f50b2eb8f60d2fc3dc01d190eefa2e625f60c4e" dependencies = [ "pest", "pest_meta", @@ -4153,9 +4292,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.7.11" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a941429fea7e08bedec25e4f6785b6ffaacc6b755da98df5ef3e7dcf4a124c4f" +checksum = "b75da2a70cf4d9cb76833c990ac9cd3923c9a8905a8929789ce347c84564d03d" dependencies = [ "once_cell", "pest", @@ -4245,9 +4384,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -4257,9 +4396,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "plain" @@ -4278,9 +4417,9 @@ dependencies = [ [[package]] name = "platform-info" -version = "2.0.3" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5ff316b9c4642feda973c18f0decd6c8b0919d4722566f6e4337cce0dd88217" +checksum = "91077ffd05d058d70d79eefcd7d7f6aac34980860a7519960f7913b6563a8c3a" dependencies = [ "libc", "winapi", @@ -4292,7 +4431,7 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42cf17e9a1800f5f396bc67d193dc9411b59012a5876445ef450d449881e1016" dependencies = [ - "base64 0.22.1", + "base64", "indexmap", "quick-xml 0.32.0", "serde", @@ -4413,7 +4552,7 @@ dependencies = [ "regex", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", "version_check", "xxhash-rust", ] @@ -4428,7 +4567,7 @@ dependencies = [ "polars-arrow-format", "regex", "simdutf8", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -4567,7 +4706,7 @@ checksum = "5ac14a136d87bea798f3db51d5987556deb2293da34bfc8b105ebffa05f6e810" dependencies = [ "ahash 0.8.11", "argminmax", - "base64 0.22.1", + "base64", "bytemuck", "chrono", "chrono-tz 0.8.6", @@ -4603,7 +4742,7 @@ checksum = "491f5af321169259d5b1294c9fe8ed89faaeac34b4dec4abcedc0d1b3d11013a" dependencies = [ "ahash 0.8.11", "async-stream", - "base64 0.22.1", + "base64", "brotli", "bytemuck", "ethnum", @@ -4787,9 +4926,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.7.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" +checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" [[package]] name = "powerfmt" @@ -4841,9 +4980,9 @@ dependencies = [ [[package]] name = "pretty_assertions" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" +checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d" dependencies = [ "diff", "yansi", @@ -4860,11 +4999,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ - "toml_edit 0.21.1", + "toml_edit 0.22.22", ] [[package]] @@ -4892,9 +5031,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" dependencies = [ "unicode-ident", ] @@ -4927,9 +5066,9 @@ dependencies = [ [[package]] name = "psm" -version = "0.1.21" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +checksum = "200b9ff220857e53e184257720a14553b2f4aa02577d2ed9842d45d4b9654810" dependencies = [ "cc", ] @@ -4967,7 +5106,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72c71c0c79b9701efe4e1e4b563b2016dd4ee789eb99badcb09d61ac4b92e4a2" dependencies = [ "libc", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5003,9 +5142,18 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.34.0" +version = "0.36.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f24d770aeca0eacb81ac29dfbc55ebcc09312fdd1f8bbecdc7e4a84e000e3b4" +checksum = "f7649a7b4df05aed9ea7ec6f628c67c9953a43869b8bc50929569b2999d443fe" +dependencies = [ + "memchr", +] + +[[package]] +name = "quick-xml" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbfb3ddf5364c9cfcd65549a1e7b801d0e8d1b14c1a1590a6408aa93cfbfa84" dependencies = [ "memchr", ] @@ -5110,14 +5258,14 @@ dependencies = [ "strum", "unicode-segmentation", "unicode-truncate", - "unicode-width", + "unicode-width 0.1.11", ] [[package]] name = "raw-cpuid" -version = "11.1.0" +version = "11.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb9ee317cfe3fbd54b36a511efc1edd42e216903c9cd575e686dd68a2ba90d8d" +checksum = "1ab240315c661615f2ee9f0f2cd32d5a7343a84d5ebcccb99d46e6637565e7b0" dependencies = [ "bitflags 2.6.0", ] @@ -5170,9 +5318,9 @@ checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175" [[package]] name = "redox_syscall" -version = "0.5.3" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags 2.6.0", ] @@ -5185,7 +5333,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", "libredox", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -5206,9 +5354,9 @@ dependencies = [ "strip-ansi-escapes", "strum", "strum_macros", - "thiserror", + "thiserror 1.0.69", "unicode-segmentation", - "unicode-width", + "unicode-width 0.1.11", ] [[package]] @@ -5233,9 +5381,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.6" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -5245,9 +5393,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -5256,9 +5404,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "relative-path" @@ -5277,16 +5425,16 @@ dependencies = [ [[package]] name = "rfc2047-decoder" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e90a668c463c412c3118ae1883e18b53d812c349f5af7a06de3ba4bb0c17cc73" +checksum = "bc36545d1021456a751b573517cb52e8c339b2f662e6b2778ef629282678de29" dependencies = [ - "base64 0.21.7", + "base64", "charset", "chumsky", "memchr", "quoted_printable", - "thiserror", + "thiserror 2.0.3", ] [[package]] @@ -5501,9 +5649,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "ryu" @@ -5522,20 +5670,20 @@ dependencies = [ [[package]] name = "scc" -version = "2.1.16" +version = "2.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeb7ac86243095b70a7920639507b71d51a63390d1ba26c4f60a552fbb914a37" +checksum = "66b202022bb57c049555430e11fc22fea12909276a80a4c3d368da36ac1d88ed" dependencies = [ "sdd", ] [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -5587,9 +5735,9 @@ dependencies = [ [[package]] name = "sdd" -version = "3.0.2" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0495e4577c672de8254beb68d01a9b62d0e8a13c099edecdbedccce3223cd29f" +checksum = "49c1eeaf4b6a87c7479688c6d52b9f1153cedd3c489300564f932b065c6eab95" [[package]] name = "seahash" @@ -5612,9 +5760,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.1" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" +checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" dependencies = [ "core-foundation-sys", "libc", @@ -5647,18 +5795,18 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.208" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.208" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", @@ -5667,9 +5815,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.127" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ "indexmap", "itoa", @@ -5691,9 +5839,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -5770,9 +5918,9 @@ dependencies = [ [[package]] name = "shadow-rs" -version = "0.35.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fca0e9bdc073d7173ba993fb7886477af5df75588b57afcb4b96f21911ab0bfa" +checksum = "58cfcd0643497a9f780502063aecbcc4a3212cbe4948fd25ee8fd179c2cf9a18" dependencies = [ "const_format", "is_debug", @@ -5823,10 +5971,16 @@ dependencies = [ ] [[package]] -name = "simd-json" -version = "0.13.10" +name = "simd-adler32" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "570c430b3d902ea083097e853263ae782dfe40857d93db019a12356c8e8143fa" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + +[[package]] +name = "simd-json" +version = "0.13.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0228a564470f81724e30996bbc2b171713b37b15254a6440c7e2d5449b95691" dependencies = [ "ahash 0.8.11", "getrandom", @@ -5842,9 +5996,9 @@ dependencies = [ [[package]] name = "simdutf8" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "similar" @@ -5933,15 +6087,15 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "stacker" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a5daa25ea337c85ed954c0496e3bdd2c7308cc3b24cf7b50d04876654c579f" +checksum = "799c883d55abdb5e98af1a7b3f23b9b6de8ecada0ecac058672d7635eb48ca7b" dependencies = [ "cc", "cfg-if", "libc", "psm", - "windows-sys 0.36.1", + "windows-sys 0.59.0", ] [[package]] @@ -5952,9 +6106,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "str_indices" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9557cb6521e8d009c51a8666f09356f4b817ba9ba0981a305bd86aee47bd35c" +checksum = "d08889ec5408683408db66ad89e0e1f93dff55c73a4ccc71c427d5b277ee47e6" [[package]] name = "streaming-decompression" @@ -6052,9 +6206,9 @@ dependencies = [ [[package]] name = "supports-color" -version = "3.0.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9829b314621dfc575df4e409e79f9d6a66a3bd707ab73f23cb4aa3a854ac854f" +checksum = "8775305acf21c96926c900ad056abeef436701108518cf890020387236ac5a77" dependencies = [ "is_ci", ] @@ -6115,12 +6269,11 @@ dependencies = [ ] [[package]] -name = "syn_derive" -version = "0.1.8" +name = "synstructure" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ - "proc-macro-error", "proc-macro2", "quote", "syn 2.0.87", @@ -6128,9 +6281,9 @@ dependencies = [ [[package]] name = "sys-locale" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e801cf239ecd6ccd71f03d270d67dd53d13e90aab208bf4b8fe4ad957ea949b0" +checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4" dependencies = [ "libc", ] @@ -6145,7 +6298,7 @@ dependencies = [ "libc", "memchr", "ntapi", - "windows", + "windows 0.57.0", ] [[package]] @@ -6159,7 +6312,7 @@ dependencies = [ "memchr", "ntapi", "rayon", - "windows", + "windows 0.57.0", ] [[package]] @@ -6191,7 +6344,7 @@ dependencies = [ "rand", "scroll", "tempfile", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -6249,6 +6402,16 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "terminal_size" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f599bd7ca042cfdf8f4512b277c02ba102247820f9d9d4a9f521f496751a6ef" +dependencies = [ + "rustix", + "windows-sys 0.59.0", +] + [[package]] name = "termtree" version = "0.4.1" @@ -6263,23 +6426,43 @@ checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" dependencies = [ "smawk", "unicode-linebreak", - "unicode-width", + "unicode-width 0.1.11", ] [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +dependencies = [ + "thiserror-impl 2.0.3", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" dependencies = [ "proc-macro2", "quote", @@ -6338,6 +6521,16 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinyvec" version = "1.8.0" @@ -6366,9 +6559,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.39.3" +version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" dependencies = [ "backtrace", "bytes", @@ -6382,9 +6575,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", @@ -6415,7 +6608,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.20", + "toml_edit 0.22.22", ] [[package]] @@ -6442,26 +6635,15 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.21.1" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" -dependencies = [ - "indexmap", - "toml_datetime", - "winnow 0.5.40", -] - -[[package]] -name = "toml_edit" -version = "0.22.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.18", + "winnow 0.6.20", ] [[package]] @@ -6497,17 +6679,16 @@ dependencies = [ "once_cell", "scopeguard", "urlencoding", - "windows", + "windows 0.56.0", ] [[package]] name = "tree_magic_mini" -version = "3.1.5" +version = "3.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469a727cac55b41448315cc10427c069c618ac59bb6a4480283fcd811749bdc2" +checksum = "aac5e8971f245c3389a5a76e648bfc80803ae066a1243a75db0064d7c1129d63" dependencies = [ "fnv", - "home", "memchr", "nom", "once_cell", @@ -6564,9 +6745,9 @@ dependencies = [ [[package]] name = "ucd-trie" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] name = "umask" @@ -6574,7 +6755,7 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec9a46c2549e35c054e0ffe281a3a6ec0007793db4df106604d37ed3f4d73d1c" dependencies = [ - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -6583,12 +6764,6 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - [[package]] name = "unicode-ident" version = "1.0.13" @@ -6601,15 +6776,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" -[[package]] -name = "unicode-normalization" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" -dependencies = [ - "tinyvec", -] - [[package]] name = "unicode-reverse" version = "1.0.9" @@ -6633,7 +6799,7 @@ checksum = "b3644627a5af5fa321c95b9b235a72fd24cd29c648c2c379431e6628655627bf" dependencies = [ "itertools 0.13.0", "unicode-segmentation", - "unicode-width", + "unicode-width 0.1.11", ] [[package]] @@ -6643,10 +6809,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] -name = "unicode-xid" -version = "0.2.5" +name = "unicode-width" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "unsafe-libyaml" @@ -6660,7 +6832,7 @@ version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a" dependencies = [ - "base64 0.22.1", + "base64", "encoding_rs", "flate2", "log", @@ -6673,9 +6845,9 @@ dependencies = [ [[package]] name = "url" -version = "2.5.2" +version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada" dependencies = [ "form_urlencoded", "idna", @@ -6695,12 +6867,24 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + [[package]] name = "utf8-width" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86bd8d4e895da8537e5315b8254664e6b769c4ff3db18321b297a1e7004392e3" +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" version = "0.2.2" @@ -6931,9 +7115,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -6942,9 +7126,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", @@ -6957,9 +7141,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -6967,9 +7151,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", @@ -6980,9 +7164,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "wax" @@ -6995,15 +7179,15 @@ dependencies = [ "nom", "pori", "regex", - "thiserror", + "thiserror 1.0.69", "walkdir", ] [[package]] name = "wayland-backend" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90e11ce2ca99c97b940ee83edbae9da2d56a08f9ea8158550fd77fa31722993" +checksum = "056535ced7a150d45159d3a8dc30f91a2e2d588ca0b23f70e56033622b8016f6" dependencies = [ "cc", "downcast-rs", @@ -7015,9 +7199,9 @@ dependencies = [ [[package]] name = "wayland-client" -version = "0.31.5" +version = "0.31.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e321577a0a165911bdcfb39cf029302479d7527b517ee58ab0f6ad09edf0943" +checksum = "b66249d3fc69f76fd74c82cc319300faa554e9d865dab1f7cd66cc20db10b280" dependencies = [ "bitflags 2.6.0", "rustix", @@ -7052,26 +7236,36 @@ dependencies = [ [[package]] name = "wayland-scanner" -version = "0.31.4" +version = "0.31.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7b56f89937f1cf2ee1f1259cf2936a17a1f45d8f0aa1019fae6d470d304cfa6" +checksum = "597f2001b2e5fc1121e3d5b9791d3e78f05ba6bfa4641053846248e3a13661c3" dependencies = [ "proc-macro2", - "quick-xml 0.34.0", + "quick-xml 0.36.2", "quote", ] [[package]] name = "wayland-sys" -version = "0.31.4" +version = "0.31.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43676fe2daf68754ecf1d72026e4e6c15483198b5d24e888b74d3f22f887a148" +checksum = "efa8ac0d8e8ed3e3b5c9fc92c7881406a268e11555abe36493efabe649a29e09" dependencies = [ "dlib", "log", "pkg-config", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "webpage" version = "2.0.1" @@ -7154,6 +7348,16 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143" +dependencies = [ + "windows-core 0.57.0", + "windows-targets 0.52.6", +] + [[package]] name = "windows-core" version = "0.52.0" @@ -7169,8 +7373,20 @@ version = "0.56.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4698e52ed2d08f8658ab0c39512a7c00ee5fe2688c65f8c0a4f06750d729f2a6" dependencies = [ - "windows-implement", - "windows-interface", + "windows-implement 0.56.0", + "windows-interface 0.56.0", + "windows-result", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-core" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" +dependencies = [ + "windows-implement 0.57.0", + "windows-interface 0.57.0", "windows-result", "windows-targets 0.52.6", ] @@ -7186,6 +7402,17 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "windows-implement" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "windows-interface" version = "0.56.0" @@ -7197,6 +7424,17 @@ dependencies = [ "syn 2.0.87", ] +[[package]] +name = "windows-interface" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + [[package]] name = "windows-result" version = "0.1.2" @@ -7206,19 +7444,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[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.48.0" @@ -7289,12 +7514,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" -[[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.48.5" @@ -7307,12 +7526,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" -[[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.48.5" @@ -7331,12 +7544,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" -[[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.48.5" @@ -7349,12 +7556,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" -[[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.48.5" @@ -7379,12 +7580,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" -[[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.48.5" @@ -7408,9 +7603,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] @@ -7453,7 +7648,7 @@ dependencies = [ "nix 0.28.0", "os_pipe", "tempfile", - "thiserror", + "thiserror 1.0.69", "tree_magic_mini", "wayland-backend", "wayland-client", @@ -7461,6 +7656,18 @@ dependencies = [ "wayland-protocols-wlr", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "wyz" version = "0.5.1" @@ -7517,9 +7724,33 @@ checksum = "6a5cbf750400958819fb6178eaa83bee5cd9c29a26a40cc241df8c70fdd46984" [[package]] name = "yansi" -version = "0.5.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" + +[[package]] +name = "yoke" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", + "synstructure", +] [[package]] name = "zerocopy" @@ -7543,15 +7774,77 @@ dependencies = [ ] [[package]] -name = "zip" -version = "0.6.6" +name = "zerofrom" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55" dependencies = [ - "byteorder", + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", + "synstructure", +] + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.87", +] + +[[package]] +name = "zip" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc5e4288ea4057ae23afc69a4472434a87a2495cafce6632fd1c4ec9f5cf3494" +dependencies = [ + "arbitrary", "crc32fast", "crossbeam-utils", + "displaydoc", "flate2", + "indexmap", + "memchr", + "thiserror 1.0.69", + "zopfli", +] + +[[package]] +name = "zopfli" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5019f391bac5cf252e93bbcc53d039ffd62c7bfb7c150414d61369afe57e946" +dependencies = [ + "bumpalo", + "crc32fast", + "lockfree-object-pool", + "log", + "once_cell", + "simd-adler32", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 0b796573c8..cf836ea6e4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -71,7 +71,7 @@ brotli = "6.0" byteorder = "1.5" bytes = "1" bytesize = "1.3" -calamine = "0.24.0" +calamine = "0.26.1" chardetng = "0.1.17" chrono = { default-features = false, version = "0.4.34" } chrono-humanize = "0.2.3" @@ -129,7 +129,7 @@ proc-macro-error = { version = "1.0", default-features = false } proc-macro2 = "1.0" procfs = "0.16.0" pwd = "1.3" -quick-xml = "0.32.0" +quick-xml = "0.37.0" quickcheck = "1.0" quickcheck_macros = "1.0" quote = "1.0" @@ -156,7 +156,7 @@ syn = "2.0" sysinfo = "0.32" tabled = { version = "0.16.0", default-features = false } tempfile = "3.14" -terminal_size = "0.3" +terminal_size = "0.4" titlecase = "2.0" toml = "0.8" trash = "5.2" diff --git a/crates/nu-cli/src/eval_cmds.rs b/crates/nu-cli/src/eval_cmds.rs index f0bebfc884..5fba00f5c9 100644 --- a/crates/nu-cli/src/eval_cmds.rs +++ b/crates/nu-cli/src/eval_cmds.rs @@ -9,6 +9,8 @@ use nu_protocol::{ }; use std::sync::Arc; +use crate::util::print_pipeline; + #[derive(Default)] pub struct EvaluateCommandsOpts { pub table_mode: Option, @@ -72,7 +74,7 @@ pub fn evaluate_commands( if let Some(err) = working_set.compile_errors.first() { report_compile_error(&working_set, err); - // Not a fatal error, for now + std::process::exit(1); } (output, working_set.render()) @@ -93,7 +95,7 @@ pub fn evaluate_commands( t_mode.coerce_str()?.parse().unwrap_or_default(); } - pipeline.print(engine_state, stack, no_newline, false)?; + print_pipeline(engine_state, stack, pipeline, no_newline)?; info!("evaluate {}:{}:{}", file!(), line!(), column!()); diff --git a/crates/nu-cli/src/eval_file.rs b/crates/nu-cli/src/eval_file.rs index df75f7e4f8..826b6c8eb5 100644 --- a/crates/nu-cli/src/eval_file.rs +++ b/crates/nu-cli/src/eval_file.rs @@ -1,4 +1,4 @@ -use crate::util::eval_source; +use crate::util::{eval_source, print_pipeline}; use log::{info, trace}; use nu_engine::{convert_env_values, eval_block}; use nu_parser::parse; @@ -89,7 +89,7 @@ pub fn evaluate_file( if let Some(err) = working_set.compile_errors.first() { report_compile_error(&working_set, err); - // Not a fatal error, for now + std::process::exit(1); } // Look for blocks whose name starts with "main" and replace it with the filename. @@ -119,7 +119,7 @@ pub fn evaluate_file( }; // Print the pipeline output of the last command of the file. - pipeline.print(engine_state, stack, true, false)?; + print_pipeline(engine_state, stack, pipeline, true)?; // Invoke the main command with arguments. // Arguments with whitespaces are quoted, thus can be safely concatenated by whitespace. diff --git a/crates/nu-cli/src/print.rs b/crates/nu-cli/src/print.rs index ffb0366242..40660ecf13 100644 --- a/crates/nu-cli/src/print.rs +++ b/crates/nu-cli/src/print.rs @@ -65,8 +65,12 @@ Since this command has no output, there is no point in piping it with other comm arg.into_pipeline_data() .print_raw(engine_state, no_newline, to_stderr)?; } else { - arg.into_pipeline_data() - .print(engine_state, stack, no_newline, to_stderr)?; + arg.into_pipeline_data().print_table( + engine_state, + stack, + no_newline, + to_stderr, + )?; } } } else if !input.is_nothing() { @@ -78,7 +82,7 @@ Since this command has no output, there is no point in piping it with other comm if raw { input.print_raw(engine_state, no_newline, to_stderr)?; } else { - input.print(engine_state, stack, no_newline, to_stderr)?; + input.print_table(engine_state, stack, no_newline, to_stderr)?; } } diff --git a/crates/nu-cli/src/util.rs b/crates/nu-cli/src/util.rs index 67bc1ad8ef..7b9d783534 100644 --- a/crates/nu-cli/src/util.rs +++ b/crates/nu-cli/src/util.rs @@ -201,6 +201,35 @@ fn gather_env_vars( } } +/// Print a pipeline with formatting applied based on display_output hook. +/// +/// This function should be preferred when printing values resulting from a completed evaluation. +/// For values printed as part of a command's execution, such as values printed by the `print` command, +/// the `PipelineData::print_table` function should be preferred instead as it is not config-dependent. +/// +/// `no_newline` controls if we need to attach newline character to output. +pub fn print_pipeline( + engine_state: &mut EngineState, + stack: &mut Stack, + pipeline: PipelineData, + no_newline: bool, +) -> Result<(), ShellError> { + if let Some(hook) = engine_state.get_config().hooks.display_output.clone() { + let pipeline = eval_hook( + engine_state, + stack, + Some(pipeline), + vec![], + &hook, + "display_output", + )?; + pipeline.print_raw(engine_state, no_newline, false) + } else { + // if display_output isn't set, we should still prefer to print with some formatting + pipeline.print_table(engine_state, stack, no_newline, false) + } +} + pub fn eval_source( engine_state: &mut EngineState, stack: &mut Stack, @@ -267,7 +296,7 @@ fn evaluate_source( if let Some(err) = working_set.compile_errors.first() { report_compile_error(&working_set, err); - // Not a fatal error, for now + return Ok(true); } (output, working_set.render()) @@ -281,36 +310,12 @@ fn evaluate_source( eval_block::(engine_state, stack, &block, input) }?; - if let PipelineData::ByteStream(..) = pipeline { - // run the display hook on bytestreams too - run_display_hook(engine_state, stack, pipeline, false) - } else { - run_display_hook(engine_state, stack, pipeline, true) - }?; + let no_newline = matches!(&pipeline, &PipelineData::ByteStream(..)); + print_pipeline(engine_state, stack, pipeline, no_newline)?; Ok(false) } -fn run_display_hook( - engine_state: &mut EngineState, - stack: &mut Stack, - pipeline: PipelineData, - no_newline: bool, -) -> Result<(), ShellError> { - if let Some(hook) = engine_state.get_config().hooks.display_output.clone() { - let pipeline = eval_hook( - engine_state, - stack, - Some(pipeline), - vec![], - &hook, - "display_output", - )?; - pipeline.print(engine_state, stack, no_newline, false) - } else { - pipeline.print(engine_state, stack, no_newline, false) - } -} #[cfg(test)] mod test { use super::*; diff --git a/crates/nu-cmd-lang/Cargo.toml b/crates/nu-cmd-lang/Cargo.toml index c5609e4ff8..6e8cb824ba 100644 --- a/crates/nu-cmd-lang/Cargo.toml +++ b/crates/nu-cmd-lang/Cargo.toml @@ -21,10 +21,10 @@ nu-protocol = { path = "../nu-protocol", version = "0.100.1" } nu-utils = { path = "../nu-utils", version = "0.100.1" } itertools = { workspace = true } -shadow-rs = { version = "0.35", default-features = false } +shadow-rs = { version = "0.36", default-features = false } [build-dependencies] -shadow-rs = { version = "0.35", default-features = false } +shadow-rs = { version = "0.36", default-features = false } [features] mimalloc = [] diff --git a/crates/nu-command/src/debug/ast.rs b/crates/nu-command/src/debug/ast.rs index c6e405d533..45e7738c32 100644 --- a/crates/nu-command/src/debug/ast.rs +++ b/crates/nu-command/src/debug/ast.rs @@ -1,6 +1,7 @@ use nu_engine::command_prelude::*; -use nu_parser::parse; -use nu_protocol::engine::StateWorkingSet; +use nu_parser::{flatten_block, parse}; +use nu_protocol::{engine::StateWorkingSet, record}; +use serde_json::{json, Value as JsonValue}; #[derive(Clone)] pub struct Ast; @@ -16,109 +17,23 @@ impl Command for Ast { fn signature(&self) -> Signature { Signature::build("ast") - .input_output_types(vec![(Type::String, Type::record())]) + .input_output_types(vec![ + (Type::Nothing, Type::table()), + (Type::Nothing, Type::record()), + (Type::Nothing, Type::String), + ]) .required( "pipeline", SyntaxShape::String, "The pipeline to print the ast for.", ) - .switch("json", "serialize to json", Some('j')) - .switch("minify", "minify the nuon or json output", Some('m')) + .switch("json", "Serialize to json", Some('j')) + .switch("minify", "Minify the nuon or json output", Some('m')) + .switch("flatten", "An easier to read version of the ast", Some('f')) .allow_variants_without_examples(true) .category(Category::Debug) } - fn run( - &self, - engine_state: &EngineState, - stack: &mut Stack, - call: &Call, - _input: PipelineData, - ) -> Result { - let pipeline: Spanned = call.req(engine_state, stack, 0)?; - let to_json = call.has_flag(engine_state, stack, "json")?; - let minify = call.has_flag(engine_state, stack, "minify")?; - let mut working_set = StateWorkingSet::new(engine_state); - let block_output = parse(&mut working_set, None, pipeline.item.as_bytes(), false); - let error_output = working_set.parse_errors.first(); - let block_span = match &block_output.span { - Some(span) => span, - None => &pipeline.span, - }; - if to_json { - // Get the block as json - let serde_block_str = if minify { - serde_json::to_string(&*block_output) - } else { - serde_json::to_string_pretty(&*block_output) - }; - let block_json = match serde_block_str { - Ok(json) => json, - Err(e) => Err(ShellError::CantConvert { - to_type: "string".to_string(), - from_type: "block".to_string(), - span: *block_span, - help: Some(format!( - "Error: {e}\nCan't convert {block_output:?} to string" - )), - })?, - }; - // Get the error as json - let serde_error_str = if minify { - serde_json::to_string(&error_output) - } else { - serde_json::to_string_pretty(&error_output) - }; - - let error_json = match serde_error_str { - Ok(json) => json, - Err(e) => Err(ShellError::CantConvert { - to_type: "string".to_string(), - from_type: "error".to_string(), - span: *block_span, - help: Some(format!( - "Error: {e}\nCan't convert {error_output:?} to string" - )), - })?, - }; - - // Create a new output record, merging the block and error - let output_record = Value::record( - record! { - "block" => Value::string(block_json, *block_span), - "error" => Value::string(error_json, Span::test_data()), - }, - pipeline.span, - ); - Ok(output_record.into_pipeline_data()) - } else { - let block_value = Value::string( - if minify { - format!("{block_output:?}") - } else { - format!("{block_output:#?}") - }, - pipeline.span, - ); - let error_value = Value::string( - if minify { - format!("{error_output:?}") - } else { - format!("{error_output:#?}") - }, - pipeline.span, - ); - let output_record = Value::record( - record! { - "block" => block_value, - "error" => error_value - }, - pipeline.span, - ); - Ok(output_record.into_pipeline_data()) - } - } - fn examples(&self) -> Vec { vec![ Example { @@ -147,8 +62,247 @@ impl Command for Ast { example: "ast 'for x in 1..10 { echo $x ' --json --minify", result: None, }, + Example { + description: "Print the ast of a string flattened", + example: r#"ast "'hello'" --flatten"#, + result: Some(Value::test_list(vec![Value::test_record(record! { + "content" => Value::test_string("'hello'"), + "shape" => Value::test_string("shape_string"), + "span" => Value::test_record(record! { + "start" => Value::test_int(0), + "end" => Value::test_int(7),}), + })])), + }, + Example { + description: "Print the ast of a string flattened, as json, minified", + example: r#"ast "'hello'" --flatten --json --minify"#, + result: Some(Value::test_string( + r#"[{"content":"'hello'","shape":"shape_string","span":{"start":0,"end":7}}]"#, + )), + }, + Example { + description: "Print the ast of a pipeline flattened", + example: r#"ast 'ls | sort-by type name -i' --flatten"#, + result: Some(Value::test_list(vec![ + Value::test_record(record! { + "content" => Value::test_string("ls"), + "shape" => Value::test_string("shape_external"), + "span" => Value::test_record(record! { + "start" => Value::test_int(0), + "end" => Value::test_int(2),}), + }), + Value::test_record(record! { + "content" => Value::test_string("|"), + "shape" => Value::test_string("shape_pipe"), + "span" => Value::test_record(record! { + "start" => Value::test_int(3), + "end" => Value::test_int(4),}), + }), + Value::test_record(record! { + "content" => Value::test_string("sort-by"), + "shape" => Value::test_string("shape_internalcall"), + "span" => Value::test_record(record! { + "start" => Value::test_int(5), + "end" => Value::test_int(12),}), + }), + Value::test_record(record! { + "content" => Value::test_string("type"), + "shape" => Value::test_string("shape_string"), + "span" => Value::test_record(record! { + "start" => Value::test_int(13), + "end" => Value::test_int(17),}), + }), + Value::test_record(record! { + "content" => Value::test_string("name"), + "shape" => Value::test_string("shape_string"), + "span" => Value::test_record(record! { + "start" => Value::test_int(18), + "end" => Value::test_int(22),}), + }), + Value::test_record(record! { + "content" => Value::test_string("-i"), + "shape" => Value::test_string("shape_flag"), + "span" => Value::test_record(record! { + "start" => Value::test_int(23), + "end" => Value::test_int(25),}), + }), + ])), + }, ] } + + fn run( + &self, + engine_state: &EngineState, + stack: &mut Stack, + call: &Call, + _input: PipelineData, + ) -> Result { + let pipeline: Spanned = call.req(engine_state, stack, 0)?; + let to_json = call.has_flag(engine_state, stack, "json")?; + let minify = call.has_flag(engine_state, stack, "minify")?; + let flatten = call.has_flag(engine_state, stack, "flatten")?; + + let mut working_set = StateWorkingSet::new(engine_state); + let offset = working_set.next_span_start(); + let parsed_block = parse(&mut working_set, None, pipeline.item.as_bytes(), false); + + if flatten { + let flat = flatten_block(&working_set, &parsed_block); + if to_json { + let mut json_val: JsonValue = json!([]); + for (span, shape) in flat { + let content = + String::from_utf8_lossy(working_set.get_span_contents(span)).to_string(); + + let json = json!( + { + "content": content, + "shape": shape.to_string(), + "span": { + "start": span.start.checked_sub(offset), + "end": span.end.checked_sub(offset), + }, + } + ); + json_merge(&mut json_val, &json); + } + let json_string = if minify { + if let Ok(json_str) = serde_json::to_string(&json_val) { + json_str + } else { + "{}".to_string() + } + } else if let Ok(json_str) = serde_json::to_string_pretty(&json_val) { + json_str + } else { + "{}".to_string() + }; + + Ok(Value::string(json_string, pipeline.span).into_pipeline_data()) + } else { + // let mut rec: Record = Record::new(); + let mut rec = vec![]; + for (span, shape) in flat { + let content = + String::from_utf8_lossy(working_set.get_span_contents(span)).to_string(); + let each_rec = record! { + "content" => Value::test_string(content), + "shape" => Value::test_string(shape.to_string()), + "span" => Value::test_record(record!{ + "start" => Value::test_int(match span.start.checked_sub(offset) { + Some(start) => start as i64, + None => 0 + }), + "end" => Value::test_int(match span.end.checked_sub(offset) { + Some(end) => end as i64, + None => 0 + }), + }), + }; + rec.push(Value::test_record(each_rec)); + } + Ok(Value::list(rec, pipeline.span).into_pipeline_data()) + } + } else { + let error_output = working_set.parse_errors.first(); + let block_span = match &parsed_block.span { + Some(span) => span, + None => &pipeline.span, + }; + if to_json { + // Get the block as json + let serde_block_str = if minify { + serde_json::to_string(&*parsed_block) + } else { + serde_json::to_string_pretty(&*parsed_block) + }; + let block_json = match serde_block_str { + Ok(json) => json, + Err(e) => Err(ShellError::CantConvert { + to_type: "string".to_string(), + from_type: "block".to_string(), + span: *block_span, + help: Some(format!( + "Error: {e}\nCan't convert {parsed_block:?} to string" + )), + })?, + }; + // Get the error as json + let serde_error_str = if minify { + serde_json::to_string(&error_output) + } else { + serde_json::to_string_pretty(&error_output) + }; + + let error_json = match serde_error_str { + Ok(json) => json, + Err(e) => Err(ShellError::CantConvert { + to_type: "string".to_string(), + from_type: "error".to_string(), + span: *block_span, + help: Some(format!( + "Error: {e}\nCan't convert {error_output:?} to string" + )), + })?, + }; + + // Create a new output record, merging the block and error + let output_record = Value::record( + record! { + "block" => Value::string(block_json, *block_span), + "error" => Value::string(error_json, Span::test_data()), + }, + pipeline.span, + ); + Ok(output_record.into_pipeline_data()) + } else { + let block_value = Value::string( + if minify { + format!("{parsed_block:?}") + } else { + format!("{parsed_block:#?}") + }, + pipeline.span, + ); + let error_value = Value::string( + if minify { + format!("{error_output:?}") + } else { + format!("{error_output:#?}") + }, + pipeline.span, + ); + let output_record = Value::record( + record! { + "block" => block_value, + "error" => error_value + }, + pipeline.span, + ); + Ok(output_record.into_pipeline_data()) + } + } + } +} + +fn json_merge(a: &mut JsonValue, b: &JsonValue) { + match (a, b) { + (JsonValue::Object(ref mut a), JsonValue::Object(b)) => { + for (k, v) in b { + json_merge(a.entry(k).or_insert(JsonValue::Null), v); + } + } + (JsonValue::Array(ref mut a), JsonValue::Array(b)) => { + a.extend(b.clone()); + } + (JsonValue::Array(ref mut a), JsonValue::Object(b)) => { + a.extend([JsonValue::Object(b.clone())]); + } + (a, b) => { + *a = b.clone(); + } + } } #[cfg(test)] diff --git a/crates/nu-command/src/env/config/config_env.rs b/crates/nu-command/src/env/config/config_env.rs index cb4a217d9b..5331d2d3be 100644 --- a/crates/nu-command/src/env/config/config_env.rs +++ b/crates/nu-command/src/env/config/config_env.rs @@ -15,7 +15,16 @@ impl Command for ConfigEnv { Signature::build(self.name()) .category(Category::Env) .input_output_types(vec![(Type::Nothing, Type::Any)]) - .switch("default", "Print default `env.nu` file instead.", Some('d')) + .switch( + "default", + "Print the internal default `env.nu` file instead.", + Some('d'), + ) + .switch( + "sample", + "Print a commented, sample `env.nu` file instead.", + Some('s'), + ) // TODO: Signature narrower than what run actually supports theoretically } @@ -26,18 +35,18 @@ impl Command for ConfigEnv { fn examples(&self) -> Vec { vec![ Example { - description: "allow user to open and update nu env", + description: "open user's env.nu in the default editor", example: "config env", result: None, }, Example { - description: "allow user to print default `env.nu` file", - example: "config env --default,", + description: "pretty-print a commented, sample `env.nu` that explains common settings", + example: "config env --sample | nu-highlight,", result: None, }, Example { - description: "allow saving the default `env.nu` locally", - example: "config env --default | save -f ~/.config/nushell/default_env.nu", + description: "pretty-print the internal `env.nu` file which is loaded before the user's environment", + example: "config env --default | nu-highlight,", result: None, }, ] @@ -50,12 +59,28 @@ impl Command for ConfigEnv { call: &Call, _input: PipelineData, ) -> Result { + let default_flag = call.has_flag(engine_state, stack, "default")?; + let sample_flag = call.has_flag(engine_state, stack, "sample")?; + if default_flag && sample_flag { + return Err(ShellError::IncompatibleParameters { + left_message: "can't use `--default` at the same time".into(), + left_span: call.get_flag_span(stack, "default").expect("has flag"), + right_message: "because of `--sample`".into(), + right_span: call.get_flag_span(stack, "sample").expect("has flag"), + }); + } // `--default` flag handling if call.has_flag(engine_state, stack, "default")? { let head = call.head; return Ok(Value::string(nu_utils::get_default_env(), head).into_pipeline_data()); } + // `--sample` flag handling + if sample_flag { + let head = call.head; + return Ok(Value::string(nu_utils::get_sample_env(), head).into_pipeline_data()); + } + // Find the editor executable. let (editor_name, editor_args) = get_editor(engine_state, stack, call.head)?; let paths = nu_engine::env::path_str(engine_state, stack, call.head)?; diff --git a/crates/nu-command/src/env/config/config_nu.rs b/crates/nu-command/src/env/config/config_nu.rs index 9969968ed2..176643a76f 100644 --- a/crates/nu-command/src/env/config/config_nu.rs +++ b/crates/nu-command/src/env/config/config_nu.rs @@ -17,9 +17,14 @@ impl Command for ConfigNu { .input_output_types(vec![(Type::Nothing, Type::Any)]) .switch( "default", - "Print default `config.nu` file instead.", + "Print the internal default `config.nu` file instead.", Some('d'), ) + .switch( + "sample", + "Print a commented, sample `config.nu` file instead.", + Some('s'), + ) // TODO: Signature narrower than what run actually supports theoretically } @@ -30,18 +35,19 @@ impl Command for ConfigNu { fn examples(&self) -> Vec { vec![ Example { - description: "allow user to open and update nu config", + description: "open user's config.nu in the default editor", example: "config nu", result: None, }, Example { - description: "allow user to print default `config.nu` file", - example: "config nu --default,", + description: "pretty-print a commented, sample `config.nu` that explains common settings", + example: "config nu --sample | nu-highlight", result: None, }, Example { - description: "allow saving the default `config.nu` locally", - example: "config nu --default | save -f ~/.config/nushell/default_config.nu", + description: + "pretty-print the internal `config.nu` file which is loaded before user's config", + example: "config nu --default | nu-highlight", result: None, }, ] @@ -54,12 +60,29 @@ impl Command for ConfigNu { call: &Call, _input: PipelineData, ) -> Result { + let default_flag = call.has_flag(engine_state, stack, "default")?; + let sample_flag = call.has_flag(engine_state, stack, "sample")?; + if default_flag && sample_flag { + return Err(ShellError::IncompatibleParameters { + left_message: "can't use `--default` at the same time".into(), + left_span: call.get_flag_span(stack, "default").expect("has flag"), + right_message: "because of `--sample`".into(), + right_span: call.get_flag_span(stack, "sample").expect("has flag"), + }); + } + // `--default` flag handling - if call.has_flag(engine_state, stack, "default")? { + if default_flag { let head = call.head; return Ok(Value::string(nu_utils::get_default_config(), head).into_pipeline_data()); } + // `--sample` flag handling + if sample_flag { + let head = call.head; + return Ok(Value::string(nu_utils::get_sample_config(), head).into_pipeline_data()); + } + // Find the editor executable. let (editor_name, editor_args) = get_editor(engine_state, stack, call.head)?; let paths = nu_engine::env::path_str(engine_state, stack, call.head)?; diff --git a/crates/nu-command/src/filesystem/watch.rs b/crates/nu-command/src/filesystem/watch.rs index 6f022acca8..dd21304173 100644 --- a/crates/nu-command/src/filesystem/watch.rs +++ b/crates/nu-command/src/filesystem/watch.rs @@ -194,7 +194,7 @@ impl Command for Watch { match result { Ok(val) => { - val.print(engine_state, stack, false, false)?; + val.print_table(engine_state, stack, false, false)?; } Err(err) => { let working_set = StateWorkingSet::new(engine_state); diff --git a/crates/nu-command/src/filters/split_by.rs b/crates/nu-command/src/filters/split_by.rs index 217918cf91..b42f0c820c 100644 --- a/crates/nu-command/src/filters/split_by.rs +++ b/crates/nu-command/src/filters/split_by.rs @@ -1,5 +1,6 @@ use indexmap::IndexMap; use nu_engine::command_prelude::*; +use nu_protocol::report_shell_warning; #[derive(Clone)] pub struct SplitBy; @@ -27,6 +28,15 @@ impl Command for SplitBy { call: &Call, input: PipelineData, ) -> Result { + report_shell_warning( + engine_state, + &ShellError::Deprecated { + deprecated: "The `split_by` command", + suggestion: "Please use the `group-by` command instead.", + span: call.head, + help: None, + }, + ); split_by(engine_state, stack, call, input) } diff --git a/crates/nu-command/src/formats/from/csv.rs b/crates/nu-command/src/formats/from/csv.rs index 472ccf4d71..bde84c2c73 100644 --- a/crates/nu-command/src/formats/from/csv.rs +++ b/crates/nu-command/src/formats/from/csv.rs @@ -11,7 +11,10 @@ impl Command for FromCsv { fn signature(&self) -> Signature { Signature::build("from csv") - .input_output_types(vec![(Type::String, Type::table())]) + .input_output_types(vec![ + (Type::String, Type::table()), + (Type::String, Type::list(Type::Any)), + ]) .named( "separator", SyntaxShape::String, @@ -82,6 +85,26 @@ impl Command for FromCsv { })], )) }, + Example { + description: "Convert comma-separated data to a table, allowing variable number of columns per row", + example: "\"ColA,ColB\n1,2\n3,4,5\n6\" | from csv --flexible", + result: Some(Value::test_list ( + vec![ + Value::test_record(record! { + "ColA" => Value::test_int(1), + "ColB" => Value::test_int(2), + }), + Value::test_record(record! { + "ColA" => Value::test_int(3), + "ColB" => Value::test_int(4), + "column2" => Value::test_int(5), + }), + Value::test_record(record! { + "ColA" => Value::test_int(6), + }), + ], + )) + }, Example { description: "Convert comma-separated data to a table, ignoring headers", example: "open data.txt | from csv --noheaders", diff --git a/crates/nu-command/src/formats/from/delimited.rs b/crates/nu-command/src/formats/from/delimited.rs index 0fea7e082b..5dfdd4ad82 100644 --- a/crates/nu-command/src/formats/from/delimited.rs +++ b/crates/nu-command/src/formats/from/delimited.rs @@ -39,12 +39,7 @@ fn from_delimited_stream( .from_reader(input_reader); let headers = if noheaders { - (0..reader - .headers() - .map_err(|err| from_csv_error(err, span))? - .len()) - .map(|i| format!("column{i}")) - .collect::>() + vec![] } else { reader .headers() @@ -54,32 +49,28 @@ fn from_delimited_stream( .collect() }; + let n = headers.len(); + let columns = headers + .into_iter() + .chain((n..).map(|i| format!("column{i}"))); let iter = reader.into_records().map(move |row| { let row = match row { Ok(row) => row, Err(err) => return Value::error(from_csv_error(err, span), span), }; - let columns = headers.iter().cloned(); - let values = row - .into_iter() - .map(|s| { - if no_infer { - Value::string(s, span) - } else if let Ok(i) = s.parse() { - Value::int(i, span) - } else if let Ok(f) = s.parse() { - Value::float(f, span) - } else { - Value::string(s, span) - } - }) - .chain(std::iter::repeat(Value::nothing(span))); + let columns = columns.clone(); + let values = row.into_iter().map(|s| { + if no_infer { + Value::string(s, span) + } else if let Ok(i) = s.parse() { + Value::int(i, span) + } else if let Ok(f) = s.parse() { + Value::float(f, span) + } else { + Value::string(s, span) + } + }); - // If there are more values than the number of headers, - // then the remaining values are ignored. - // - // Otherwise, if there are less values than headers, - // then `Value::nothing(span)` is used to fill the remaining columns. Value::record(columns.zip(values).collect(), span) }); diff --git a/crates/nu-command/src/formats/from/tsv.rs b/crates/nu-command/src/formats/from/tsv.rs index cd3c9f97bd..09bee4803f 100644 --- a/crates/nu-command/src/formats/from/tsv.rs +++ b/crates/nu-command/src/formats/from/tsv.rs @@ -11,7 +11,10 @@ impl Command for FromTsv { fn signature(&self) -> Signature { Signature::build("from tsv") - .input_output_types(vec![(Type::String, Type::table())]) + .input_output_types(vec![ + (Type::String, Type::table()), + (Type::String, Type::list(Type::Any)), + ]) .named( "comment", SyntaxShape::String, @@ -76,6 +79,21 @@ impl Command for FromTsv { })], )) }, + Example { + description: "Convert comma-separated data to a table, allowing variable number of columns per row and ignoring headers", + example: "\"value 1\nvalue 2\tdescription 2\" | from tsv --flexible --noheaders", + result: Some(Value::test_list ( + vec![ + Value::test_record(record! { + "column0" => Value::test_string("value 1"), + }), + Value::test_record(record! { + "column0" => Value::test_string("value 2"), + "column1" => Value::test_string("description 2"), + }), + ], + )) + }, Example { description: "Create a tsv file with header columns and open it", example: r#"$'c1(char tab)c2(char tab)c3(char nl)1(char tab)2(char tab)3' | save tsv-data | open tsv-data | from tsv"#, diff --git a/crates/nu-command/src/formats/to/xml.rs b/crates/nu-command/src/formats/to/xml.rs index 77708aa375..4476f654c2 100644 --- a/crates/nu-command/src/formats/to/xml.rs +++ b/crates/nu-command/src/formats/to/xml.rs @@ -4,7 +4,7 @@ use nu_engine::command_prelude::*; use quick_xml::{ escape, - events::{BytesEnd, BytesStart, BytesText, Event}, + events::{BytesEnd, BytesPI, BytesStart, BytesText, Event}, }; use std::{borrow::Cow, io::Cursor}; @@ -406,7 +406,7 @@ impl Job { let content_text = format!("{} {}", tag, content); // PI content must NOT be escaped // https://www.w3.org/TR/xml/#sec-pi - let pi_content = BytesText::from_escaped(content_text.as_str()); + let pi_content = BytesPI::new(content_text.as_str()); self.writer .write_event(Event::PI(pi_content)) diff --git a/crates/nu-command/src/platform/input/input_.rs b/crates/nu-command/src/platform/input/input_.rs index cf46b400c0..f792db992e 100644 --- a/crates/nu-command/src/platform/input/input_.rs +++ b/crates/nu-command/src/platform/input/input_.rs @@ -43,6 +43,12 @@ impl Command for Input { "number of characters to read; suppresses output", Some('n'), ) + .named( + "default", + SyntaxShape::String, + "default value if no input is provided", + Some('d'), + ) .switch("suppress-output", "don't print keystroke values", Some('s')) .category(Category::Platform) } @@ -72,8 +78,12 @@ impl Command for Input { }); } + let default_val: Option = call.get_flag(engine_state, stack, "default")?; if let Some(prompt) = &prompt { - print!("{prompt}"); + match &default_val { + None => print!("{prompt}"), + Some(val) => print!("{prompt} (default: {val})"), + } let _ = std::io::stdout().flush(); } @@ -149,7 +159,10 @@ impl Command for Input { if !suppress_output { std::io::stdout().write_all(b"\n")?; } - Ok(Value::string(buf, call.head).into_pipeline_data()) + match default_val { + Some(val) if buf.is_empty() => Ok(Value::string(val, call.head).into_pipeline_data()), + _ => Ok(Value::string(buf, call.head).into_pipeline_data()), + } } fn examples(&self) -> Vec { @@ -164,6 +177,11 @@ impl Command for Input { example: "let user_input = (input --numchar 2)", result: None, }, + Example { + description: "Get input from the user with default value, and assign to a variable", + example: "let user_input = (input --default 10)", + result: None, + }, ] } } diff --git a/crates/nu-command/src/strings/str_/contains.rs b/crates/nu-command/src/strings/str_/contains.rs index de91768e76..d24fac6668 100644 --- a/crates/nu-command/src/strings/str_/contains.rs +++ b/crates/nu-command/src/strings/str_/contains.rs @@ -77,20 +77,6 @@ impl Command for SubCommand { call: &Call, input: PipelineData, ) -> Result { - if call.has_flag_const(working_set, "not")? { - nu_protocol::report_shell_error( - working_set.permanent(), - &ShellError::GenericError { - error: "Deprecated option".into(), - msg: "`str contains --not {string}` is deprecated and will be removed in 0.95." - .into(), - span: Some(call.head), - help: Some("Please use the `not` operator instead.".into()), - inner: vec![], - }, - ); - } - let cell_paths: Vec = call.rest_const(working_set, 1)?; let cell_paths = (!cell_paths.is_empty()).then_some(cell_paths); let args = Arguments { diff --git a/crates/nu-command/src/system/run_external.rs b/crates/nu-command/src/system/run_external.rs index 604278c676..ffb34bf077 100644 --- a/crates/nu-command/src/system/run_external.rs +++ b/crates/nu-command/src/system/run_external.rs @@ -5,6 +5,8 @@ use nu_protocol::{did_you_mean, process::ChildProcess, ByteStream, NuGlob, OutDe use nu_system::ForegroundChild; use nu_utils::IgnoreCaseExt; use pathdiff::diff_paths; +#[cfg(windows)] +use std::os::windows::process::CommandExt; use std::{ borrow::Cow, ffi::{OsStr, OsString}, @@ -91,6 +93,22 @@ impl Command for External { false }; + // let's make sure it's a .ps1 script, but only on Windows + let potential_powershell_script = if cfg!(windows) { + if let Some(executable) = which(&expanded_name, "", cwd.as_ref()) { + let ext = executable + .extension() + .unwrap_or_default() + .to_string_lossy() + .to_uppercase(); + ext == "PS1" + } else { + false + } + } else { + false + }; + // Find the absolute path to the executable. On Windows, set the // executable to "cmd.exe" if it's a CMD internal command. If the // command is not found, display a helpful error message. @@ -98,11 +116,16 @@ impl Command for External { && (is_cmd_internal_command(&name_str) || potential_nuscript_in_windows) { PathBuf::from("cmd.exe") + } else if cfg!(windows) && potential_powershell_script { + // If we're on Windows and we're trying to run a PowerShell script, we'll use + // `powershell.exe` to run it. We shouldn't have to check for powershell.exe because + // it's automatically installed on all modern windows systems. + PathBuf::from("powershell.exe") } else { // Determine the PATH to be used and then use `which` to find it - though this has no // effect if it's an absolute path already let paths = nu_engine::env::path_str(engine_state, stack, call.head)?; - let Some(executable) = which(expanded_name, &paths, cwd.as_ref()) else { + let Some(executable) = which(&expanded_name, &paths, cwd.as_ref()) else { return Err(command_not_found(&name_str, call.head, engine_state, stack)); }; executable @@ -123,15 +146,29 @@ impl Command for External { let args = eval_arguments_from_call(engine_state, stack, call)?; #[cfg(windows)] if is_cmd_internal_command(&name_str) || potential_nuscript_in_windows { - use std::os::windows::process::CommandExt; - // The /D flag disables execution of AutoRun commands from registry. // The /C flag followed by a command name instructs CMD to execute // that command and quit. - command.args(["/D", "/C", &name_str]); + command.args(["/D", "/C", &expanded_name.to_string_lossy()]); for arg in &args { command.raw_arg(escape_cmd_argument(arg)?); } + } else if potential_powershell_script { + use nu_path::canonicalize_with; + + // canonicalize the path to the script so that tests pass + let canon_path = if let Ok(cwd) = engine_state.cwd_as_string(None) { + canonicalize_with(&expanded_name, cwd)? + } else { + // If we can't get the current working directory, just provide the expanded name + expanded_name + }; + // The -Command flag followed by a script name instructs PowerShell to + // execute that script and quit. + command.args(["-Command", &canon_path.to_string_lossy()]); + for arg in &args { + command.raw_arg(arg.item.clone()); + } } else { command.args(args.into_iter().map(|s| s.item)); } diff --git a/crates/nu-command/src/system/sys/net.rs b/crates/nu-command/src/system/sys/net.rs index ee82f73c61..8e2ac19bf5 100644 --- a/crates/nu-command/src/system/sys/net.rs +++ b/crates/nu-command/src/system/sys/net.rs @@ -44,8 +44,29 @@ fn net(span: Span) -> Value { let networks = Networks::new_with_refreshed_list() .iter() .map(|(iface, data)| { + let ip_addresses = data + .ip_networks() + .iter() + .map(|ip| { + let protocol = match ip.addr { + std::net::IpAddr::V4(_) => "ipv4", + std::net::IpAddr::V6(_) => "ipv6", + }; + Value::record( + record! { + "address" => Value::string(ip.addr.to_string(), span), + "protocol" => Value::string(protocol, span), + "loop" => Value::bool(ip.addr.is_loopback(), span), + "multicast" => Value::bool(ip.addr.is_multicast(), span), + }, + span, + ) + }) + .collect(); let record = record! { "name" => Value::string(trim_cstyle_null(iface), span), + "mac" => Value::string(data.mac_address().to_string(), span), + "ip" => Value::list(ip_addresses, span), "sent" => Value::filesize(data.total_transmitted() as i64, span), "recv" => Value::filesize(data.total_received() as i64, span), }; diff --git a/crates/nu-command/src/viewers/table.rs b/crates/nu-command/src/viewers/table.rs index a9e7361a9e..50db949ced 100644 --- a/crates/nu-command/src/viewers/table.rs +++ b/crates/nu-command/src/viewers/table.rs @@ -1088,7 +1088,7 @@ fn create_empty_placeholder( let data = vec![vec![cell]]; let mut table = NuTable::from(data); table.set_data_style(TextStyle::default().dimmed()); - let out = TableOutput::new(table, false, false, false); + let out = TableOutput::new(table, false, false, 1); let style_computer = &StyleComputer::from_config(engine_state, stack); let config = create_nu_table_config(&config, style_computer, &out, false, TableMode::default()); diff --git a/crates/nu-command/tests/commands/run_external.rs b/crates/nu-command/tests/commands/run_external.rs index 17667c9bb3..8a797300f1 100644 --- a/crates/nu-command/tests/commands/run_external.rs +++ b/crates/nu-command/tests/commands/run_external.rs @@ -355,9 +355,9 @@ fn external_command_receives_raw_binary_data() { #[cfg(windows)] #[test] -fn can_run_batch_files() { +fn can_run_cmd_files() { use nu_test_support::fs::Stub::FileWithContent; - Playground::setup("run a Windows batch file", |dirs, sandbox| { + Playground::setup("run a Windows cmd file", |dirs, sandbox| { sandbox.with_files(&[FileWithContent( "foo.cmd", r#" @@ -371,12 +371,30 @@ fn can_run_batch_files() { }); } +#[cfg(windows)] +#[test] +fn can_run_batch_files() { + use nu_test_support::fs::Stub::FileWithContent; + Playground::setup("run a Windows batch file", |dirs, sandbox| { + sandbox.with_files(&[FileWithContent( + "foo.bat", + r#" + @echo off + echo Hello World + "#, + )]); + + let actual = nu!(cwd: dirs.test(), pipeline("foo.bat")); + assert!(actual.out.contains("Hello World")); + }); +} + #[cfg(windows)] #[test] fn can_run_batch_files_without_cmd_extension() { use nu_test_support::fs::Stub::FileWithContent; Playground::setup( - "run a Windows batch file without specifying the extension", + "run a Windows cmd file without specifying the extension", |dirs, sandbox| { sandbox.with_files(&[FileWithContent( "foo.cmd", @@ -440,3 +458,20 @@ fn redirect_combine() { assert_eq!(actual.out, "FooBar"); }); } + +#[cfg(windows)] +#[test] +fn can_run_ps1_files() { + use nu_test_support::fs::Stub::FileWithContent; + Playground::setup("run_a_windows_ps_file", |dirs, sandbox| { + sandbox.with_files(&[FileWithContent( + "foo.ps1", + r#" + Write-Host Hello World + "#, + )]); + + let actual = nu!(cwd: dirs.test(), pipeline("foo.ps1")); + assert!(actual.out.contains("Hello World")); + }); +} diff --git a/crates/nu-command/tests/commands/table.rs b/crates/nu-command/tests/commands/table.rs index 96ae395e47..b9b80b9e87 100644 --- a/crates/nu-command/tests/commands/table.rs +++ b/crates/nu-command/tests/commands/table.rs @@ -2941,3 +2941,123 @@ fn table_footer_inheritance() { assert_eq!(actual.out.match_indices("x2").count(), 1); assert_eq!(actual.out.match_indices("x3").count(), 1); } + +#[test] +fn table_footer_inheritance_kv_rows() { + let actual = nu!( + concat!( + "$env.config.table.footer_inheritance = true;", + "$env.config.footer_mode = 7;", + "[[a b]; ['kv' {0: 0, 1: 1, 2: 2, 3: 3, 4: 4} ], ['data' 0], ['data' 0] ] | table --expand --width=80", + ) + ); + + assert_eq!( + actual.out, + "╭───┬──────┬───────────╮\ + │ # │ a │ b │\ + ├───┼──────┼───────────┤\ + │ 0 │ kv │ ╭───┬───╮ │\ + │ │ │ │ 0 │ 0 │ │\ + │ │ │ │ 1 │ 1 │ │\ + │ │ │ │ 2 │ 2 │ │\ + │ │ │ │ 3 │ 3 │ │\ + │ │ │ │ 4 │ 4 │ │\ + │ │ │ ╰───┴───╯ │\ + │ 1 │ data │ 0 │\ + │ 2 │ data │ 0 │\ + ╰───┴──────┴───────────╯" + ); + + let actual = nu!( + concat!( + "$env.config.table.footer_inheritance = true;", + "$env.config.footer_mode = 7;", + "[[a b]; ['kv' {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5} ], ['data' 0], ['data' 0] ] | table --expand --width=80", + ) + ); + + assert_eq!( + actual.out, + "╭───┬──────┬───────────╮\ + │ # │ a │ b │\ + ├───┼──────┼───────────┤\ + │ 0 │ kv │ ╭───┬───╮ │\ + │ │ │ │ 0 │ 0 │ │\ + │ │ │ │ 1 │ 1 │ │\ + │ │ │ │ 2 │ 2 │ │\ + │ │ │ │ 3 │ 3 │ │\ + │ │ │ │ 4 │ 4 │ │\ + │ │ │ │ 5 │ 5 │ │\ + │ │ │ ╰───┴───╯ │\ + │ 1 │ data │ 0 │\ + │ 2 │ data │ 0 │\ + ├───┼──────┼───────────┤\ + │ # │ a │ b │\ + ╰───┴──────┴───────────╯" + ); +} + +#[test] +fn table_footer_inheritance_list_rows() { + let actual = nu!( + concat!( + "$env.config.table.footer_inheritance = true;", + "$env.config.footer_mode = 7;", + "[[a b]; ['kv' {0: [[field]; [0] [1] [2] [3] [4]]} ], ['data' 0], ['data' 0] ] | table --expand --width=80", + ) + ); + + assert_eq!( + actual.out, + "╭───┬──────┬───────────────────────╮\ + │ # │ a │ b │\ + ├───┼──────┼───────────────────────┤\ + │ 0 │ kv │ ╭───┬───────────────╮ │\ + │ │ │ │ │ ╭───┬───────╮ │ │\ + │ │ │ │ 0 │ │ # │ field │ │ │\ + │ │ │ │ │ ├───┼───────┤ │ │\ + │ │ │ │ │ │ 0 │ 0 │ │ │\ + │ │ │ │ │ │ 1 │ 1 │ │ │\ + │ │ │ │ │ │ 2 │ 2 │ │ │\ + │ │ │ │ │ │ 3 │ 3 │ │ │\ + │ │ │ │ │ │ 4 │ 4 │ │ │\ + │ │ │ │ │ ╰───┴───────╯ │ │\ + │ │ │ ╰───┴───────────────╯ │\ + │ 1 │ data │ 0 │\ + │ 2 │ data │ 0 │\ + ╰───┴──────┴───────────────────────╯" + ); + + let actual = nu!( + concat!( + "$env.config.table.footer_inheritance = true;", + "$env.config.footer_mode = 7;", + "[[a b]; ['kv' {0: [[field]; [0] [1] [2] [3] [4] [5]]} ], ['data' 0], ['data' 0] ] | table --expand --width=80", + ) + ); + + assert_eq!( + actual.out, + "╭───┬──────┬───────────────────────╮\ + │ # │ a │ b │\ + ├───┼──────┼───────────────────────┤\ + │ 0 │ kv │ ╭───┬───────────────╮ │\ + │ │ │ │ │ ╭───┬───────╮ │ │\ + │ │ │ │ 0 │ │ # │ field │ │ │\ + │ │ │ │ │ ├───┼───────┤ │ │\ + │ │ │ │ │ │ 0 │ 0 │ │ │\ + │ │ │ │ │ │ 1 │ 1 │ │ │\ + │ │ │ │ │ │ 2 │ 2 │ │ │\ + │ │ │ │ │ │ 3 │ 3 │ │ │\ + │ │ │ │ │ │ 4 │ 4 │ │ │\ + │ │ │ │ │ │ 5 │ 5 │ │ │\ + │ │ │ │ │ ╰───┴───────╯ │ │\ + │ │ │ ╰───┴───────────────╯ │\ + │ 1 │ data │ 0 │\ + │ 2 │ data │ 0 │\ + ├───┼──────┼───────────────────────┤\ + │ # │ a │ b │\ + ╰───┴──────┴───────────────────────╯" + ); +} diff --git a/crates/nu-command/tests/format_conversions/csv.rs b/crates/nu-command/tests/format_conversions/csv.rs index f10a84b672..4f50ab1492 100644 --- a/crates/nu-command/tests/format_conversions/csv.rs +++ b/crates/nu-command/tests/format_conversions/csv.rs @@ -469,7 +469,7 @@ fn from_csv_test_flexible_extra_vals() { echo "a,b\n1,2,3" | from csv --flexible | first | values | to nuon "# )); - assert_eq!(actual.out, "[1, 2]"); + assert_eq!(actual.out, "[1, 2, 3]"); } #[test] @@ -479,5 +479,5 @@ fn from_csv_test_flexible_missing_vals() { echo "a,b\n1" | from csv --flexible | first | values | to nuon "# )); - assert_eq!(actual.out, "[1, null]"); + assert_eq!(actual.out, "[1]"); } diff --git a/crates/nu-command/tests/format_conversions/ods.rs b/crates/nu-command/tests/format_conversions/ods.rs index 34e3e5208c..8a69493cc4 100644 --- a/crates/nu-command/tests/format_conversions/ods.rs +++ b/crates/nu-command/tests/format_conversions/ods.rs @@ -29,3 +29,20 @@ fn from_ods_file_to_table_select_sheet() { assert_eq!(actual.out, "SalesOrders"); } + +#[test] +fn from_ods_file_to_table_select_sheet_with_annotations() { + let actual = nu!( + cwd: "tests/fixtures/formats", pipeline( + r#" + open sample_data_with_annotation.ods --raw + | from ods --sheets ["SalesOrders"] + | get SalesOrders + | get column4 + | get 0 + "# + )); + + // The Units column in the sheet SalesOrders has an annotation and should be ignored. + assert_eq!(actual.out, "Units"); +} diff --git a/crates/nu-plugin/Cargo.toml b/crates/nu-plugin/Cargo.toml index a2c328375e..2c43a86c5e 100644 --- a/crates/nu-plugin/Cargo.toml +++ b/crates/nu-plugin/Cargo.toml @@ -21,7 +21,7 @@ nu-plugin-core = { path = "../nu-plugin-core", version = "0.100.1", default-feat nu-utils = { path = "../nu-utils", version = "0.100.1" } log = { workspace = true } -thiserror = "1.0" +thiserror = "2.0" [dev-dependencies] serde = { workspace = true } diff --git a/crates/nu-protocol/Cargo.toml b/crates/nu-protocol/Cargo.toml index 60d6c10acc..dfbcb7b307 100644 --- a/crates/nu-protocol/Cargo.toml +++ b/crates/nu-protocol/Cargo.toml @@ -36,7 +36,7 @@ num-format = { workspace = true } rmp-serde = { workspace = true, optional = true } serde = { workspace = true } serde_json = { workspace = true } -thiserror = "1.0" +thiserror = "2.0" typetag = "0.2" os_pipe = { workspace = true, features = ["io_safety"] } log = { workspace = true } diff --git a/crates/nu-protocol/src/errors/shell_error.rs b/crates/nu-protocol/src/errors/shell_error.rs index 96678daef5..b4b6c29cee 100644 --- a/crates/nu-protocol/src/errors/shell_error.rs +++ b/crates/nu-protocol/src/errors/shell_error.rs @@ -1330,14 +1330,15 @@ This is an internal Nushell error, please file an issue https://github.com/nushe span: Span, }, - #[error("Deprecated: {old_command}")] - #[diagnostic(help("for more info see {url}"))] + #[error("{deprecated} is deprecated and will be removed in a future release")] + #[diagnostic()] Deprecated { - old_command: String, - new_suggestion: String, - #[label("`{old_command}` is deprecated and will be removed in a future release. Please {new_suggestion} instead.")] + deprecated: &'static str, + suggestion: &'static str, + #[label("{deprecated} is deprecated. {suggestion}")] span: Span, - url: String, + #[help] + help: Option<&'static str>, }, /// Invalid glob pattern diff --git a/crates/nu-protocol/src/pipeline/pipeline_data.rs b/crates/nu-protocol/src/pipeline/pipeline_data.rs index 827f6e31a7..75449f547f 100644 --- a/crates/nu-protocol/src/pipeline/pipeline_data.rs +++ b/crates/nu-protocol/src/pipeline/pipeline_data.rs @@ -203,7 +203,7 @@ impl PipelineData { ) -> Result { match stack.pipe_stdout().unwrap_or(&OutDest::Inherit) { OutDest::Print => { - self.print(engine_state, stack, false, false)?; + self.print_table(engine_state, stack, false, false)?; Ok(Self::Empty) } OutDest::Pipe | OutDest::PipeSeparate => Ok(self), @@ -534,11 +534,14 @@ impl PipelineData { } } - /// Consume and print self data immediately. + /// Consume and print self data immediately, formatted using table command. + /// + /// This does not respect the display_output hook. If a value is being printed out by a command, + /// this function should be used. Otherwise, `nu_cli::util::print_pipeline` should be preferred. /// /// `no_newline` controls if we need to attach newline character to output. /// `to_stderr` controls if data is output to stderr, when the value is false, the data is output to stdout. - pub fn print( + pub fn print_table( self, engine_state: &EngineState, stack: &mut Stack, diff --git a/crates/nu-protocol/tests/into_config.rs b/crates/nu-protocol/tests/into_config.rs index 63d7eb8b22..3ff8d44672 100644 --- a/crates/nu-protocol/tests/into_config.rs +++ b/crates/nu-protocol/tests/into_config.rs @@ -35,7 +35,7 @@ fn config_affected_when_mutated() { #[test] fn config_affected_when_deep_mutated() { - let actual = nu!(cwd: "crates/nu-utils/src/sample_config", nu_repl_code(&[ + let actual = nu!(cwd: "crates/nu-utils/src/default_files", nu_repl_code(&[ r#"source default_config.nu"#, r#"$env.config.filesize.metric = true"#, r#"20mib | into string"#])); @@ -45,7 +45,7 @@ fn config_affected_when_deep_mutated() { #[test] fn config_add_unsupported_key() { - let actual = nu!(cwd: "crates/nu-utils/src/sample_config", nu_repl_code(&[ + let actual = nu!(cwd: "crates/nu-utils/src/default_files", nu_repl_code(&[ r#"source default_config.nu"#, r#"$env.config.foo = 2"#, r#";"#])); @@ -57,7 +57,7 @@ fn config_add_unsupported_key() { #[test] fn config_add_unsupported_type() { - let actual = nu!(cwd: "crates/nu-utils/src/sample_config", nu_repl_code(&[r#"source default_config.nu"#, + let actual = nu!(cwd: "crates/nu-utils/src/default_files", nu_repl_code(&[r#"source default_config.nu"#, r#"$env.config.ls = '' "#, r#";"#])); @@ -66,7 +66,7 @@ fn config_add_unsupported_type() { #[test] fn config_add_unsupported_value() { - let actual = nu!(cwd: "crates/nu-utils/src/sample_config", nu_repl_code(&[r#"source default_config.nu"#, + let actual = nu!(cwd: "crates/nu-utils/src/default_files", nu_repl_code(&[r#"source default_config.nu"#, r#"$env.config.history.file_format = ''"#, r#";"#])); @@ -77,7 +77,7 @@ fn config_add_unsupported_value() { #[test] #[ignore = "Figure out how to make test_bins::nu_repl() continue execution after shell errors"] fn config_unsupported_key_reverted() { - let actual = nu!(cwd: "crates/nu-utils/src/sample_config", nu_repl_code(&[r#"source default_config.nu"#, + let actual = nu!(cwd: "crates/nu-utils/src/default_files", nu_repl_code(&[r#"source default_config.nu"#, r#"$env.config.foo = 1"#, r#"'foo' in $env.config"#])); @@ -87,7 +87,7 @@ fn config_unsupported_key_reverted() { #[test] #[ignore = "Figure out how to make test_bins::nu_repl() continue execution after shell errors"] fn config_unsupported_type_reverted() { - let actual = nu!(cwd: "crates/nu-utils/src/sample_config", nu_repl_code(&[r#" source default_config.nu"#, + let actual = nu!(cwd: "crates/nu-utils/src/default_files", nu_repl_code(&[r#" source default_config.nu"#, r#"$env.config.ls = ''"#, r#"$env.config.ls | describe"#])); @@ -97,7 +97,7 @@ fn config_unsupported_type_reverted() { #[test] #[ignore = "Figure out how to make test_bins::nu_repl() continue execution after errors"] fn config_unsupported_value_reverted() { - let actual = nu!(cwd: "crates/nu-utils/src/sample_config", nu_repl_code(&[r#" source default_config.nu"#, + let actual = nu!(cwd: "crates/nu-utils/src/default_files", nu_repl_code(&[r#" source default_config.nu"#, r#"$env.config.history.file_format = 'plaintext'"#, r#"$env.config.history.file_format = ''"#, r#"$env.config.history.file_format | to json"#])); diff --git a/crates/nu-std/src/lib.rs b/crates/nu-std/src/lib.rs index ebc6ee0053..b03b710cfc 100644 --- a/crates/nu-std/src/lib.rs +++ b/crates/nu-std/src/lib.rs @@ -54,6 +54,7 @@ pub fn load_standard_library( ("mod.nu", "std/math", include_str!("../std/math/mod.nu")), ("mod.nu", "std/util", include_str!("../std/util/mod.nu")), ("mod.nu", "std/xml", include_str!("../std/xml/mod.nu")), + ("mod.nu", "std/config", include_str!("../std/config/mod.nu")), ]; for (filename, std_subdir_name, content) in std_submodules.drain(..) { diff --git a/crates/nu-std/std/config/mod.nu b/crates/nu-std/std/config/mod.nu new file mode 100644 index 0000000000..b73964e8d3 --- /dev/null +++ b/crates/nu-std/std/config/mod.nu @@ -0,0 +1,139 @@ +# Returns a dark-mode theme that can be assigned to $env.config.color_config +export def dark-theme [] { + { + # color for nushell primitives + separator: white + leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off + header: green_bold + empty: blue + # Closures can be used to choose colors for specific values. + # The value (in this case, a bool) is piped into the closure. + # eg) {|| if $in { 'light_cyan' } else { 'light_gray' } } + bool: light_cyan + int: white + filesize: cyan + duration: white + date: purple + range: white + float: white + string: white + nothing: white + binary: white + cell-path: white + row_index: green_bold + record: white + list: white + block: white + hints: dark_gray + search_result: { bg: red fg: white } + shape_and: purple_bold + shape_binary: purple_bold + shape_block: blue_bold + shape_bool: light_cyan + shape_closure: green_bold + shape_custom: green + shape_datetime: cyan_bold + shape_directory: cyan + shape_external: cyan + shape_externalarg: green_bold + shape_external_resolved: light_yellow_bold + shape_filepath: cyan + shape_flag: blue_bold + shape_float: purple_bold + # shapes are used to change the cli syntax highlighting + shape_garbage: { fg: white bg: red attr: b } + shape_glob_interpolation: cyan_bold + shape_globpattern: cyan_bold + shape_int: purple_bold + shape_internalcall: cyan_bold + shape_keyword: cyan_bold + shape_list: cyan_bold + shape_literal: blue + shape_match_pattern: green + shape_matching_brackets: { attr: u } + shape_nothing: light_cyan + shape_operator: yellow + shape_or: purple_bold + shape_pipe: purple_bold + shape_range: yellow_bold + shape_record: cyan_bold + shape_redirection: purple_bold + shape_signature: green_bold + shape_string: green + shape_string_interpolation: cyan_bold + shape_table: blue_bold + shape_variable: purple + shape_vardecl: purple + shape_raw_string: light_purple + } +} + +# Returns a light-mode theme that can be assigned to $env.config.color_config +export def light-theme [] { + { + # color for nushell primitives + separator: dark_gray + leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off + header: green_bold + empty: blue + # Closures can be used to choose colors for specific values. + # The value (in this case, a bool) is piped into the closure. + # eg) {|| if $in { 'dark_cyan' } else { 'dark_gray' } } + bool: dark_cyan + int: dark_gray + filesize: cyan_bold + duration: dark_gray + date: purple + range: dark_gray + float: dark_gray + string: dark_gray + nothing: dark_gray + binary: dark_gray + cell-path: dark_gray + row_index: green_bold + record: dark_gray + list: dark_gray + block: dark_gray + hints: dark_gray + search_result: { fg: white bg: red } + shape_and: purple_bold + shape_binary: purple_bold + shape_block: blue_bold + shape_bool: light_cyan + shape_closure: green_bold + shape_custom: green + shape_datetime: cyan_bold + shape_directory: cyan + shape_external: cyan + shape_externalarg: green_bold + shape_external_resolved: light_purple_bold + shape_filepath: cyan + shape_flag: blue_bold + shape_float: purple_bold + # shapes are used to change the cli syntax highlighting + shape_garbage: { fg: white bg: red attr: b } + shape_glob_interpolation: cyan_bold + shape_globpattern: cyan_bold + shape_int: purple_bold + shape_internalcall: cyan_bold + shape_keyword: cyan_bold + shape_list: cyan_bold + shape_literal: blue + shape_match_pattern: green + shape_matching_brackets: { attr: u } + shape_nothing: light_cyan + shape_operator: yellow + shape_or: purple_bold + shape_pipe: purple_bold + shape_range: yellow_bold + shape_record: cyan_bold + shape_redirection: purple_bold + shape_signature: green_bold + shape_string: green + shape_string_interpolation: cyan_bold + shape_table: blue_bold + shape_variable: purple + shape_vardecl: purple + shape_raw_string: light_purple + } +} \ No newline at end of file diff --git a/crates/nu-std/std/mod.nu b/crates/nu-std/std/mod.nu index 4d1e74e72d..89454ee1f3 100644 --- a/crates/nu-std/std/mod.nu +++ b/crates/nu-std/std/mod.nu @@ -14,6 +14,7 @@ export module std/iter export module std/log export module std/math export module std/xml +export module std/config # Load main dirs command and all subcommands export use std/dirs main diff --git a/crates/nu-table/src/common.rs b/crates/nu-table/src/common.rs index d18e053a1c..13c8f84fbc 100644 --- a/crates/nu-table/src/common.rs +++ b/crates/nu-table/src/common.rs @@ -18,8 +18,12 @@ pub fn create_nu_table_config( expand: bool, mode: TableMode, ) -> NuTableConfig { - let with_footer = (config.table.footer_inheritance && out.with_footer) - || with_footer(config, out.with_header, out.table.count_rows()); + let mut count_rows = out.table.count_rows(); + if config.table.footer_inheritance { + count_rows = out.count_rows; + } + + let with_footer = with_footer(config, out.with_header, count_rows); NuTableConfig { theme: load_theme(mode), diff --git a/crates/nu-table/src/table.rs b/crates/nu-table/src/table.rs index 971e5b1f91..bf75e14380 100644 --- a/crates/nu-table/src/table.rs +++ b/crates/nu-table/src/table.rs @@ -615,12 +615,15 @@ fn load_theme( if let Some(style) = sep_color { let color = convert_style(style); let color = ANSIBuf::from(color); + // todo: use .modify(Segment::all(), color) --> it has this optimization table.get_config_mut().set_border_color_default(color); } if !with_header { + // todo: remove and use theme.remove_horizontal_lines(); table.with(RemoveHorizontalLine); } else if with_footer { + // todo: remove and set it on theme rather then here... table.with(CopyFirstHorizontalLineAtLast); } } @@ -1257,6 +1260,7 @@ fn remove_row(recs: &mut NuRecords, row: usize) -> Vec { columns } +// todo; use Format? struct StripColorFromRow(usize); impl TableOption> for StripColorFromRow { diff --git a/crates/nu-table/src/types/expanded.rs b/crates/nu-table/src/types/expanded.rs index a0b6cd0ff2..d87af74522 100644 --- a/crates/nu-table/src/types/expanded.rs +++ b/crates/nu-table/src/types/expanded.rs @@ -5,7 +5,7 @@ use crate::{ NuText, StringResult, TableResult, INDEX_COLUMN_NAME, }, string_width, - types::{has_footer, has_index}, + types::has_index, NuTable, NuTableCell, TableOpts, TableOutput, }; use nu_color_config::{Alignment, StyleComputer, TextStyle}; @@ -63,22 +63,22 @@ struct Cfg<'a> { struct CellOutput { text: String, style: TextStyle, - is_big: bool, + size: usize, is_expanded: bool, } impl CellOutput { - fn new(text: String, style: TextStyle, is_big: bool, is_expanded: bool) -> Self { + fn new(text: String, style: TextStyle, size: usize, is_expanded: bool) -> Self { Self { text, style, - is_big, + size, is_expanded, } } - fn clean(text: String, is_big: bool, is_expanded: bool) -> Self { - Self::new(text, Default::default(), is_big, is_expanded) + fn clean(text: String, size: usize, is_expanded: bool) -> Self { + Self::new(text, Default::default(), size, is_expanded) } fn text(text: String) -> Self { @@ -86,7 +86,7 @@ impl CellOutput { } fn styled(text: NuText) -> Self { - Self::new(text.0, text.1, false, false) + Self::new(text.0, text.1, 1, false) } } @@ -117,7 +117,7 @@ fn expanded_table_list(input: &[Value], cfg: Cfg<'_>) -> TableResult { let with_index = has_index(&cfg.opts, &headers); let row_offset = cfg.opts.index_offset; - let mut is_footer_used = false; + let mut rows_count = 0usize; // The header with the INDEX is removed from the table headers since // it is added to the natural table index @@ -199,9 +199,7 @@ fn expanded_table_list(input: &[Value], cfg: Cfg<'_>) -> TableResult { data[row].push(value); data_styles.insert((row, with_index as usize), cell.style); - if cell.is_big { - is_footer_used = cell.is_big; - } + rows_count = rows_count.saturating_add(cell.size); } let mut table = NuTable::from(data); @@ -209,12 +207,7 @@ fn expanded_table_list(input: &[Value], cfg: Cfg<'_>) -> TableResult { table.set_index_style(get_index_style(cfg.opts.style_computer)); set_data_styles(&mut table, data_styles); - return Ok(Some(TableOutput::new( - table, - false, - with_index, - is_footer_used, - ))); + return Ok(Some(TableOutput::new(table, false, with_index, rows_count))); } if !headers.is_empty() { @@ -269,6 +262,8 @@ fn expanded_table_list(input: &[Value], cfg: Cfg<'_>) -> TableResult { } } + let mut column_rows = 0usize; + for (row, item) in input.iter().enumerate() { cfg.opts.signals.check(cfg.opts.span)?; @@ -294,9 +289,7 @@ fn expanded_table_list(input: &[Value], cfg: Cfg<'_>) -> TableResult { data[row + 1].push(value); data_styles.insert((row + 1, col + with_index as usize), cell.style); - if cell.is_big { - is_footer_used = cell.is_big; - } + column_rows = column_rows.saturating_add(cell.size); } let head_cell = NuTableCell::new(header); @@ -316,6 +309,8 @@ fn expanded_table_list(input: &[Value], cfg: Cfg<'_>) -> TableResult { available_width -= pad_space + column_width; rendered_column += 1; + + rows_count = std::cmp::max(rows_count, column_rows); } if truncate && rendered_column == 0 { @@ -374,9 +369,7 @@ fn expanded_table_list(input: &[Value], cfg: Cfg<'_>) -> TableResult { table.set_indent(cfg.opts.indent.0, cfg.opts.indent.1); set_data_styles(&mut table, data_styles); - let has_footer = is_footer_used || has_footer(&cfg.opts, table.count_rows() as u64); - - Ok(Some(TableOutput::new(table, true, with_index, has_footer))) + Ok(Some(TableOutput::new(table, true, with_index, rows_count))) } fn expanded_table_kv(record: &Record, cfg: Cfg<'_>) -> CellResult { @@ -395,7 +388,7 @@ fn expanded_table_kv(record: &Record, cfg: Cfg<'_>) -> CellResult { let value_width = cfg.opts.width - key_width - count_borders - padding - padding; - let mut with_footer = false; + let mut count_rows = 0usize; let mut data = Vec::with_capacity(record.len()); for (key, value) in record { @@ -420,19 +413,17 @@ fn expanded_table_kv(record: &Record, cfg: Cfg<'_>) -> CellResult { data.push(row); - if cell.is_big { - with_footer = cell.is_big; - } + count_rows = count_rows.saturating_add(cell.size); } let mut table = NuTable::from(data); table.set_index_style(get_key_style(&cfg)); table.set_indent(cfg.opts.indent.0, cfg.opts.indent.1); - let out = TableOutput::new(table, false, true, with_footer); + let out = TableOutput::new(table, false, true, count_rows); maybe_expand_table(out, cfg.opts.width, &cfg.opts) - .map(|value| value.map(|value| CellOutput::clean(value, with_footer, false))) + .map(|value| value.map(|value| CellOutput::clean(value, count_rows, false))) } // the flag is used as an optimization to not do `value.lines().count()` search. @@ -441,7 +432,7 @@ fn expand_table_value(value: &Value, value_width: usize, cfg: &Cfg<'_>) -> CellR if is_limited { return Ok(Some(CellOutput::clean( value_to_string_clean(value, cfg), - false, + 1, false, ))); } @@ -457,7 +448,7 @@ fn expand_table_value(value: &Value, value_width: usize, cfg: &Cfg<'_>) -> CellR let cfg = create_table_cfg(cfg, &out); let value = out.table.draw(cfg, value_width); match value { - Some(value) => Ok(Some(CellOutput::clean(value, out.with_footer, true))), + Some(value) => Ok(Some(CellOutput::clean(value, out.count_rows, true))), None => Ok(None), } } @@ -484,7 +475,7 @@ fn expand_table_value(value: &Value, value_width: usize, cfg: &Cfg<'_>) -> CellR let inner_cfg = update_config(dive_options(cfg, span), value_width); let result = expanded_table_kv(record, inner_cfg)?; match result { - Some(result) => Ok(Some(CellOutput::clean(result.text, result.is_big, true))), + Some(result) => Ok(Some(CellOutput::clean(result.text, result.size, true))), None => Ok(Some(CellOutput::text(value_to_wrapped_string( value, cfg, @@ -575,7 +566,7 @@ fn expanded_table_entry2(item: &Value, cfg: Cfg<'_>) -> CellOutput { let table_config = create_table_cfg(&cfg, &out); let table = out.table.draw(table_config, usize::MAX); match table { - Some(table) => CellOutput::clean(table, out.with_footer, false), + Some(table) => CellOutput::clean(table, out.count_rows, false), None => CellOutput::styled(nu_value_to_string( item, cfg.opts.config, diff --git a/crates/nu-table/src/types/general.rs b/crates/nu-table/src/types/general.rs index ba0a1ceefa..e748b6eff2 100644 --- a/crates/nu-table/src/types/general.rs +++ b/crates/nu-table/src/types/general.rs @@ -56,8 +56,9 @@ fn kv_table(record: &Record, opts: TableOpts<'_>) -> StringResult { let mut table = NuTable::from(data); table.set_index_style(TextStyle::default_field()); + let count_rows = table.count_rows(); - let mut out = TableOutput::new(table, false, true, false); + let mut out = TableOutput::new(table, false, true, count_rows); let left = opts.config.table.padding.left; let right = opts.config.table.padding.right; @@ -82,7 +83,10 @@ fn table(input: &[Value], opts: &TableOpts<'_>) -> TableResult { let with_header = !headers.is_empty(); if !with_header { let table = to_table_with_no_header(input, with_index, row_offset, opts)?; - let table = table.map(|table| TableOutput::new(table, false, with_index, false)); + let table = table.map(|table| { + let count_rows = table.count_rows(); + TableOutput::new(table, false, with_index, count_rows) + }); return Ok(table); } @@ -98,7 +102,10 @@ fn table(input: &[Value], opts: &TableOpts<'_>) -> TableResult { .collect(); let table = to_table_with_header(input, &headers, with_index, row_offset, opts)?; - let table = table.map(|table| TableOutput::new(table, true, with_index, false)); + let table = table.map(|table| { + let count_rows = table.count_rows(); + TableOutput::new(table, true, with_index, count_rows) + }); Ok(table) } diff --git a/crates/nu-table/src/types/mod.rs b/crates/nu-table/src/types/mod.rs index adbe56bf27..829c87ed9e 100644 --- a/crates/nu-table/src/types/mod.rs +++ b/crates/nu-table/src/types/mod.rs @@ -1,8 +1,7 @@ -use terminal_size::{terminal_size, Height, Width}; +use nu_color_config::StyleComputer; +use nu_protocol::{Config, Signals, Span, TableIndexMode, TableMode}; use crate::{common::INDEX_COLUMN_NAME, NuTable}; -use nu_color_config::StyleComputer; -use nu_protocol::{Config, FooterMode, Signals, Span, TableIndexMode, TableMode}; mod collapse; mod expanded; @@ -16,16 +15,16 @@ pub struct TableOutput { pub table: NuTable, pub with_header: bool, pub with_index: bool, - pub with_footer: bool, + pub count_rows: usize, } impl TableOutput { - pub fn new(table: NuTable, with_header: bool, with_index: bool, with_footer: bool) -> Self { + pub fn new(table: NuTable, with_header: bool, with_index: bool, count_rows: usize) -> Self { Self { table, with_header, with_index, - with_footer, + count_rows, } } } @@ -79,23 +78,3 @@ fn has_index(opts: &TableOpts<'_>, headers: &[String]) -> bool { with_index && !opts.index_remove } - -fn has_footer(opts: &TableOpts<'_>, count_records: u64) -> bool { - match opts.config.footer_mode { - // Only show the footer if there are more than RowCount rows - FooterMode::RowCount(limit) => count_records > limit, - // Always show the footer - FooterMode::Always => true, - // Never show the footer - FooterMode::Never => false, - // Calculate the screen height and row count, if screen height is larger than row count, don't show footer - FooterMode::Auto => { - let (_width, height) = match terminal_size() { - Some((w, h)) => (Width(w.0).0 as u64, Height(h.0).0 as u64), - None => (Width(0).0 as u64, Height(0).0 as u64), - }; - - height <= count_records - } - } -} diff --git a/crates/nu-utils/src/default_files/README.md b/crates/nu-utils/src/default_files/README.md new file mode 100644 index 0000000000..2269771bbd --- /dev/null +++ b/crates/nu-utils/src/default_files/README.md @@ -0,0 +1,82 @@ +# Nushell configuration files + +## `default_env.nu`: + +* The internal default environment variables (other than `$env.config`) that will be set during Nushell startup. +* Is loaded *before* the user's `env.nu`. +* Will be loaded during any startup where the user's `env.nu` is also loaded. For example: + * During normal startup with `nu` + * During a startup where the user specifies an alternative `env.nu` via `nu --env-config ` +* Likewise, is never loaded during a startup where the user's `env.nu` would not be loaded. For example: + * `nu -n/--no-config` + * `nu -c "ls"` + * `nu ` +* Is not commented - Comments are in `sample_env.nu`. +* Should be optimized for fastest load times. +* Can be introspected via `config env --default | nu-highlight` + +## `default_config.nu`: + +Counterpart to `default_env.nu`. + +* Contains any `$env.config` values that are not set via Rust defaults. +* Is loaded *after* the user's `env.nu`. +* Is loaded *before* the user's `config.nu`. +* Will be loaded during any startup where the user's `config.nu` is also loaded. For example: + * During normal startup with `nu` + * During a startup where the user specifies an alternative `config.nu` via `nu --config ` +* Likewise, is never loaded during a startup where the user's `config.nu` would not be loaded. For example: + * `nu -n/--no-config` + * `nu -c "ls"` + * `nu ` +* Is not commented - Comments are in `sample_config.nu`. +* Should be optimized for fastest load times. Whenever possible, values should be set via nu-protocol::config + * Exception: `color_config` values are currently set in this file so that user's can introspect the values + * TODO: Implement defaults for `color_config` in nu-protocol::config and remove from `default_config.nu` +* Can be introspected via `config nu --default | nu-highlight` +* An ideal `default_config.nu` (when all values are set via `nu-protocol::config`) will simply be: + ``` + $env.config = {} + ``` + +## `sample_env.nu` + +* A commented file documenting the most common environment variables that a user might configure in `env.nu` +* For convenient in-shell access +* Can be pretty-printed via `config env --sample | nu-highlight` +* Since this file is for documentation only, include actual Nushell code without comments so that it can be pretty-printed +* No optimization necessary - Not intended for use other than documentation. +* Consider replacing `config env --sample` with `help env.nu` at some point. +* Uses a mix of default values (explained) as well as other examples that users might want in their own `env.nu` + +## `sample_config.nu` + +Counterpart to `sample_env.nu`. + +TODO: **Not in final form** + +* A commented file documenting the most common environment variables that a user might configure in `config.nu` +* For convenient in-shell access +* Can be pretty-printed via `config nu --sample | nu-highlight` +* Since this file is for documentation only, include actual Nushell code without comments so that it can be pretty-printed +* No optimization necessary - Not intended for use other than documentation. +* Consider replacing `config nu --sample` with `help config.nu` at some point. +* Uses a mix of default values (explained) as well as other examples that users might want in their own `config.nu` + +## `scaffold_env.nu` + +* This file is used *one-time* (typically) at **first** startup +* If the `$nu.default-config-path` directory does not exist, the directory is created and then both `scaffold_env.nu` and `scaffold_config.nu` are written to it +* Contains only commented lines explaining the purpose of the file to the user, along with information on the `config env` command. + +## `scaffold_config.nu` + +Counterpart to `scaffold_env.nu`. + +* This file is used *one-time* (typically) at **first** startup +* If the `$nu.default-config-path` directory does not exist, the directory is created and then both `scaffold_env.nu` and `scaffold_config.nu` are written to it +* Contains only commented lines explaining the purpose of the file to the user, along with information on the `config nu` command. + +## `sample_login.nu` + +This file is not used by any Nushell code. Of course, if the user has a `login.nu`, then it will be evaluated during startup of a login shell. \ No newline at end of file diff --git a/crates/nu-utils/src/default_files/default_config.nu b/crates/nu-utils/src/default_files/default_config.nu new file mode 100644 index 0000000000..d95f4b3f97 --- /dev/null +++ b/crates/nu-utils/src/default_files/default_config.nu @@ -0,0 +1,63 @@ +# Nushell Config File +# +# version = "0.100.1" +$env.config.color_config = { + separator: white + leading_trailing_space_bg: { attr: n } + header: green_bold + empty: blue + bool: light_cyan + int: white + filesize: cyan + duration: white + date: purple + range: white + float: white + string: white + nothing: white + binary: white + cell-path: white + row_index: green_bold + record: white + list: white + block: white + hints: dark_gray + search_result: { bg: red fg: white } + shape_and: purple_bold + shape_binary: purple_bold + shape_block: blue_bold + shape_bool: light_cyan + shape_closure: green_bold + shape_custom: green + shape_datetime: cyan_bold + shape_directory: cyan + shape_external: cyan + shape_externalarg: green_bold + shape_external_resolved: light_yellow_bold + shape_filepath: cyan + shape_flag: blue_bold + shape_float: purple_bold + shape_glob_interpolation: cyan_bold + shape_globpattern: cyan_bold + shape_int: purple_bold + shape_internalcall: cyan_bold + shape_keyword: cyan_bold + shape_list: cyan_bold + shape_literal: blue + shape_match_pattern: green + shape_matching_brackets: { attr: u } + shape_nothing: light_cyan + shape_operator: yellow + shape_or: purple_bold + shape_pipe: purple_bold + shape_range: yellow_bold + shape_record: cyan_bold + shape_redirection: purple_bold + shape_signature: green_bold + shape_string: green + shape_string_interpolation: cyan_bold + shape_table: blue_bold + shape_variable: purple + shape_vardecl: purple + shape_raw_string: light_purple +} \ No newline at end of file diff --git a/crates/nu-utils/src/default_files/default_env.nu b/crates/nu-utils/src/default_files/default_env.nu new file mode 100644 index 0000000000..498c9670b3 --- /dev/null +++ b/crates/nu-utils/src/default_files/default_env.nu @@ -0,0 +1,57 @@ +# Default Nushell Environment Config File +# These "sensible defaults" are set before the user's `env.nu` is loaded +# +# version = "0.100.1" + +$env.PROMPT_COMMAND = {|| + let dir = match (do --ignore-shell-errors { $env.PWD | path relative-to $nu.home-path }) { + null => $env.PWD + '' => '~' + $relative_pwd => ([~ $relative_pwd] | path join) + } + + let path_color = (if (is-admin) { ansi red_bold } else { ansi green_bold }) + let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold }) + let path_segment = $"($path_color)($dir)(ansi reset)" + + $path_segment | str replace --all (char path_sep) $"($separator_color)(char path_sep)($path_color)" +} + +$env.PROMPT_INDICATOR = "> " +$env.PROMPT_INDICATOR_VI_NORMAL = "> " +$env.PROMPT_INDICATOR_VI_INSERT = ": " +$env.PROMPT_MULTILINE_INDICATOR = "::: " + +$env.PROMPT_COMMAND_RIGHT = {|| + # create a right prompt in magenta with green separators and am/pm underlined + let time_segment = ([ + (ansi reset) + (ansi magenta) + (date now | format date '%x %X') # try to respect user's locale + ] | str join | str replace --regex --all "([/:])" $"(ansi green)${1}(ansi magenta)" | + str replace --regex --all "([AP]M)" $"(ansi magenta_underline)${1}") + + let last_exit_code = if ($env.LAST_EXIT_CODE != 0) {([ + (ansi rb) + ($env.LAST_EXIT_CODE) + ] | str join) + } else { "" } + + ([$last_exit_code, (char space), $time_segment] | str join) +} + +$env.ENV_CONVERSIONS = { + "PATH": { + from_string: { |s| $s | split row (char esep) | path expand --no-symlink } + to_string: { |v| $v | path expand --no-symlink | str join (char esep) } + } +} + +$env.NU_LIB_DIRS = [ + ($nu.default-config-dir | path join 'scripts') # add /scripts + ($nu.data-dir | path join 'completions') # default home for nushell completions +] + +$env.NU_PLUGIN_DIRS = [ + ($nu.default-config-dir | path join 'plugins') # add /plugins +] \ No newline at end of file diff --git a/crates/nu-utils/src/default_files/sample_config.nu b/crates/nu-utils/src/default_files/sample_config.nu new file mode 100644 index 0000000000..5a8181506c --- /dev/null +++ b/crates/nu-utils/src/default_files/sample_config.nu @@ -0,0 +1,792 @@ +# Nushell Config File +# +# version = "0.99.2" +# +# A `config.nu` file is used to override default Nushell settings, +# define (or import) custom commands, or run any other startup tasks. +# See https://www.nushell.sh/book/configuration.html +# +# Nushell sets "sensible defaults" for most configuration settings, so +# the user's `config.nu` only needs to override these defaults if +# desired. +# +# This file serves as simple "in-shell" documentation for these +# settings, or you can view a more complete discussion online at: +# https://nushell.sh/book/configuration +# +# You can pretty-print and page this file using: +# config nu --sample | nu-highlight | less -R + +# $env.config +# ----------- +# The $env.config environment variable is a record containing most Nushell +# configuration settings. Keep in mind that, as a record, setting it to a +# new record will remove any keys which aren't in the new record. Nushell +# will then automatically merge in the internal defaults for missing keys. +# +# The same holds true for keys in the $env.config which are also records +# or lists. +# +# For this reason, settings are typically changed by updating the value of +# a particular key. Merging a new config record is also possible. See the +# Configuration chapter of the book for more information. + +# ------------------------ +# History-related settings +# ------------------------ +# $env.config.history.* + +# file_format (string): Either "sqlite" or "plaintext". While text-backed history +# is currently the default for historical reasons, "sqlite" is stable and +# provides more advanced history features. +$env.config.history.file_format = "sqlite" + +# max_size (int): The maximum number of entries allowed in the history. +# After exceeding this value, the oldest history items will be removed +# as new commands are added. +$env.config.history.max_size = 5_000_000 + +# sync_on_enter (bool): Whether the plaintext history file is updated +# each time a command is entered. If set to `false`, the plaintext history +# is only updated/written when the shell exits. This setting has no effect +# for SQLite-backed history. +$env.config.history.sync_on_enter = true + +# isolation (bool): +# `true`: New history from other currently-open Nushell sessions is not +# seen when scrolling through the history using PrevHistory (typically +# the Up key) or NextHistory (Down key) +# `false`: All commands entered in other Nushell sessions will be mixed with +# those from the current shell. +# Note: Older history items (from before the current shell was started) are +# always shown. +# This setting only applies to SQLite-backed history +$env.config.history.isolation = true + +# ---------------------- +# Miscellaneous Settings +# ---------------------- + +# show_banner (bool): Enable or disable the welcome banner at startup +$env.config.show_banner = true + +# rm.always_trash (bool): +# true: rm behaves as if the --trash/-t option is specified +# false: rm behaves as if the --permanent/-p option is specified (default) +# Explicitly calling `rm` with `--trash` or `--permanent` always override this setting +# Note that this feature is dependent on the host OS trashcan support. +$env.config.rm.always_trash = false + +# recursion_limit (int): how many times a command can call itself recursively +# before an error will be generated. +$env.config.recursion_limit = 50 + +# --------------------------- +# Commandline Editor Settings +# --------------------------- + +# edit_mode (string) "vi" or "emacs" sets the editing behavior of Reedline +edit_mode: "emacs" + +# Command that will be used to edit the current line buffer with Ctrl+O. +# If unset, uses $env.VISUAL and then $env.EDITOR +# +# Tip: Set to "editor" to use the default editor on Unix platforms using +# the Alternatives system or equivalent +buffer_editor: "editor" + +# cursor_shape_* (string) +# ----------------------- +# The following variables accept a string from the following selections: +# "block", "underscore", "line", "blink_block", "blink_underscore", "blink_line", or "inherit" +# "inherit" skips setting cursor shape and uses the current terminal setting. +$env.config.cursor_shape.emacs = "inherit" # Cursor shape in emacs mode +$env.config.cursor_shape.vi_insert = "block" # Cursor shape in vi-insert mode +$env.config.cursor_shape.vi_normal = "underscore" # Cursor shape in normal vi mode + +# -------------------- +# Completions Behavior +# -------------------- +# $env.config.completions.* +# Apply to the Nushell completion system + +# algorithm (string): Either "prefix" or "fuzzy" +$env.config.completions.algorithm = "prefix" + +# sort (string): One of "smart" or "alphabetical" +# In "smart" mode sort order is based on the "algorithm" setting. +# When using the "prefix" algorithm, results are alphabetically sorted. +# When using the "fuzzy" algorithm, results are sorted based on their fuzzy score. +$env.config.completions.sort = "smart" + +# case_sensitive (bool): true/false to enable/disable case-sensitive completions +$env.config.completions.case_sensitive = false + +# quick (bool): +# true: auto-select the completion when only one remains +# false: prevents auto-select of the final result +$env.config.completions.quick = true + +# partial (bool): +# true: Partially complete up to the best possible match +# false: Do not partially complete +# Partial Example: If a directory contains only files named "forage", "food", and "forest", +# then typing "ls " and pressing will partially complete the first two +# letters, "f" and "o". If the directory also includes a file named "faster", +# then only "f" would be partially completed. +$env.config.completions.partial = true + +# use_ls_colors (bool): When true, apply LS_COLORS to file/path/directory matches +$env.config.completions.use_ls_colors = true + +# -------------------- +# External Completions +# -------------------- +# completions.external.*: Settings related to completing external commands +# and additional completers + +# external.exnable (bool) +# true: search for external commands on the Path +# false: disabling might be desired for performance if your path includes +# directories on a slower filesystem +$env.config.completions.external.enable = true + +# max_results (int): Limit the number of external commands retrieved from +# path to this value. Has no effect if `...external.enable` (above) is set to `false` +$env.config.completions.external.max_results = 50 + +# completer (closure with a |spans| parameter): A command to call for *argument* completions +# to commands (internal or external). +# +# The |spans| parameter is a list of strings representing the tokens (spans) +# on the current commandline. It is always a list of at least two strings - The +# command being completed plus the first argument of that command ("" if no argument has +# been partially typed yet), and additional strings for additional arguments beyond +# the first. +# +# This setting is usually set to a closure which will call a third-party completion system, such +# as Carapace. +# +# Note: The following is an over-simplified completer command that will call Carapace if it +# is installed. Please use the official Carapace completer, which can be generated automatically +# by Carapace itself. See the Carapace documentation for the proper syntax. +$env.config.completions.external.completer = {|spans| + carapace $spans.0 nushell ...$spans | from json +} + +# -------------------- +# Terminal Integration +# -------------------- +# Nushell can output a number of escape codes to enable advanced features in Terminal Emulators +# that support them. Settings in this section enable or disable these features in Nushell. +# Features aren't supported by your Terminal can be disabled. Features can also be disabled, +# of course, if there is a conflict between the Nushell and Terminal's implementation. + +# use_kitty_protocol (bool): +# A keyboard enhancement protocol supported by the Kitty Terminal. Additional keybindings are +# available when using this protocol in a supported terminal. For example, without this protocol, +# Ctrl+I is interpreted as the Tab Key. With this protocol, Ctrl+I and Tab can be mapped separately. +$env.config.use_kitty_protocol = false + +# osc2 (bool): +# When true, the current directory and running command are shown in the terminal tab/window title. +# Also abbreviates the directory name by prepending ~ to the home directory and its subdirectories. +$env.config.shell_integration.osc2 = true + +# osc7 (bool): +# Nushell will report the current directory to the terminal using OSC 7. This is useful when +# spawning new tabs in the same directory. +$env.config.shell_integration.osc7 = true + +# osc9_9 (bool): +# Enables/Disables OSC 9;9 support, originally a ConEmu terminal feature. This is an +# alternative to OSC 7 which also communicates the current path to the terminal. +$env.config.shell_integration.osc9_9 = false + +# osc8 (bool): +# When true, the `ls` command will generate clickable links that can be launched in another +# application by the terminal. +# Note: This setting replaces the now deprecated `ls.show_clickable_links` +$env.config.shell.integration.osc8: true + +# Deprecated +# $env.config.ls.clickable_links = true + +# osc133 (bool): +# true/false to enable/disable OSC 133 support, a set of several escape sequences which +# report the (1) starting location of the prompt, (2) ending location of the prompt, +# (3) starting location of the command output, and (4) the exit code of the command. + +# originating with Final Term. These sequences report information regarding the prompt +# location as well as command status to the terminal. This enables advanced features in +# some terminals, including the ability to provide separate background colors for the +# command vs. the output, collapsible output, or keybindings to scroll between prompts. +$env.config.shell_integration.osc133 = true + +# osc633 (bool): +# true/false to enable/disable OSC 633, an extension to OSC 133 for Visual Studio Code +$env.config.shell_integration.osc633 = true + +# reset_application_mode (bool): +# true/false to enable/disable sending ESC[?1l to the terminal +# This sequence is commonly used to keep cursor key modes in sync between the local +# terminal and a remove SSH host. +$env.config.shell_integration.reset_application_mode = true + +# bracketed_paste (bool): +# true/false to enable/disable the bracketed-paste feature, which allows multiple-lines +# to be pasted into Nushell at once without immediate execution. When disabled, +# each pasted line is executed as it is received. +# Note that bracketed paste is not currently supported on the Windows version of +# Nushell. +$env.config.bracketed_paste = true + +# use_ansi_coloring (bool): +# true/false to enable/disable the use of ANSI colors in Nushell internal commands. +# When disabled, output from Nushell built-in commands will display only in the default +# foreground color. +# Note: Does not apply to the `ansi` command. +$env.config.use_ansi_coloring = true + +# ---------------------- +# Error Display Settings +# ---------------------- + +# error_style (string): One of "fancy" or "plain" +# Plain: Display plain-text errors for screen-readers +# Fancy: Display errors using line-drawing characters to point to the span in which the +# problem occurred. +$env.config.error_style = "fancy" + +# display_errors.exit_code (bool): +# true: Display a Nushell error when an external command returns a non-zero exit code +# false: Display only the error information printed by the external command itself +# Note: Core dump errors are always printed; SIGPIPE never triggers an error +$env.config.display_errors.exit_code = false + +# display_errors.termination_signal (bool): +# true/false to enable/disable displaying a Nushell error when a child process is +# terminated via any signal +$env.config.display_errors.termination_signal = true + +# ------------- +# Table Display +# ------------- +# footer_mode (string or int): +# Specifies when to display table footers with column names. Allowed values: +# "always" +# "never" +# "auto": When the length of the table would scroll the header past the first line of the terminal +# (int): When the number of table rows meets or exceeds this value +# Note: Does not take into account rows with multiple lines themselves +$env.config.footer_mode = 25 + +# table.* +# table_mode (string): +# One of: "default", "basic", "compact", "compact_double", "heavy", "light", "none", "reinforced", +# "rounded", "thin", "with_love", "psql", "markdown", "dots", "restructured", "ascii_rounded", +# or "basic_compact" +# Can be overridden by passing a table to `| table --theme/-t` +$env.config.table.mode = "default" + +# index_mode (string) - One of: +# "never": never show the index column in a table or list +# "always": always show the index column in tables and lists +# "auto": show the column only when there is an explicit "index" column in the table +# Can be overridden by passing a table to `| table --index/-i` +$env.config.table.index_mode = "always" + +# show_empty (bool): +# true: show "empty list" or "empty table" when no values exist +# false: display no output when no values exist +$env.config.table.show_empty = true + +# padding.left/right (int): The number of spaces to pad around values in each column +$env.config.table.padding.left = 1 +$env.config.table.padding.right = 1 + +# trim.*: The rules that will be used to display content in a table row when it would cause the +# table to exceed the terminal width. +# methodology (string): One of "wrapping" or "truncating" +# truncating_suffix (string): The text to show at the end of the row to indicate that it has +# been truncated. Only valid when `methodology = "truncating"`. +# wrapping_try_keep_words (bool): true to keep words together based on whitespace +# false to allow wrapping in the middle of a word. +# Only valid when `methodology = wrapping`. +$env.config.table.trim = { + methodology: "wrapping" + wrapping_try_keep_words: true +} +# or +$env.config.table.trim = { + methodology: "truncating" + truncating_suffix: "..." +} + +# header_on_separator (bool): +# true: Displays the column headers as part of the top (or bottom) border of the table +# false: Displays the column header in its own row with a separator below. +$env.config.table.header_on_separator = false + +# abbreviated_row_count (int or nothing): +# If set to an int, all tables will be abbreviated to only show the first and last rows +# If set to `null`, all table rows will be displayed +# Can be overridden by passing a table to `| table --abbreviated/-a` +$env.config.table.abbreviated_row_count + +# footer_inheritance (bool): Footer behavior in nested tables +# true: If a nested table is long enough on its own to display a footer (per `footer_mode` above), +# then also display the footer for the parent table +# false: Always apply `footer_mode` rules to the parent table +$env.config.table.footer_inheritance = false + +# ---------------- +# Datetime Display +# ---------------- +# datetime_format.* (string or nothing): +# Format strings that will be used for datetime values. +# When set to `null`, the default behavior is to "humanize" the value (e.g., "now" or "a day ago") + +# datetime_format.table (string or nothing): +# The format string (or `null`) that will be used to display a datetime value when it appears in a +# structured value such as a table, list, or record. +$env.config.datetime_format.table = null + +# datetime_format.normal (string or nothing): +# The format string (or `null`) that will be used to display a datetime value when it appears as +# a raw value. +$env.config.datetime_format.normal = "%m/%d/%y %I:%M:%S%p" + +# ---------------- +# Filesize Display +# ---------------- +# filesize.metric (bool): When displaying filesize values ... +# true: Use the ISO-standard KB, MB, GB +# false: Use the Windows-standard KiB, MiB, GiB +$env.config.filesize.metric = false + +# filesize.format (string): One of either: +# - The filesize units such as "KB", "KiB", etc. In this case, filesize values always display using +# this unit. +# - Or "auto": Filesizes are displayed using the closest unit. For example, 1_000_000_000b will display +# as 953.7 MiB (when `metric = false`) or 1.0GB (when `metric = true`) +$env.config.filesize.format = "auto" + +# --------------------- +# Miscellaneous Display +# --------------------- + +# render_right_prompt_on_last_line(bool): +# true: When using a multi-line left-prompt, the right-prompt will be displayed on the last line +# false: The right-prompt is displayed on the first line of the left-prompt +$env.config.render_right_prompt_on_last_line = false + +# float_precision (int): +# Float values will be rounded to this precision when displaying in structured values such as lists, +# tables, or records. +$env.config.float_precision = 2 + +# ls.use_ls_colors (bool): +# true: The `ls` command will apply the $env.LS_COLORS standard to filenames +# false: Filenames in the `ls` table will use the color_config for strings +$env.config.ls = true + +# Hooks +# ----- +# $env.config.hooks is a record containing the five different types of Nushell hooks. +# See the Hooks documentation at https://www.nushell.sh/book/hooks for details +# +# Most hooks can accept a string, a closure, or a list containing strings and/or closures. +# The display_output record can only accept a string or a closure, but never a list +# +# WARNING: A malformed display_output hook can suppress all Nushell output to the terminal. +# It can be reset by assigning an empty string as below: + +$env.config.hooks.pre_prompt = [] # Before each prompt is displayed +$env.config.hooks.pre_execution = [] # After is pressed; before the commandline + # is executed +$env.config.hooks.env_change = [] # When a specified environment variable changes +$env.config.hooks.display_output = "" # Before Nushell output is displayed in the terminal +$env.config.hooks.command_not_found = [] # When a command is not found + +# ----------- +# Keybindings +# ----------- +# keybindings (list): A list of user-defined keybindings +# Nushell/Reedline keybindings can be added or overridden using this setting. +# See https://www.nushell.sh/book/line_editor.html#keybindings for details. +# +# Example - Add a new Alt+. keybinding to insert the last token used on the previous commandline +$env.config.keybindings ++= [ + { + name: insert_last_token + modifier: alt + keycode: char_. + mode: [emacs vi_normal vi_insert] + event: [ + { edit: InsertString, value: "!$" } + { send: Enter } + ] + } +] + +# Example: Override the F1 keybinding with a user-defined help menu (see "Menus" below): +$env.config.keybindings ++= [ + { + name: help_menu + modifier: none + keycode: f1 + mode: [emacs, vi_insert, vi_normal] + event: { send: menu name: help_menu } + } +] + +# ----- +# Menus +# ----- +# menus (list): +# +# Nushell/Reedline menus can be created and modified using this setting. +# See https://www.nushell.sh/book/line_editor.html#menus for details. +# +# Note that menus are usually activated via keybindings, which are defined in +# $env.config.keybindings (above). +# +# Simple example - Add a new Help menu to the list (note that a similar menu is already +# defined internally): +$env.config.menus ++= [ + { + name: help_menu + only_buffer_difference: true + marker: "? " + type: { + layout: description + columns: 4 + col_width: 20 # Optional value. If missing all the screen width is used to calculate column width + col_padding: 2 + selection_rows: 4 + description_rows: 10 + } + style: { + text: green + selected_text: green_reverse + description_text: yellow + } + } +] + + +# --------------- +# Plugin behavior +# --------------- +# Per-plugin configuration. See https://www.nushell.sh/contributor-book/plugins.html#configuration. +plugins: {} +$env.config.plugins +$env.config.plugin_gc +$env.config.plugin_gc.default +$env.config.plugin_gc.default.enabled +$env.config.plugin_gc.default.stop_after +$env.config.plugin_gc.plugins + plugin_gc: { + # Configuration for plugin garbage collection + default: { + enabled: true # true to enable stopping of inactive plugins + stop_after: 10sec # how long to wait after a plugin is inactive to stop it + } + plugins: { + # alternate configuration for specific plugins, by name, for example: + # + # gstat: { + # enabled: false + # } + } + } + + +# ------------------------------------- +# Themes/Colors and Syntax Highlighting +# ------------------------------------- +# For more information on defining custom themes, see +# https://www.nushell.sh/book/coloring_and_theming.html + +# Use and/or contribute to the theme collection at +# https://github.com/nushell/nu_scripts/tree/main/themes + +# Values: + +# highlight_resolved_externals (bool): +# true: Applies the `color_config.shape_external_resolved` color (below) to external commands +# which are found (resolved) on the path +# false: Applies the `color_config.shape_external` color to *all* externals simply based on whether +# or not they would be *parsed* as an external command based on their position. +# Defaults to false for systems with a slower search path +$env.config.highlight_resolved_externals = true + +# color_config (record): A record of shapes, types, UI elements, etc. that can be styled (e.g., +# colorized) in Nushell, either on the commandline itself (shapes) or in output. +# +# Note that this is usually set through a theme provided by a record in a custom command. For +# instance, the standard library contains two "starter" theme commands: "dark-theme" and +# "light-theme". For example: +use std/config dark-theme +$env.config.color_config = (dark-theme) + +# Or, individual color settings can be configured or overridden. +# +# Values can be one of: +# - A color name such as "red" (see `ansi -l` for a list) +# - A color RGB value in the form of "#C4C9C6" +# - A record including: +# * `fg` (color) +# * `bg` (color) +# * `attr`: a string with one or more of: +# - 'n': normal +# - 'b': bold +# - 'u': underline +# - 'r': reverse +# - 'i': italics +# - 'd': dimmed + +# foreground, background, and cursor colors are not handled by Nushell, but can be used by +# custom-commands such as `theme` from the nu_scripts repository. That `theme` command can be +# used to set the terminal foreground, background, and cursor colors. +$env.config.color_config.foreground +$env.config.color_config.background +$env.config.color_config.cursor + +# ------------------------------------------------------------------------------------------------- +# shape_: Applies syntax highlighting based on the "shape" (inferred or declared type) of an +# element on the commandline. Nushell's parser can identify shapes based on many criteria, often +# as the commandline is being typed. + +# shape_string: Can appear as a single-or-quoted value, a bareword string, the key of a record, +# an argument which has been declared as a string, and other parsed strings. +$env.config.color_config.shape_string + +# shape_string_interpolation: A single-or-double-quoted string interpolation. This style +# applies to the dollar sign and quotes of the string. The elements inside the string are +# styled according to their own shape. +$env.config.color_config.shape_string_interpolation + +# shape_raw_string: a raw string literal. E.g., r#'This is a raw string'#. This style applies +# to the entire raw string. +$env.config.color_config.shape_raw_string + +# shape_record: A record-literal. This style applies to the brackets around the record. The keys +# and values will be styled according to their individual shapes. +$env.config.color_config.shape_record + +# shape_list: A list-literal. This style applies to the brackets and list separator only. The +# items in a list are styled according to their individual shapes. +$env.config.color_config.shape_list + +# shape_table: A table-literl. Color applies to the brackets, semicolon, and list separators. The +# items in the table are style according to their individual shapes. +$env.config.color_config.shape_table + +# shape_bool: A boolean-literal `true` or `false` value +$env.config.color_config.shape_bool + +# shape_int: Integer literals +$env.config.color_config.shape_int + +# shape_float: Float literals. E.g., 5.4 +# Also integer literals in a float-argument position +$env.config.color_config.shape_float + +# shape_range: Range literals +$env.config.color_config.shape_range + +# shape_binary: Binary literals +$env.config.color_config.shape_binary + +# shape_datetime: Datetime literals +$env.config.color_config.shape_datetime + +# shape_custom: A custom value, usually from a plugin +$env.config.color_config.shape_custom + +# shape_nothing: A literal `null` +$env.config.color_config.shape_nothing + +# shape_literal: Not currently used +$env.config.color_config.shape_literal + +# shape_operator: An operator such as +, -, ++, in, not-in, etc. +$env.config.color_config.shape_operator + +# shape_filepath: An argument that appears in the position of a `path` shape for a command +$env.config.color_config.shape_filepath + +# shape_directory: A more specific 'path' shape that only accepts a directory. +$env.config.color_config.shape_directory + +# shape_globpattern: An argument in the position of a glob parameter. E.g., the asterisk (or any other string) in `ls *`. +$env.config.color_config.shape_globpattern + +# shape_glob_interpolation: Deprecated +$env.config.color_config.shape_glob_interpolation + +# shape_garbage: When an argument is of the wrong type or cannot otherwise be parsed. +# E.g., `ls {a: 5}` - A record argument to `ls` is 'garbage'. Also applied in real-time when +# an expression is not (yet) properly closed. +$env.config.color_config.shape_garbage + +# shape_or and shape_and: The and and or operators. +# Note: Not currently implemented. +$env.config.color_config.shape_or +$env.config.color_config.shape_and + +# shape_variable: The *use* of a variable. E.g., `$env` or `$a`. +$env.config.color_config.shape_variable + +# shape_vardecl: The *declaration* of a variable. E.g. the "a" in `let a = 5`. +$env.config.color_config.shape_vardecl + +# shape_matching_brackets: When the cursor is positioned on an opening or closing bracket (e.g, +# braces, curly braces, or parenthesis), and there is a matching opening/closing bracket, both will +# temporarily have this style applied. +$env.config.color_config.shape_matching_brackets + +# shape_pipe: The pipe `|` when used to separate expressions in a pipeline +$env.config.color_config.shape_pipe + +# shape_internalcall: A known Nushell built-in or custom command in the "command position" (usually +# the first bare word of an expression). +$env.config.color_config.shape_internalcall + +# shape_external: A token in the "command position" (see above) that is not a known Nushell +# built-in or custom command. This is assumed to be an external command. +$env.config.color_config.shape_external + +# shape_external_resolved: Requires "highlight_resolved_externals" (above) to be enabled. +# When a token matches the "external" requirement (above) and is also a *confirmed* external +# command, this style will be applied. +$env.config.color_config.shape_external_resolved + +# shape_externalarg: Arguments to an external command (whether resolved or not) +$env.config.color_config.shape_externalarg + +# shape_match_pattern: The matching pattern for each arm in a match expression. Does not +# include the guard expression (if present). +$env.config.color_config.shape_match_pattern + +# shape_block: The curly-braces around a block. Expressions within the block will have their +# their own shapes' styles applied. +$env.config.color_config.shape_block + +# shape_signature: The parameter definitions and input/output types for a command signature. +$env.config.color_config.shape_signature + +# shape_keyword: Not current used +$env.config.color_config.shape_keyword + +# shape_closure: Styles the brackets and arguments of a closure. +$env.config.color_config.shape_closure + +# shape_direction: The redirection symbols such as `o>`, `error>`, `e>|`, etc. +$env.config.color_config.shape_redirection + +# shape_flag: Flags and switches to internal and custom-commands. Only the `--flag` (`-f`) portion +# is styled. The argument to a flag will be styled using its own shape. +$env.config.color_config.shape_flag + +# ------------------------------------------------------------------------------------------------- +# color.config. +# *Values* of a particular *type* can be styled differently than the *shape*. +# Note that the style is applied only when this type is displayed in *structured* data (list, +# record, or table). It is not currently applied to basic raw values. +# +# Note that some types are rarely or never seen in a context in which styling would be applied. +# For example, a cell-path *value* is unlikely to (but can) appear in a list, record, or table. +# +# Tip: In addition to the styles above (fg, bg, attr), types typically accept a closure which can +# dynamically change the style based on the *value*. For instance, the themes in the nu_scripts +# repository will style filesizes difference in an `ls` (or other table) differently depending on +# their magnitude. + +# Simple examples: + +# bool: A boolean value +$env.config.color_config.bool = {|| + if $in { + { + bg: 'light_green' + fg: 'white' + attr: 'b' + } + } else { + { + bg: 'yellow' + fg: 'black' + attr: 'b' + } + } +} + +# int: An integer value +$env.config.color_config.int = {|| + if $in == 42 { 'green' } else { 'red' } +} + +# Additional type values (without examples): +$env.config.color_config.string # String +$env.config.color_config.float # Float value +$env.config.color_config.glob # Glob value (must be declared) +$env.config.color_config.binary # Binary value +$env.config.color_config.custom # Custom value (often from a plugin) +$env.config.color_config.nothing # Not used, since a null is not displayed +$env.config.color_config.date # datetime value +$env.config.color_config.filesize # filesize value +$env.config.color_config.list # Not currently used. Lists are displayed using their + # members' styles +$env.config.color_config.record # Not currently used. Records are displayed using their + # member's styles +$env.config.color_config.duration # Duration type +$env.config.color_config.range # Range value +$env.config.color_config.cell-path # Cell-path value +$env.config.color_config.closure # Not currently used +$env.config.color_config.block # Not currently used + +# Additional UI elements +# hints: The (usually dimmed) style in which completion hints are displayed +$env.config.color_config.hints + +# search_result: The style applied to `find` search results +$env.config.color_config.search_result + +# header: The column names in a table header +$env.config.color_config.header + +# separator: Used for table/list/record borders +$env.config.color_config.separator + +# row_index: The `#` or `index` column of a table or list +$env.config.color_config.row_index + +# empty: This style is applied to empty/missing values in a table. However, since the ❎ +# emoji is used for this purpose, there is limited styling that can be applied. +$env.config.color_config.empty + +# leading_trailing_space_bg: When a string value inside structured data has leading or trailing +# whitespace, that whitespace will be displayed using this style. +# Use { attr: n } to disable. +$env.config.color_config.leading_trailing_space_bg = { bg: 'red' } + +# ------------------------ +# `explore` command colors +# ------------------------ +# Configure the UI colors of the `explore` command +# Allowed values are the same as for the `color_config` options above. +# Example: +$env.config.explore = { + status_bar_background: { fg: "#1D1F21", bg: "#C4C9C6" }, + command_bar_text: { fg: "#C4C9C6" }, + highlight: { fg: "black", bg: "yellow" }, + status: { + error: { fg: "white", bg: "red" }, + warn: {} + info: {} + }, + selected_cell: { bg: light_blue }, +} diff --git a/crates/nu-utils/src/default_files/sample_env.nu b/crates/nu-utils/src/default_files/sample_env.nu new file mode 100644 index 0000000000..84926abb2f --- /dev/null +++ b/crates/nu-utils/src/default_files/sample_env.nu @@ -0,0 +1,135 @@ +# Sample Nushell Environment Config File +# +# Environment variables are usually configured in `env.nu`. Nushell +# sets sensible defaults for many environment variables, so the user's +# `env.nu` only needs to override these defaults if desired. +# +# This file serves as simple "in-shell" documentation for these +# settings, or you can view a more complete discussion online at: +# https://nushell.sh/book/configuration +# +# You can pretty-print and page this file using: +# config env --sample | nu-highlight | less -R + +# PROMPT_* +# -------- +# Prompt configuration +# PROMPT_ variables accept either a string or a closure that returns a string + +# PROMPT_COMMAND +# -------------- +# Defines the primary prompt. Note that the PROMPT_INDICATOR (below) is appended to this value. +# Simple example - Static string: +$env.PROMPT_COMMAND = "Nushell" +# Simple example - Dynamic closure displaying the path: +$env.PROMPT_COMMAND = {|| pwd} + +# PROMPT_INDICATOR* +# ----------------- +# The prompt indicators are environmental variables that represent +# the state of the prompt. The specified character(s) will appear +# immediately following the PROMPT_COMMAND + +# When in Emacs mode (default): +$env.PROMPT_INDICATOR = "> " + +# When in normal vi mode: +$env.PROMPT_INDICATOR_VI_NORMAL = "> " +# When in vi insert-mode: +$env.PROMPT_INDICATOR_VI_INSERT = ": " + +# When a commandline extends across multiple lines: +$env.PROMPT_MULTILINE_INDICATOR = "::: " + +# TRANSIENT_PROMPT_* +# ------------------ +# Allows a different prompt to be shown after a command has been executed. This +# can be useful if you have a 2-line prompt. Instead of each previously-entered +# command taking up at least 2 lines, the transient prompt can condense it to a +# shorter version. The following example shows a rocket emoji before each +# previously-entered command: +$env.TRANSIENT_PROMPT_COMMAND = "🚀 " +$env.TRANSIENT_PROMPT_INDICATOR = "" +$env.TRANSIENT_PROMPT_INDICATOR_VI_INSERT = "" +$env.TRANSIENT_PROMPT_INDICATOR_VI_NORMAL = "" +# Tip: Removing the transient multiline indicator and right-prompt can simplify +# copying from the terminal +$env.TRANSIENT_PROMPT_MULTILINE_INDICATOR = "" +$env.TRANSIENT_PROMPT_COMMAND_RIGHT = "" + +# ENV_CONVERSIONS +# --------------- +# Certain variables, such as those containing multiple paths, are often stored as a +# colon-separated string in other shells. Nushell can convert these automatically to a +# more convenient Nushell list. The ENV_CONVERSIONS variable specifies how environment +# variables are: +# - converted from a string to a value on Nushell startup (from_string) +# - converted from a value back to a string when running external commands (to_string) +# +# Note: The OS Path variable is automatically converted before env.nu loads, so it can +# be treated a list in this file. +# +# Note: Environment variables are not case-sensitive, so the following will work +# for both Windows and Unix-like platforms. +# +# By default, the internal conversion looks something like the following, so there +# is no need to add this in your actual env.nu: +$env.ENV_CONVERSIONS = { + "Path": { + from_string: { |s| $s | split row (char esep) | path expand --no-symlink } + to_string: { |v| $v | path expand --no-symlink | str join (char esep) } + } +} + +# Here's an example converts the XDG_DATA_DIRS variable to and from a list: +$env.ENV_CONVERSIONS = $env.ENV_CONVERSIONS | merge { + "XDG_DATA_DIRS": { + from_string: { |s| $s | split row (char esep) | path expand --no-symlink } + to_string: { |v| $v | path expand --no-symlink | str join (char esep) } + } +} +# +# Other common directory-lists for conversion: TERMINFO_DIRS. +# Note that other variable conversions take place after `config.nu` is loaded. + +# NU_LIB_DIRS +# ----------- +# Directories in this environment variable are searched by the +# `use` and `source` commands. +# +# By default, the `scripts` subdirectory of the default configuration +# directory is included: +$env.NU_LIB_DIRS = [ + ($nu.default-config-dir | path join 'scripts') # add /scripts + ($nu.data-dir | path join 'completions') # default home for nushell completions +] +# You can replace (override) or append to this list: +$env.NU_LIB_DIRS ++= ($nu.default-config-dir | path join 'modules') + +# NU_PLUGIN_DIRS +# -------------- +# Directories to search for plugin binaries when calling register. + +# By default, the `plugins` subdirectory of the default configuration +# directory is included: +$env.NU_PLUGIN_DIRS = [ + ($nu.default-config-dir | path join 'plugins') # add /plugins +] + +# Appending to the OS path is a common configuration task. +# Because of the previous ENV_CONVERSIONS (performed internally +# before your env.nu loads), the path variable is a list that can +# be appended to using, for example: +$env.path ++= "~/.local/bin" + +# Or prepend using +$env.path = "~/.local/bin" ++ $env.path + +# The `path add` function from the Standard Library also provides +# a convenience method for prepending to the path: +use std/util "path add" +path add "~/.local/bin" +path add ($env.CARGO_HOME | path join "bin") + +# You can remove duplicate directories from the path using: +$env.PATH = ($env.PATH | uniq) diff --git a/crates/nu-utils/src/sample_config/sample_login.nu b/crates/nu-utils/src/default_files/sample_login.nu similarity index 100% rename from crates/nu-utils/src/sample_config/sample_login.nu rename to crates/nu-utils/src/default_files/sample_login.nu diff --git a/crates/nu-utils/src/default_files/scaffold_config.nu b/crates/nu-utils/src/default_files/scaffold_config.nu new file mode 100644 index 0000000000..7bf7ecc632 --- /dev/null +++ b/crates/nu-utils/src/default_files/scaffold_config.nu @@ -0,0 +1,19 @@ +# config.nu +# +# This file is used to override default Nushell settings, define +# (or import) custom commands, or run any other startup tasks. +# See https://www.nushell.sh/book/configuration.html +# +# This file is loaded after env.nu and before login.nu +# +# You can open this file in your default editor using: +# config nu +# +# To pretty-print a sample config.nu with documentation, run: +# config nu --sample | nu-highlight | less -R +# +# To pretty-print the default configuration values, run: +# config nu --default | nu-highlight | less -R +# +# You can remove these comments if you want or leave +# them for future reference. diff --git a/crates/nu-utils/src/default_files/scaffold_env.nu b/crates/nu-utils/src/default_files/scaffold_env.nu new file mode 100644 index 0000000000..a3ce3cab07 --- /dev/null +++ b/crates/nu-utils/src/default_files/scaffold_env.nu @@ -0,0 +1,18 @@ +# env.nu +# +# This file is typically used to add or override environment variables. +# See https://www.nushell.sh/book/configuration.html +# +# This file is loaded before config.nu and login.nu +# +# You can open this file in your default editor using: +# config env +# +# To pretty-print a sample env.nu with documentation, run: +# config env --sample | nu-highlight | less -R +# +# To pretty-print the default environment values, run: +# config env --default | nu-highlight | less -R +# +# You can remove these comments if you want or leave +# them for future reference. diff --git a/crates/nu-utils/src/lib.rs b/crates/nu-utils/src/lib.rs index 4b91d923db..413b5f8893 100644 --- a/crates/nu-utils/src/lib.rs +++ b/crates/nu-utils/src/lib.rs @@ -10,8 +10,9 @@ pub mod utils; pub use locale::get_system_locale; pub use utils::{ - enable_vt_processing, get_default_config, get_default_env, get_ls_colors, - stderr_write_all_and_flush, stdout_write_all_and_flush, + enable_vt_processing, get_default_config, get_default_env, get_ls_colors, get_sample_config, + get_sample_env, get_scaffold_config, get_scaffold_env, stderr_write_all_and_flush, + stdout_write_all_and_flush, }; pub use casing::IgnoreCaseExt; diff --git a/crates/nu-utils/src/sample_config/default_config.nu b/crates/nu-utils/src/sample_config/default_config.nu deleted file mode 100644 index c8b398b684..0000000000 --- a/crates/nu-utils/src/sample_config/default_config.nu +++ /dev/null @@ -1,899 +0,0 @@ -# Nushell Config File -# -# version = "0.100.1" - -# For more information on defining custom themes, see -# https://www.nushell.sh/book/coloring_and_theming.html -# And here is the theme collection -# https://github.com/nushell/nu_scripts/tree/main/themes -let dark_theme = { - # color for nushell primitives - separator: white - leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off - header: green_bold - empty: blue - # Closures can be used to choose colors for specific values. - # The value (in this case, a bool) is piped into the closure. - # eg) {|| if $in { 'light_cyan' } else { 'light_gray' } } - bool: light_cyan - int: white - filesize: cyan - duration: white - date: purple - range: white - float: white - string: white - nothing: white - binary: white - cell-path: white - row_index: green_bold - record: white - list: white - block: white - hints: dark_gray - search_result: { bg: red fg: white } - shape_and: purple_bold - shape_binary: purple_bold - shape_block: blue_bold - shape_bool: light_cyan - shape_closure: green_bold - shape_custom: green - shape_datetime: cyan_bold - shape_directory: cyan - shape_external: cyan - shape_externalarg: green_bold - shape_external_resolved: light_yellow_bold - shape_filepath: cyan - shape_flag: blue_bold - shape_float: purple_bold - # shapes are used to change the cli syntax highlighting - shape_garbage: { fg: white bg: red attr: b } - shape_glob_interpolation: cyan_bold - shape_globpattern: cyan_bold - shape_int: purple_bold - shape_internalcall: cyan_bold - shape_keyword: cyan_bold - shape_list: cyan_bold - shape_literal: blue - shape_match_pattern: green - shape_matching_brackets: { attr: u } - shape_nothing: light_cyan - shape_operator: yellow - shape_or: purple_bold - shape_pipe: purple_bold - shape_range: yellow_bold - shape_record: cyan_bold - shape_redirection: purple_bold - shape_signature: green_bold - shape_string: green - shape_string_interpolation: cyan_bold - shape_table: blue_bold - shape_variable: purple - shape_vardecl: purple - shape_raw_string: light_purple -} - -let light_theme = { - # color for nushell primitives - separator: dark_gray - leading_trailing_space_bg: { attr: n } # no fg, no bg, attr none effectively turns this off - header: green_bold - empty: blue - # Closures can be used to choose colors for specific values. - # The value (in this case, a bool) is piped into the closure. - # eg) {|| if $in { 'dark_cyan' } else { 'dark_gray' } } - bool: dark_cyan - int: dark_gray - filesize: cyan_bold - duration: dark_gray - date: purple - range: dark_gray - float: dark_gray - string: dark_gray - nothing: dark_gray - binary: dark_gray - cell-path: dark_gray - row_index: green_bold - record: dark_gray - list: dark_gray - block: dark_gray - hints: dark_gray - search_result: { fg: white bg: red } - shape_and: purple_bold - shape_binary: purple_bold - shape_block: blue_bold - shape_bool: light_cyan - shape_closure: green_bold - shape_custom: green - shape_datetime: cyan_bold - shape_directory: cyan - shape_external: cyan - shape_externalarg: green_bold - shape_external_resolved: light_purple_bold - shape_filepath: cyan - shape_flag: blue_bold - shape_float: purple_bold - # shapes are used to change the cli syntax highlighting - shape_garbage: { fg: white bg: red attr: b } - shape_glob_interpolation: cyan_bold - shape_globpattern: cyan_bold - shape_int: purple_bold - shape_internalcall: cyan_bold - shape_keyword: cyan_bold - shape_list: cyan_bold - shape_literal: blue - shape_match_pattern: green - shape_matching_brackets: { attr: u } - shape_nothing: light_cyan - shape_operator: yellow - shape_or: purple_bold - shape_pipe: purple_bold - shape_range: yellow_bold - shape_record: cyan_bold - shape_redirection: purple_bold - shape_signature: green_bold - shape_string: green - shape_string_interpolation: cyan_bold - shape_table: blue_bold - shape_variable: purple - shape_vardecl: purple - shape_raw_string: light_purple -} - -# External completer example -# let carapace_completer = {|spans| -# carapace $spans.0 nushell ...$spans | from json -# } - -# The default config record. This is where much of your global configuration is setup. -$env.config = { - show_banner: true # true or false to enable or disable the welcome banner at startup - - ls: { - use_ls_colors: true # use the LS_COLORS environment variable to colorize output - clickable_links: true # enable or disable clickable links. Your terminal has to support links. - } - - rm: { - always_trash: false # always act as if -t was given. Can be overridden with -p - } - - table: { - mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other - index_mode: always # "always" show indexes, "never" show indexes, "auto" = show indexes when a table has "index" column - show_empty: true # show 'empty list' and 'empty record' placeholders for command output - padding: { left: 1, right: 1 } # a left right padding of each column in a table - trim: { - methodology: wrapping # wrapping or truncating - wrapping_try_keep_words: true # A strategy used by the 'wrapping' methodology - truncating_suffix: "..." # A suffix used by the 'truncating' methodology - } - header_on_separator: false # show header text on separator/border line - footer_inheritance: false # render footer in parent table if child is big enough (extended table option) - # abbreviated_row_count: 10 # limit data rows from top and bottom after reaching a set point - } - - error_style: "fancy" # "fancy" or "plain" for screen reader-friendly error messages - - # Whether an error message should be printed if an error of a certain kind is triggered. - display_errors: { - exit_code: false # assume the external command prints an error message - # Core dump errors are always printed, and SIGPIPE never triggers an error. - # The setting below controls message printing for termination by all other signals. - termination_signal: true - } - - # datetime_format determines what a datetime rendered in the shell would look like. - # Behavior without this configuration point will be to "humanize" the datetime display, - # showing something like "a day ago." - datetime_format: { - # normal: '%a, %d %b %Y %H:%M:%S %z' # shows up in displays of variables or other datetime's outside of tables - # table: '%m/%d/%y %I:%M:%S%p' # generally shows up in tabular outputs such as ls. commenting this out will change it to the default human readable datetime format - } - - explore: { - status_bar_background: { fg: "#1D1F21", bg: "#C4C9C6" }, - command_bar_text: { fg: "#C4C9C6" }, - highlight: { fg: "black", bg: "yellow" }, - status: { - error: { fg: "white", bg: "red" }, - warn: {} - info: {} - }, - selected_cell: { bg: light_blue }, - } - - history: { - max_size: 100_000 # Session has to be reloaded for this to take effect - sync_on_enter: true # Enable to share history between multiple sessions, else you have to close the session to write history to file - file_format: "plaintext" # "sqlite" or "plaintext" - isolation: false # only available with sqlite file_format. true enables history isolation, false disables it. true will allow the history to be isolated to the current session using up/down arrows. false will allow the history to be shared across all sessions. - } - - completions: { - case_sensitive: false # set to true to enable case-sensitive completions - quick: true # set this to false to prevent auto-selecting completions when only one remains - partial: true # set this to false to prevent partial filling of the prompt - algorithm: "prefix" # prefix or fuzzy - sort: "smart" # "smart" (alphabetical for prefix matching, fuzzy score for fuzzy matching) or "alphabetical" - external: { - enable: true # set to false to prevent nushell looking into $env.PATH to find more suggestions, `false` recommended for WSL users as this look up may be very slow - max_results: 100 # setting it lower can improve completion performance at the cost of omitting some options - completer: null # check 'carapace_completer' above as an example - } - use_ls_colors: true # set this to true to enable file/path/directory completions using LS_COLORS - } - - filesize: { - metric: false # true => KB, MB, GB (ISO standard), false => KiB, MiB, GiB (Windows standard) - format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, auto - } - - cursor_shape: { - emacs: line # block, underscore, line, blink_block, blink_underscore, blink_line, inherit to skip setting cursor shape (line is the default) - vi_insert: block # block, underscore, line, blink_block, blink_underscore, blink_line, inherit to skip setting cursor shape (block is the default) - vi_normal: underscore # block, underscore, line, blink_block, blink_underscore, blink_line, inherit to skip setting cursor shape (underscore is the default) - } - - color_config: $dark_theme # if you want a more interesting theme, you can replace the empty record with `$dark_theme`, `$light_theme` or another custom record - footer_mode: 25 # always, never, number_of_rows, auto - float_precision: 2 # the precision for displaying floats in tables - buffer_editor: null # command that will be used to edit the current line buffer with ctrl+o, if unset fallback to $env.VISUAL and $env.EDITOR - use_ansi_coloring: true - bracketed_paste: true # enable bracketed paste, currently useless on windows - edit_mode: emacs # emacs, vi - shell_integration: { - # osc2 abbreviates the path if in the home_dir, sets the tab/window title, shows the running command in the tab/window title - osc2: true - # osc7 is a way to communicate the path to the terminal, this is helpful for spawning new tabs in the same directory - osc7: true - # osc8 is also implemented as the deprecated setting ls.show_clickable_links, it shows clickable links in ls output if your terminal supports it. show_clickable_links is deprecated in favor of osc8 - osc8: true - # osc9_9 is from ConEmu and is starting to get wider support. It's similar to osc7 in that it communicates the path to the terminal - osc9_9: false - # osc133 is several escapes invented by Final Term which include the supported ones below. - # 133;A - Mark prompt start - # 133;B - Mark prompt end - # 133;C - Mark pre-execution - # 133;D;exit - Mark execution finished with exit code - # This is used to enable terminals to know where the prompt is, the command is, where the command finishes, and where the output of the command is - osc133: true - # osc633 is closely related to osc133 but only exists in visual studio code (vscode) and supports their shell integration features - # 633;A - Mark prompt start - # 633;B - Mark prompt end - # 633;C - Mark pre-execution - # 633;D;exit - Mark execution finished with exit code - # 633;E - Explicitly set the command line with an optional nonce - # 633;P;Cwd= - Mark the current working directory and communicate it to the terminal - # and also helps with the run recent menu in vscode - osc633: true - # reset_application_mode is escape \x1b[?1l and was added to help ssh work better - reset_application_mode: true - } - render_right_prompt_on_last_line: false # true or false to enable or disable right prompt to be rendered on last line of the prompt. - use_kitty_protocol: false # enables keyboard enhancement protocol implemented by kitty console, only if your terminal support this. - highlight_resolved_externals: false # true enables highlighting of external commands in the repl resolved by which. - recursion_limit: 50 # the maximum number of times nushell allows recursion before stopping it - - plugins: {} # Per-plugin configuration. See https://www.nushell.sh/contributor-book/plugins.html#configuration. - - plugin_gc: { - # Configuration for plugin garbage collection - default: { - enabled: true # true to enable stopping of inactive plugins - stop_after: 10sec # how long to wait after a plugin is inactive to stop it - } - plugins: { - # alternate configuration for specific plugins, by name, for example: - # - # gstat: { - # enabled: false - # } - } - } - - hooks: { - pre_prompt: [{ null }] # run before the prompt is shown - pre_execution: [{ null }] # run before the repl input is run - env_change: { - PWD: [{|before, after| null }] # run if the PWD environment is different since the last repl input - } - display_output: "if (term size).columns >= 100 { table -e } else { table }" # run to display the output of a pipeline - command_not_found: { null } # return an error message when a command is not found - } - - menus: [ - # Configuration for default nushell menus - # Note the lack of source parameter - { - name: completion_menu - only_buffer_difference: false - marker: "| " - type: { - layout: columnar - columns: 4 - col_width: 20 # Optional value. If missing all the screen width is used to calculate column width - col_padding: 2 - } - style: { - text: green - selected_text: { attr: r } - description_text: yellow - match_text: { attr: u } - selected_match_text: { attr: ur } - } - } - { - name: ide_completion_menu - only_buffer_difference: false - marker: "| " - type: { - layout: ide - min_completion_width: 0, - max_completion_width: 50, - max_completion_height: 10, # will be limited by the available lines in the terminal - padding: 0, - border: true, - cursor_offset: 0, - description_mode: "prefer_right" - min_description_width: 0 - max_description_width: 50 - max_description_height: 10 - description_offset: 1 - # If true, the cursor pos will be corrected, so the suggestions match up with the typed text - # - # C:\> str - # str join - # str trim - # str split - correct_cursor_pos: false - } - style: { - text: green - selected_text: { attr: r } - description_text: yellow - match_text: { attr: u } - selected_match_text: { attr: ur } - } - } - { - name: history_menu - only_buffer_difference: true - marker: "? " - type: { - layout: list - page_size: 10 - } - style: { - text: green - selected_text: green_reverse - description_text: yellow - } - } - { - name: help_menu - only_buffer_difference: true - marker: "? " - type: { - layout: description - columns: 4 - col_width: 20 # Optional value. If missing all the screen width is used to calculate column width - col_padding: 2 - selection_rows: 4 - description_rows: 10 - } - style: { - text: green - selected_text: green_reverse - description_text: yellow - } - } - ] - - keybindings: [ - { - name: completion_menu - modifier: none - keycode: tab - mode: [emacs vi_normal vi_insert] - event: { - until: [ - { send: menu name: completion_menu } - { send: menunext } - { edit: complete } - ] - } - } - { - name: completion_previous_menu - modifier: shift - keycode: backtab - mode: [emacs, vi_normal, vi_insert] - event: { send: menuprevious } - } - { - name: ide_completion_menu - modifier: control - keycode: space - mode: [emacs vi_normal vi_insert] - event: { - until: [ - { send: menu name: ide_completion_menu } - { send: menunext } - { edit: complete } - ] - } - } - { - name: history_menu - modifier: control - keycode: char_r - mode: [emacs, vi_insert, vi_normal] - event: { send: menu name: history_menu } - } - { - name: help_menu - modifier: none - keycode: f1 - mode: [emacs, vi_insert, vi_normal] - event: { send: menu name: help_menu } - } - { - name: next_page_menu - modifier: control - keycode: char_x - mode: emacs - event: { send: menupagenext } - } - { - name: undo_or_previous_page_menu - modifier: control - keycode: char_z - mode: emacs - event: { - until: [ - { send: menupageprevious } - { edit: undo } - ] - } - } - { - name: escape - modifier: none - keycode: escape - mode: [emacs, vi_normal, vi_insert] - event: { send: esc } # NOTE: does not appear to work - } - { - name: cancel_command - modifier: control - keycode: char_c - mode: [emacs, vi_normal, vi_insert] - event: { send: ctrlc } - } - { - name: quit_shell - modifier: control - keycode: char_d - mode: [emacs, vi_normal, vi_insert] - event: { send: ctrld } - } - { - name: clear_screen - modifier: control - keycode: char_l - mode: [emacs, vi_normal, vi_insert] - event: { send: clearscreen } - } - { - name: search_history - modifier: control - keycode: char_q - mode: [emacs, vi_normal, vi_insert] - event: { send: searchhistory } - } - { - name: open_command_editor - modifier: control - keycode: char_o - mode: [emacs, vi_normal, vi_insert] - event: { send: openeditor } - } - { - name: move_up - modifier: none - keycode: up - mode: [emacs, vi_normal, vi_insert] - event: { - until: [ - { send: menuup } - { send: up } - ] - } - } - { - name: move_down - modifier: none - keycode: down - mode: [emacs, vi_normal, vi_insert] - event: { - until: [ - { send: menudown } - { send: down } - ] - } - } - { - name: move_left - modifier: none - keycode: left - mode: [emacs, vi_normal, vi_insert] - event: { - until: [ - { send: menuleft } - { send: left } - ] - } - } - { - name: move_right_or_take_history_hint - modifier: none - keycode: right - mode: [emacs, vi_normal, vi_insert] - event: { - until: [ - { send: historyhintcomplete } - { send: menuright } - { send: right } - ] - } - } - { - name: move_one_word_left - modifier: control - keycode: left - mode: [emacs, vi_normal, vi_insert] - event: { edit: movewordleft } - } - { - name: move_one_word_right_or_take_history_hint - modifier: control - keycode: right - mode: [emacs, vi_normal, vi_insert] - event: { - until: [ - { send: historyhintwordcomplete } - { edit: movewordright } - ] - } - } - { - name: move_to_line_start - modifier: none - keycode: home - mode: [emacs, vi_normal, vi_insert] - event: { edit: movetolinestart } - } - { - name: move_to_line_start - modifier: control - keycode: char_a - mode: [emacs, vi_normal, vi_insert] - event: { edit: movetolinestart } - } - { - name: move_to_line_end_or_take_history_hint - modifier: none - keycode: end - mode: [emacs, vi_normal, vi_insert] - event: { - until: [ - { send: historyhintcomplete } - { edit: movetolineend } - ] - } - } - { - name: move_to_line_end_or_take_history_hint - modifier: control - keycode: char_e - mode: [emacs, vi_normal, vi_insert] - event: { - until: [ - { send: historyhintcomplete } - { edit: movetolineend } - ] - } - } - { - name: move_to_line_start - modifier: control - keycode: home - mode: [emacs, vi_normal, vi_insert] - event: { edit: movetolinestart } - } - { - name: move_to_line_end - modifier: control - keycode: end - mode: [emacs, vi_normal, vi_insert] - event: { edit: movetolineend } - } - { - name: move_down - modifier: control - keycode: char_n - mode: [emacs, vi_normal, vi_insert] - event: { - until: [ - { send: menudown } - { send: down } - ] - } - } - { - name: move_up - modifier: control - keycode: char_p - mode: [emacs, vi_normal, vi_insert] - event: { - until: [ - { send: menuup } - { send: up } - ] - } - } - { - name: delete_one_character_backward - modifier: none - keycode: backspace - mode: [emacs, vi_insert] - event: { edit: backspace } - } - { - name: delete_one_word_backward - modifier: control - keycode: backspace - mode: [emacs, vi_insert] - event: { edit: backspaceword } - } - { - name: delete_one_character_forward - modifier: none - keycode: delete - mode: [emacs, vi_insert] - event: { edit: delete } - } - { - name: delete_one_character_forward - modifier: control - keycode: delete - mode: [emacs, vi_insert] - event: { edit: delete } - } - { - name: delete_one_character_backward - modifier: control - keycode: char_h - mode: [emacs, vi_insert] - event: { edit: backspace } - } - { - name: delete_one_word_backward - modifier: control - keycode: char_w - mode: [emacs, vi_insert] - event: { edit: backspaceword } - } - { - name: move_left - modifier: none - keycode: backspace - mode: vi_normal - event: { edit: moveleft } - } - { - name: newline_or_run_command - modifier: none - keycode: enter - mode: emacs - event: { send: enter } - } - { - name: move_left - modifier: control - keycode: char_b - mode: emacs - event: { - until: [ - { send: menuleft } - { send: left } - ] - } - } - { - name: move_right_or_take_history_hint - modifier: control - keycode: char_f - mode: emacs - event: { - until: [ - { send: historyhintcomplete } - { send: menuright } - { send: right } - ] - } - } - { - name: redo_change - modifier: control - keycode: char_g - mode: emacs - event: { edit: redo } - } - { - name: undo_change - modifier: control - keycode: char_z - mode: emacs - event: { edit: undo } - } - { - name: paste_before - modifier: control - keycode: char_y - mode: emacs - event: { edit: pastecutbufferbefore } - } - { - name: cut_word_left - modifier: control - keycode: char_w - mode: emacs - event: { edit: cutwordleft } - } - { - name: cut_line_to_end - modifier: control - keycode: char_k - mode: emacs - event: { edit: cuttolineend } - } - { - name: cut_line_from_start - modifier: control - keycode: char_u - mode: emacs - event: { edit: cutfromstart } - } - { - name: swap_graphemes - modifier: control - keycode: char_t - mode: emacs - event: { edit: swapgraphemes } - } - { - name: move_one_word_left - modifier: alt - keycode: left - mode: emacs - event: { edit: movewordleft } - } - { - name: move_one_word_right_or_take_history_hint - modifier: alt - keycode: right - mode: emacs - event: { - until: [ - { send: historyhintwordcomplete } - { edit: movewordright } - ] - } - } - { - name: move_one_word_left - modifier: alt - keycode: char_b - mode: emacs - event: { edit: movewordleft } - } - { - name: move_one_word_right_or_take_history_hint - modifier: alt - keycode: char_f - mode: emacs - event: { - until: [ - { send: historyhintwordcomplete } - { edit: movewordright } - ] - } - } - { - name: delete_one_word_forward - modifier: alt - keycode: delete - mode: emacs - event: { edit: deleteword } - } - { - name: delete_one_word_backward - modifier: alt - keycode: backspace - mode: emacs - event: { edit: backspaceword } - } - { - name: delete_one_word_backward - modifier: alt - keycode: char_m - mode: emacs - event: { edit: backspaceword } - } - { - name: cut_word_to_right - modifier: alt - keycode: char_d - mode: emacs - event: { edit: cutwordright } - } - { - name: upper_case_word - modifier: alt - keycode: char_u - mode: emacs - event: { edit: uppercaseword } - } - { - name: lower_case_word - modifier: alt - keycode: char_l - mode: emacs - event: { edit: lowercaseword } - } - { - name: capitalize_char - modifier: alt - keycode: char_c - mode: emacs - event: { edit: capitalizechar } - } - # The following bindings with `*system` events require that Nushell has - # been compiled with the `system-clipboard` feature. - # If you want to use the system clipboard for visual selection or to - # paste directly, uncomment the respective lines and replace the version - # using the internal clipboard. - { - name: copy_selection - modifier: control_shift - keycode: char_c - mode: emacs - event: { edit: copyselection } - # event: { edit: copyselectionsystem } - } - { - name: cut_selection - modifier: control_shift - keycode: char_x - mode: emacs - event: { edit: cutselection } - # event: { edit: cutselectionsystem } - } - # { - # name: paste_system - # modifier: control_shift - # keycode: char_v - # mode: emacs - # event: { edit: pastesystem } - # } - { - name: select_all - modifier: control_shift - keycode: char_a - mode: emacs - event: { edit: selectall } - } - ] -} diff --git a/crates/nu-utils/src/sample_config/default_env.nu b/crates/nu-utils/src/sample_config/default_env.nu deleted file mode 100644 index fb527dc112..0000000000 --- a/crates/nu-utils/src/sample_config/default_env.nu +++ /dev/null @@ -1,101 +0,0 @@ -# Nushell Environment Config File -# -# version = "0.100.1" - -def create_left_prompt [] { - let dir = match (do --ignore-shell-errors { $env.PWD | path relative-to $nu.home-path }) { - null => $env.PWD - '' => '~' - $relative_pwd => ([~ $relative_pwd] | path join) - } - - let path_color = (if (is-admin) { ansi red_bold } else { ansi green_bold }) - let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold }) - let path_segment = $"($path_color)($dir)(ansi reset)" - - $path_segment | str replace --all (char path_sep) $"($separator_color)(char path_sep)($path_color)" -} - -def create_right_prompt [] { - # create a right prompt in magenta with green separators and am/pm underlined - let time_segment = ([ - (ansi reset) - (ansi magenta) - (date now | format date '%x %X') # try to respect user's locale - ] | str join | str replace --regex --all "([/:])" $"(ansi green)${1}(ansi magenta)" | - str replace --regex --all "([AP]M)" $"(ansi magenta_underline)${1}") - - let last_exit_code = if ($env.LAST_EXIT_CODE != 0) {([ - (ansi rb) - ($env.LAST_EXIT_CODE) - ] | str join) - } else { "" } - - ([$last_exit_code, (char space), $time_segment] | str join) -} - -# Use nushell functions to define your right and left prompt -$env.PROMPT_COMMAND = {|| create_left_prompt } -# FIXME: This default is not implemented in rust code as of 2023-09-08. -$env.PROMPT_COMMAND_RIGHT = {|| create_right_prompt } - -# The prompt indicators are environmental variables that represent -# the state of the prompt -$env.PROMPT_INDICATOR = {|| "> " } -$env.PROMPT_INDICATOR_VI_INSERT = {|| ": " } -$env.PROMPT_INDICATOR_VI_NORMAL = {|| "> " } -$env.PROMPT_MULTILINE_INDICATOR = {|| "::: " } - -# If you want previously entered commands to have a different prompt from the usual one, -# you can uncomment one or more of the following lines. -# This can be useful if you have a 2-line prompt and it's taking up a lot of space -# because every command entered takes up 2 lines instead of 1. You can then uncomment -# the line below so that previously entered commands show with a single `🚀`. -# $env.TRANSIENT_PROMPT_COMMAND = {|| "🚀 " } -# $env.TRANSIENT_PROMPT_INDICATOR = {|| "" } -# $env.TRANSIENT_PROMPT_INDICATOR_VI_INSERT = {|| "" } -# $env.TRANSIENT_PROMPT_INDICATOR_VI_NORMAL = {|| "" } -# $env.TRANSIENT_PROMPT_MULTILINE_INDICATOR = {|| "" } -# $env.TRANSIENT_PROMPT_COMMAND_RIGHT = {|| "" } - -# Specifies how environment variables are: -# - converted from a string to a value on Nushell startup (from_string) -# - converted from a value back to a string when running external commands (to_string) -# Note: The conversions happen *after* config.nu is loaded -$env.ENV_CONVERSIONS = { - "PATH": { - from_string: { |s| $s | split row (char esep) | path expand --no-symlink } - to_string: { |v| $v | path expand --no-symlink | str join (char esep) } - } - "Path": { - from_string: { |s| $s | split row (char esep) | path expand --no-symlink } - to_string: { |v| $v | path expand --no-symlink | str join (char esep) } - } -} - -# Directories to search for scripts when calling source or use -# The default for this is $nu.default-config-dir/scripts -$env.NU_LIB_DIRS = [ - ($nu.default-config-dir | path join 'scripts') # add /scripts - ($nu.data-dir | path join 'completions') # default home for nushell completions -] - -# Directories to search for plugin binaries when calling register -# The default for this is $nu.default-config-dir/plugins -$env.NU_PLUGIN_DIRS = [ - ($nu.default-config-dir | path join 'plugins') # add /plugins -] - -# To add entries to PATH (on Windows you might use Path), you can use the following pattern: -# $env.PATH = ($env.PATH | split row (char esep) | prepend '/some/path') -# An alternate way to add entries to $env.PATH is to use the custom command `path add` -# which is built into the nushell stdlib: -# use std "path add" -# $env.PATH = ($env.PATH | split row (char esep)) -# path add /some/path -# path add ($env.CARGO_HOME | path join "bin") -# path add ($env.HOME | path join ".local" "bin") -# $env.PATH = ($env.PATH | uniq) - -# To load from a custom file you can use: -# source ($nu.default-config-dir | path join 'custom.nu') diff --git a/crates/nu-utils/src/utils.rs b/crates/nu-utils/src/utils.rs index 472afc92f7..798e542be5 100644 --- a/crates/nu-utils/src/utils.rs +++ b/crates/nu-utils/src/utils.rs @@ -85,12 +85,29 @@ where ret } +// See default_files/README.md for a description of these files pub fn get_default_env() -> &'static str { - include_str!("sample_config/default_env.nu") + include_str!("default_files/default_env.nu") +} + +pub fn get_scaffold_env() -> &'static str { + include_str!("default_files/scaffold_env.nu") +} + +pub fn get_sample_env() -> &'static str { + include_str!("default_files/sample_env.nu") } pub fn get_default_config() -> &'static str { - include_str!("sample_config/default_config.nu") + include_str!("default_files/default_config.nu") +} + +pub fn get_scaffold_config() -> &'static str { + include_str!("default_files/scaffold_config.nu") +} + +pub fn get_sample_config() -> &'static str { + include_str!("default_files/sample_config.nu") } pub fn get_ls_colors(lscolors_env_string: Option) -> LsColors { diff --git a/src/config_files.rs b/src/config_files.rs index 7631a951bc..5c43764580 100644 --- a/src/config_files.rs +++ b/src/config_files.rs @@ -2,12 +2,13 @@ use log::warn; #[cfg(feature = "plugin")] use nu_cli::read_plugin_file; use nu_cli::{eval_config_contents, eval_source}; +use nu_engine::convert_env_values; use nu_path::canonicalize_with; use nu_protocol::{ engine::{EngineState, Stack, StateWorkingSet}, report_parse_error, report_shell_error, Config, ParseError, PipelineData, Spanned, }; -use nu_utils::{get_default_config, get_default_env}; +use nu_utils::{get_default_config, get_default_env, get_scaffold_config, get_scaffold_env, perf}; use std::{ fs, fs::File, @@ -26,12 +27,47 @@ pub(crate) fn read_config_file( stack: &mut Stack, config_file: Option>, is_env_config: bool, - ask_to_create: bool, + create_scaffold: bool, ) { warn!( "read_config_file() config_file_specified: {:?}, is_env_config: {is_env_config}", &config_file ); + + if is_env_config { + eval_default_config(engine_state, stack, get_default_env(), is_env_config); + + let start_time = std::time::Instant::now(); + let config = engine_state.get_config(); + let use_color = config.use_ansi_coloring; + // Translate environment variables from Strings to Values + if let Err(e) = convert_env_values(engine_state, stack) { + report_shell_error(engine_state, &e); + } + + perf!( + "translate env vars after default_env.nu", + start_time, + use_color + ); + } else { + let start_time = std::time::Instant::now(); + let config = engine_state.get_config(); + let use_color = config.use_ansi_coloring; + if let Err(e) = convert_env_values(engine_state, stack) { + report_shell_error(engine_state, &e); + } + perf!( + "translate env vars before default_config.nu", + start_time, + use_color + ); + + eval_default_config(engine_state, stack, get_default_config(), is_env_config); + }; + + warn!("read_config_file() loading_defaults is_env_config: {is_env_config}"); + // Load config startup file if let Some(file) = config_file { match engine_state.cwd_as_string(Some(stack)) { @@ -59,41 +95,16 @@ pub(crate) fn read_config_file( config_path.push(if is_env_config { ENV_FILE } else { CONFIG_FILE }); if !config_path.exists() { - let file_msg = if is_env_config { - "environment config" + let scaffold_config_file = if is_env_config { + get_scaffold_env() } else { - "config" + get_scaffold_config() }; - let will_create_file = match ask_to_create { - true => { - println!( - "No {} file found at {}", - file_msg, - config_path.to_string_lossy() - ); - println!("Would you like to create one with defaults (Y/n): "); - - let mut answer = String::new(); - std::io::stdin() - .read_line(&mut answer) - .expect("Failed to read user input"); - - matches!(answer.trim(), "y" | "Y" | "") - } - _ => false, - }; - - let config_file = if is_env_config { - get_default_env() - } else { - get_default_config() - }; - - match will_create_file { + match create_scaffold { true => { if let Ok(mut output) = File::create(&config_path) { - if write!(output, "{config_file}").is_ok() { + if write!(output, "{scaffold_config_file}").is_ok() { let config_type = if is_env_config { "Environment config" } else { @@ -109,17 +120,14 @@ pub(crate) fn read_config_file( "Unable to write to {}, sourcing default file instead", config_path.to_string_lossy(), ); - eval_default_config(engine_state, stack, config_file, is_env_config); return; } } else { - eprintln!("Unable to create {config_file}, sourcing default file instead"); - eval_default_config(engine_state, stack, config_file, is_env_config); + eprintln!("Unable to create {scaffold_config_file}"); return; } } _ => { - eval_default_config(engine_state, stack, config_file, is_env_config); return; } } @@ -227,11 +235,7 @@ fn eval_default_config( config_file: &str, is_env_config: bool, ) { - warn!( - "eval_default_config() config_file_specified: {:?}, is_env_config: {}", - &config_file, is_env_config - ); - // Just use the contents of "default_config.nu" or "default_env.nu" + warn!("eval_default_config() is_env_config: {}", is_env_config); eval_source( engine_state, stack, @@ -264,20 +268,14 @@ pub(crate) fn setup_config( &config_file, &env_file, is_login_shell ); - let ask_to_create_config = nu_path::nu_config_dir().map_or(false, |p| !p.exists()); + let create_scaffold = nu_path::nu_config_dir().map_or(false, |p| !p.exists()); let result = catch_unwind(AssertUnwindSafe(|| { #[cfg(feature = "plugin")] read_plugin_file(engine_state, plugin_file); - read_config_file(engine_state, stack, env_file, true, ask_to_create_config); - read_config_file( - engine_state, - stack, - config_file, - false, - ask_to_create_config, - ); + read_config_file(engine_state, stack, env_file, true, create_scaffold); + read_config_file(engine_state, stack, config_file, false, create_scaffold); if is_login_shell { read_loginshell_file(engine_state, stack); diff --git a/src/main.rs b/src/main.rs index d55940bd61..283556ecc4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -282,6 +282,16 @@ fn main() -> Result<()> { Value::string(env!("CARGO_PKG_VERSION"), Span::unknown()), ); + // Add SHLVL if interactive + if engine_state.is_interactive { + let mut shlvl = engine_state + .get_env_var("SHLVL") + .map(|x| x.as_str().unwrap_or("0").parse::().unwrap_or(0)) + .unwrap_or(0); + shlvl += 1; + engine_state.add_env_var("SHLVL".to_string(), Value::int(shlvl, Span::unknown())); + } + if parsed_nu_cli_args.no_std_lib.is_none() { load_standard_library(&mut engine_state)?; } diff --git a/src/run.rs b/src/run.rs index 1cbfbc03a2..89bad3866f 100644 --- a/src/run.rs +++ b/src/run.rs @@ -23,7 +23,7 @@ pub(crate) fn run_commands( trace!("run_commands"); let start_time = std::time::Instant::now(); - let ask_to_create_config = nu_path::nu_config_dir().map_or(false, |p| !p.exists()); + let create_scaffold = nu_path::nu_config_dir().map_or(false, |p| !p.exists()); let mut stack = Stack::new(); @@ -46,7 +46,7 @@ pub(crate) fn run_commands( &mut stack, parsed_nu_cli_args.env_file, true, - ask_to_create_config, + create_scaffold, ); } else { config_files::read_default_env_file(engine_state, &mut stack) @@ -55,7 +55,7 @@ pub(crate) fn run_commands( perf!("read env.nu", start_time, use_color); let start_time = std::time::Instant::now(); - let ask_to_create_config = nu_path::nu_config_dir().map_or(false, |p| !p.exists()); + let create_scaffold = nu_path::nu_config_dir().map_or(false, |p| !p.exists()); // If we have a config file parameter *OR* we have a login shell parameter, read the config file if parsed_nu_cli_args.config_file.is_some() || parsed_nu_cli_args.login_shell.is_some() { @@ -64,7 +64,7 @@ pub(crate) fn run_commands( &mut stack, parsed_nu_cli_args.config_file, false, - ask_to_create_config, + create_scaffold, ); } @@ -123,7 +123,7 @@ pub(crate) fn run_file( // if the --no-config-file(-n) flag is passed, do not load plugin, env, or config files if parsed_nu_cli_args.no_config_file.is_none() { let start_time = std::time::Instant::now(); - let ask_to_create_config = nu_path::nu_config_dir().map_or(false, |p| !p.exists()); + let create_scaffold = nu_path::nu_config_dir().map_or(false, |p| !p.exists()); #[cfg(feature = "plugin")] read_plugin_file(engine_state, parsed_nu_cli_args.plugin_file); perf!("read plugins", start_time, use_color); @@ -136,7 +136,7 @@ pub(crate) fn run_file( &mut stack, parsed_nu_cli_args.env_file, true, - ask_to_create_config, + create_scaffold, ); } else { config_files::read_default_env_file(engine_state, &mut stack) @@ -150,7 +150,7 @@ pub(crate) fn run_file( &mut stack, parsed_nu_cli_args.config_file, false, - ask_to_create_config, + create_scaffold, ); } perf!("read config.nu", start_time, use_color); diff --git a/tests/fixtures/formats/sample_data_with_annotation.ods b/tests/fixtures/formats/sample_data_with_annotation.ods new file mode 100644 index 0000000000..f4b5c723ea Binary files /dev/null and b/tests/fixtures/formats/sample_data_with_annotation.ods differ diff --git a/tests/repl/test_config_path.rs b/tests/repl/test_config_path.rs index c812f3404c..63488ecb6a 100644 --- a/tests/repl/test_config_path.rs +++ b/tests/repl/test_config_path.rs @@ -221,8 +221,8 @@ fn test_default_config_path_symlinked_config_files() { #[test] fn test_alternate_config_path() { - let config_file = "crates/nu-utils/src/sample_config/default_config.nu"; - let env_file = "crates/nu-utils/src/sample_config/default_env.nu"; + let config_file = "crates/nu-utils/src/default_files/scaffold_config.nu"; + let env_file = "crates/nu-utils/src/default_files/scaffold_env.nu"; let cwd = std::env::current_dir().expect("Could not get current working directory");