diff --git a/old_nushell/Cargo_old.lock b/old_nushell/Cargo_old.lock
deleted file mode 100644
index 595c1f5a7..000000000
--- a/old_nushell/Cargo_old.lock
+++ /dev/null
@@ -1,5359 +0,0 @@
-# This file is automatically @generated by Cargo.
-# It is not intended for manual editing.
-version = 3
-
-[[package]]
-name = "addr2line"
-version = "0.17.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b"
-dependencies = [
- "gimli",
-]
-
-[[package]]
-name = "adler"
-version = "1.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
-
-[[package]]
-name = "adler32"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234"
-
-[[package]]
-name = "ahash"
-version = "0.7.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
-dependencies = [
- "getrandom 0.2.3",
- "once_cell",
- "version_check",
-]
-
-[[package]]
-name = "aho-corasick"
-version = "0.7.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
-dependencies = [
- "memchr",
-]
-
-[[package]]
-name = "alloc-no-stdlib"
-version = "2.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "35ef4730490ad1c4eae5c4325b2a95f521d023e5c885853ff7aca0a6a1631db3"
-
-[[package]]
-name = "alloc-stdlib"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "697ed7edc0f1711de49ce108c541623a0af97c6c60b2f6e2b65229847ac843c2"
-dependencies = [
- "alloc-no-stdlib",
-]
-
-[[package]]
-name = "ansi_colours"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60e2fb6138a49ad9f1cb3c6d8f8ccbdd5e62b4dab317c1b435a47ecd7da1d28f"
-dependencies = [
- "cc",
-]
-
-[[package]]
-name = "ansi_term"
-version = "0.12.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
-dependencies = [
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "anyhow"
-version = "1.0.51"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b26702f315f53b6071259e15dd9d64528213b44d61de1ec926eca7715d62203"
-
-[[package]]
-name = "arrayvec"
-version = "0.4.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9"
-dependencies = [
- "nodrop",
-]
-
-[[package]]
-name = "arrayvec"
-version = "0.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
-
-[[package]]
-name = "arrow-format"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f7da2d9660bfaebbdb0a44a33b3bd1dcb5a952fafa02c0dfc6a51ea471fef2a"
-dependencies = [
- "flatbuffers",
-]
-
-[[package]]
-name = "arrow2"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d873e2775c3d87a4e8d77aa544cbd43f34a0779d5164c59e7c6a1dd0678eb395"
-dependencies = [
- "ahash",
- "arrow-format",
- "base64",
- "chrono",
- "csv",
- "futures 0.3.18",
- "hash_hasher",
- "indexmap",
- "lexical-core",
- "multiversion",
- "num-traits",
- "parquet2",
- "serde",
- "serde_json",
- "simdutf8",
- "streaming-iterator",
- "strength_reduce",
-]
-
-[[package]]
-name = "async-stream"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "171374e7e3b2504e0e5236e3b59260560f9fe94bfe9ac39ba5e4e929c5590625"
-dependencies = [
- "async-stream-impl",
- "futures-core",
-]
-
-[[package]]
-name = "async-stream-impl"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "async-trait"
-version = "0.1.51"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "atty"
-version = "0.2.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
-dependencies = [
- "hermit-abi",
- "libc",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "autocfg"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
-
-[[package]]
-name = "backtrace"
-version = "0.3.63"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "321629d8ba6513061f26707241fa9bc89524ff1cd7a915a97ef0c62c666ce1b6"
-dependencies = [
- "addr2line",
- "cc",
- "cfg-if 1.0.0",
- "libc",
- "miniz_oxide 0.4.4",
- "object",
- "rustc-demangle",
-]
-
-[[package]]
-name = "base64"
-version = "0.13.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
-
-[[package]]
-name = "bat"
-version = "0.18.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a069bad29696ecaa51ac79d3eb87abe3b65c7808ab2b3836afd9bd6c4009362"
-dependencies = [
- "ansi_colours",
- "ansi_term",
- "bugreport",
- "clircle",
- "console",
- "content_inspector",
- "encoding",
- "error-chain",
- "git2",
- "globset",
- "grep-cli",
- "path_abs",
- "semver 0.11.0",
- "serde",
- "serde_yaml",
- "shell-words",
- "syntect",
- "unicode-width",
-]
-
-[[package]]
-name = "bigdecimal"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6aaf33151a6429fe9211d1b276eafdf70cdff28b071e76c0b0e1503221ea3744"
-dependencies = [
- "num-bigint 0.4.3",
- "num-integer",
- "num-traits",
- "serde",
-]
-
-[[package]]
-name = "bincode"
-version = "1.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
-dependencies = [
- "serde",
-]
-
-[[package]]
-name = "bitflags"
-version = "1.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
-
-[[package]]
-name = "bitpacking"
-version = "0.8.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a8c7d2ac73c167c06af4a5f37e6e59d84148d57ccbe4480b76f0273eefea82d7"
-dependencies = [
- "crunchy",
-]
-
-[[package]]
-name = "block-buffer"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
-dependencies = [
- "generic-array",
-]
-
-[[package]]
-name = "brotli"
-version = "3.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "71cb90ade945043d3d53597b2fc359bb063db8ade2bcffe7997351d0756e9d50"
-dependencies = [
- "alloc-no-stdlib",
- "alloc-stdlib",
- "brotli-decompressor",
-]
-
-[[package]]
-name = "brotli-decompressor"
-version = "2.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "59ad2d4653bf5ca36ae797b1f4bb4dbddb60ce49ca4aed8a2ce4829f60425b80"
-dependencies = [
- "alloc-no-stdlib",
- "alloc-stdlib",
-]
-
-[[package]]
-name = "bson"
-version = "2.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ff58d466782b57e0001c8e97c6a70c01c2359d7e13e257a83654c0b783ecc139"
-dependencies = [
- "ahash",
- "base64",
- "chrono",
- "hex",
- "indexmap",
- "lazy_static",
- "rand 0.8.4",
- "serde",
- "serde_bytes",
- "serde_json",
- "uuid",
-]
-
-[[package]]
-name = "bstr"
-version = "0.2.17"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
-dependencies = [
- "lazy_static",
- "memchr",
- "regex-automata",
- "serde",
-]
-
-[[package]]
-name = "bugreport"
-version = "0.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0014b4b2b4f63bfe69c3838470121290cc437fdc79785d408a761a21e8b2404c"
-dependencies = [
- "git-version",
- "shell-escape",
- "sys-info",
-]
-
-[[package]]
-name = "bumpalo"
-version = "3.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c"
-
-[[package]]
-name = "byte-unit"
-version = "4.0.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "956ffc5b0ec7d7a6949e3f21fd63ba5af4cffdc2ba1e0b7bf62b481458c4ae7f"
-dependencies = [
- "utf8-width",
-]
-
-[[package]]
-name = "bytemuck"
-version = "1.7.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72957246c41db82b8ef88a5486143830adeb8227ef9837740bdec67724cf2c5b"
-
-[[package]]
-name = "byteorder"
-version = "1.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
-
-[[package]]
-name = "bytes"
-version = "0.4.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c"
-dependencies = [
- "byteorder",
- "iovec",
-]
-
-[[package]]
-name = "bytes"
-version = "0.5.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38"
-
-[[package]]
-name = "bytes"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
-
-[[package]]
-name = "bzip2"
-version = "0.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6afcd980b5f3a45017c57e57a2fcccbb351cc43a356ce117ef760ef8052b89b0"
-dependencies = [
- "bzip2-sys",
- "libc",
-]
-
-[[package]]
-name = "bzip2-sys"
-version = "0.1.11+1.0.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc"
-dependencies = [
- "cc",
- "libc",
- "pkg-config",
-]
-
-[[package]]
-name = "calamine"
-version = "0.18.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b86ca78da4bdce5ac0f0bdbc0218ad14232f1e668376e044233f64c527cf5abb"
-dependencies = [
- "byteorder",
- "codepage",
- "encoding_rs",
- "log",
- "quick-xml 0.19.0",
- "serde",
- "zip",
-]
-
-[[package]]
-name = "cassowary"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
-
-[[package]]
-name = "cc"
-version = "1.0.72"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
-dependencies = [
- "jobserver",
-]
-
-[[package]]
-name = "cfg-if"
-version = "0.1.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
-
-[[package]]
-name = "cfg-if"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
-
-[[package]]
-name = "chrono"
-version = "0.4.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
-dependencies = [
- "libc",
- "num-integer",
- "num-traits",
- "serde",
- "time 0.1.44",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "chrono-humanize"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2eddc119501d583fd930cb92144e605f44e0252c38dd89d9247fffa1993375cb"
-dependencies = [
- "chrono",
-]
-
-[[package]]
-name = "chrono-tz"
-version = "0.5.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2554a3155fec064362507487171dcc4edc3df60cb10f3a1fb10ed8094822b120"
-dependencies = [
- "chrono",
- "parse-zoneinfo",
-]
-
-[[package]]
-name = "clipboard-win"
-version = "4.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3db8340083d28acb43451166543b98c838299b7e0863621be53a338adceea0ed"
-dependencies = [
- "error-code",
- "str-buf",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "clircle"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e68bbd985a63de680ab4d1ad77b6306611a8f961b282c8b5ab513e6de934e396"
-dependencies = [
- "cfg-if 1.0.0",
- "libc",
- "serde",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "codepage"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b0e9222c0cdf2c6ac27d73f664f9520266fa911c3106329d359f8861cb8bde9"
-dependencies = [
- "encoding_rs",
-]
-
-[[package]]
-name = "codespan-reporting"
-version = "0.11.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e"
-dependencies = [
- "serde",
- "termcolor",
- "unicode-width",
-]
-
-[[package]]
-name = "color_quant"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
-
-[[package]]
-name = "comfy-table"
-version = "1.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "52a488ea8a8e295a53c7a4514b78a2e54bcff33adf99c15aced97b2a2062d4f8"
-dependencies = [
- "crossterm",
- "strum",
- "strum_macros",
-]
-
-[[package]]
-name = "common-path"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2382f75942f4b3be3690fe4f86365e9c853c1587d6ee58212cebf6e2a9ccd101"
-
-[[package]]
-name = "console"
-version = "0.14.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3993e6445baa160675931ec041a5e03ca84b9c6e32a056150d3aa2bdda0a1f45"
-dependencies = [
- "encode_unicode",
- "lazy_static",
- "libc",
- "regex",
- "terminal_size",
- "unicode-width",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "const-sha1"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb58b6451e8c2a812ad979ed1d83378caa5e927eef2622017a45f251457c2c9d"
-
-[[package]]
-name = "content_inspector"
-version = "0.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b7bda66e858c683005a53a9a60c69a4aca7eeaa45d124526e389f7aec8e62f38"
-dependencies = [
- "memchr",
-]
-
-[[package]]
-name = "convert_case"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e"
-
-[[package]]
-name = "core-foundation"
-version = "0.9.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3"
-dependencies = [
- "core-foundation-sys",
- "libc",
-]
-
-[[package]]
-name = "core-foundation-sys"
-version = "0.8.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
-
-[[package]]
-name = "cpufeatures"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "crc32fast"
-version = "1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836"
-dependencies = [
- "cfg-if 1.0.0",
-]
-
-[[package]]
-name = "crossbeam-channel"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4"
-dependencies = [
- "cfg-if 1.0.0",
- "crossbeam-utils",
-]
-
-[[package]]
-name = "crossbeam-deque"
-version = "0.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e"
-dependencies = [
- "cfg-if 1.0.0",
- "crossbeam-epoch",
- "crossbeam-utils",
-]
-
-[[package]]
-name = "crossbeam-epoch"
-version = "0.9.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd"
-dependencies = [
- "cfg-if 1.0.0",
- "crossbeam-utils",
- "lazy_static",
- "memoffset",
- "scopeguard",
-]
-
-[[package]]
-name = "crossbeam-utils"
-version = "0.8.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db"
-dependencies = [
- "cfg-if 1.0.0",
- "lazy_static",
-]
-
-[[package]]
-name = "crossterm"
-version = "0.19.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7c36c10130df424b2f3552fcc2ddcd9b28a27b1e54b358b45874f88d1ca6888c"
-dependencies = [
- "bitflags",
- "crossterm_winapi",
- "lazy_static",
- "libc",
- "mio",
- "parking_lot",
- "signal-hook",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "crossterm_winapi"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0da8964ace4d3e4a044fd027919b2237000b24315a37c916f61809f1ff2140b9"
-dependencies = [
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "crunchy"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
-
-[[package]]
-name = "crypto-mac"
-version = "0.11.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714"
-dependencies = [
- "generic-array",
- "subtle",
-]
-
-[[package]]
-name = "cssparser"
-version = "0.27.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "754b69d351cdc2d8ee09ae203db831e005560fc6030da058f86ad60c92a9cb0a"
-dependencies = [
- "cssparser-macros",
- "dtoa-short",
- "itoa",
- "matches",
- "phf",
- "proc-macro2",
- "quote",
- "smallvec",
- "syn",
-]
-
-[[package]]
-name = "cssparser-macros"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dfae75de57f2b2e85e8768c3ea840fd159c8f33e2b6522c7835b7abac81be16e"
-dependencies = [
- "quote",
- "syn",
-]
-
-[[package]]
-name = "cstr_core"
-version = "0.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "917ba9efe9e1e736671d5a03f006afc4e7e3f32503e2077e0bcaf519c0c8c1d3"
-dependencies = [
- "cty",
- "memchr",
-]
-
-[[package]]
-name = "csv"
-version = "1.1.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1"
-dependencies = [
- "bstr",
- "csv-core",
- "itoa",
- "ryu",
- "serde",
-]
-
-[[package]]
-name = "csv-core"
-version = "0.1.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90"
-dependencies = [
- "memchr",
-]
-
-[[package]]
-name = "ctrlc"
-version = "3.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "377c9b002a72a0b2c1a18c62e2f3864bdfea4a015e3683a96e24aa45dd6c02d1"
-dependencies = [
- "nix",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "cty"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
-
-[[package]]
-name = "deflate"
-version = "0.8.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174"
-dependencies = [
- "adler32",
- "byteorder",
-]
-
-[[package]]
-name = "derive-new"
-version = "0.5.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3418329ca0ad70234b9735dc4ceed10af4df60eff9c8e7b06cb5e520d92c3535"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "derive_more"
-version = "0.99.17"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321"
-dependencies = [
- "convert_case",
- "proc-macro2",
- "quote",
- "rustc_version 0.4.0",
- "syn",
-]
-
-[[package]]
-name = "digest"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
-dependencies = [
- "generic-array",
-]
-
-[[package]]
-name = "directories-next"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc"
-dependencies = [
- "cfg-if 1.0.0",
- "dirs-sys-next",
-]
-
-[[package]]
-name = "dirs"
-version = "3.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "30baa043103c9d0c2a57cf537cc2f35623889dc0d405e6c3cccfadbc81c71309"
-dependencies = [
- "dirs-sys",
-]
-
-[[package]]
-name = "dirs-next"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
-dependencies = [
- "cfg-if 1.0.0",
- "dirs-sys-next",
-]
-
-[[package]]
-name = "dirs-sys"
-version = "0.3.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780"
-dependencies = [
- "libc",
- "redox_users",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "dirs-sys-next"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
-dependencies = [
- "libc",
- "redox_users",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "doc-comment"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
-
-[[package]]
-name = "dtoa"
-version = "0.4.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0"
-
-[[package]]
-name = "dtoa-short"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bde03329ae10e79ede66c9ce4dc930aa8599043b0743008548680f25b91502d6"
-dependencies = [
- "dtoa",
-]
-
-[[package]]
-name = "dtparse"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "13276c5dbd7f365e00efe6631242772fe6615e1899df84d1f6ce3ae7b48209f6"
-dependencies = [
- "chrono",
- "chrono-tz",
- "lazy_static",
- "num-traits",
- "rust_decimal",
-]
-
-[[package]]
-name = "dunce"
-version = "1.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "453440c271cf5577fd2a40e4942540cb7d0d2f85e27c8d07dd0023c925a67541"
-
-[[package]]
-name = "dyn-clone"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ee2626afccd7561a06cf1367e2950c4718ea04565e20fb5029b6c7d8ad09abcf"
-
-[[package]]
-name = "ego-tree"
-version = "0.6.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a68a4904193147e0a8dec3314640e6db742afd5f6e634f428a6af230d9b3591"
-
-[[package]]
-name = "either"
-version = "1.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
-
-[[package]]
-name = "eml-parser"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "031fe36712cec8b81c5b76b555666ce855a4dfc2dcc35bb907046bf2ef545578"
-dependencies = [
- "regex",
-]
-
-[[package]]
-name = "encode_unicode"
-version = "0.3.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
-
-[[package]]
-name = "encoding"
-version = "0.2.33"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec"
-dependencies = [
- "encoding-index-japanese",
- "encoding-index-korean",
- "encoding-index-simpchinese",
- "encoding-index-singlebyte",
- "encoding-index-tradchinese",
-]
-
-[[package]]
-name = "encoding-index-japanese"
-version = "1.20141219.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91"
-dependencies = [
- "encoding_index_tests",
-]
-
-[[package]]
-name = "encoding-index-korean"
-version = "1.20141219.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81"
-dependencies = [
- "encoding_index_tests",
-]
-
-[[package]]
-name = "encoding-index-simpchinese"
-version = "1.20141219.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7"
-dependencies = [
- "encoding_index_tests",
-]
-
-[[package]]
-name = "encoding-index-singlebyte"
-version = "1.20141219.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a"
-dependencies = [
- "encoding_index_tests",
-]
-
-[[package]]
-name = "encoding-index-tradchinese"
-version = "1.20141219.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18"
-dependencies = [
- "encoding_index_tests",
-]
-
-[[package]]
-name = "encoding_index_tests"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569"
-
-[[package]]
-name = "encoding_rs"
-version = "0.8.29"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a74ea89a0a1b98f6332de42c95baff457ada66d1cb4030f9ff151b2041a1c746"
-dependencies = [
- "cfg-if 1.0.0",
-]
-
-[[package]]
-name = "endian-type"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d"
-
-[[package]]
-name = "env_logger"
-version = "0.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
-dependencies = [
- "atty",
- "humantime",
- "log",
- "regex",
- "termcolor",
-]
-
-[[package]]
-name = "env_logger"
-version = "0.8.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3"
-dependencies = [
- "log",
- "regex",
-]
-
-[[package]]
-name = "error-chain"
-version = "0.12.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc"
-dependencies = [
- "version_check",
-]
-
-[[package]]
-name = "error-code"
-version = "2.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b5115567ac25674e0043e472be13d14e537f37ea8aa4bdc4aef0c89add1db1ff"
-dependencies = [
- "libc",
- "str-buf",
-]
-
-[[package]]
-name = "failure"
-version = "0.1.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86"
-dependencies = [
- "backtrace",
- "failure_derive",
-]
-
-[[package]]
-name = "failure_derive"
-version = "0.1.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
- "synstructure",
-]
-
-[[package]]
-name = "fallible-iterator"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"
-
-[[package]]
-name = "fallible-streaming-iterator"
-version = "0.1.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
-
-[[package]]
-name = "fd-lock"
-version = "3.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cfc110fe50727d46a428eed832df40affe9bf74d077cac1bf3f2718e823f14c5"
-dependencies = [
- "cfg-if 1.0.0",
- "libc",
- "windows-sys",
-]
-
-[[package]]
-name = "filesize"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12d741e2415d4e2e5bd1c1d00409d1a8865a57892c2d689b504365655d237d43"
-dependencies = [
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "flatbuffers"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ef4c5738bcd7fad10315029c50026f83c9da5e4a21f8ed66826f43e0e2bde5f6"
-dependencies = [
- "bitflags",
- "smallvec",
- "thiserror",
-]
-
-[[package]]
-name = "flate2"
-version = "1.0.22"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f"
-dependencies = [
- "cfg-if 1.0.0",
- "crc32fast",
- "libc",
- "miniz_oxide 0.4.4",
-]
-
-[[package]]
-name = "fnv"
-version = "1.0.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
-
-[[package]]
-name = "foreign-types"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
-dependencies = [
- "foreign-types-shared",
-]
-
-[[package]]
-name = "foreign-types-shared"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
-
-[[package]]
-name = "form_urlencoded"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
-dependencies = [
- "matches",
- "percent-encoding",
-]
-
-[[package]]
-name = "fs_extra"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394"
-
-[[package]]
-name = "futf"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7c9c1ce3fa9336301af935ab852c437817d14cd33690446569392e65170aac3b"
-dependencies = [
- "mac",
- "new_debug_unreachable",
-]
-
-[[package]]
-name = "futures"
-version = "0.1.31"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678"
-
-[[package]]
-name = "futures"
-version = "0.3.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8cd0210d8c325c245ff06fd95a3b13689a1a276ac8cfa8e8720cb840bfb84b9e"
-dependencies = [
- "futures-channel",
- "futures-core",
- "futures-executor",
- "futures-io",
- "futures-sink",
- "futures-task",
- "futures-util",
-]
-
-[[package]]
-name = "futures-channel"
-version = "0.3.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fc8cd39e3dbf865f7340dce6a2d401d24fd37c6fe6c4f0ee0de8bfca2252d27"
-dependencies = [
- "futures-core",
- "futures-sink",
-]
-
-[[package]]
-name = "futures-core"
-version = "0.3.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "629316e42fe7c2a0b9a65b47d159ceaa5453ab14e8f0a3c5eedbb8cd55b4a445"
-
-[[package]]
-name = "futures-executor"
-version = "0.3.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b808bf53348a36cab739d7e04755909b9fcaaa69b7d7e588b37b6ec62704c97"
-dependencies = [
- "futures-core",
- "futures-task",
- "futures-util",
-]
-
-[[package]]
-name = "futures-io"
-version = "0.3.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e481354db6b5c353246ccf6a728b0c5511d752c08da7260546fc0933869daa11"
-
-[[package]]
-name = "futures-macro"
-version = "0.3.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a89f17b21645bc4ed773c69af9c9a0effd4a3f1a3876eadd453469f8854e7fdd"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "futures-sink"
-version = "0.3.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "996c6442437b62d21a32cd9906f9c41e7dc1e19a9579843fad948696769305af"
-
-[[package]]
-name = "futures-task"
-version = "0.3.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dabf1872aaab32c886832f2276d2f5399887e2bd613698a02359e4ea83f8de12"
-
-[[package]]
-name = "futures-util"
-version = "0.3.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41d22213122356472061ac0f1ab2cee28d2bac8491410fd68c2af53d1cedb83e"
-dependencies = [
- "futures 0.1.31",
- "futures-channel",
- "futures-core",
- "futures-io",
- "futures-macro",
- "futures-sink",
- "futures-task",
- "memchr",
- "pin-project-lite",
- "pin-utils",
- "slab",
- "tokio-io",
-]
-
-[[package]]
-name = "fxhash"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
-dependencies = [
- "byteorder",
-]
-
-[[package]]
-name = "generic-array"
-version = "0.14.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
-dependencies = [
- "typenum",
- "version_check",
-]
-
-[[package]]
-name = "getopts"
-version = "0.2.21"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5"
-dependencies = [
- "unicode-width",
-]
-
-[[package]]
-name = "getrandom"
-version = "0.1.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
-dependencies = [
- "cfg-if 1.0.0",
- "libc",
- "wasi 0.9.0+wasi-snapshot-preview1",
-]
-
-[[package]]
-name = "getrandom"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
-dependencies = [
- "cfg-if 1.0.0",
- "libc",
- "wasi 0.10.0+wasi-snapshot-preview1",
-]
-
-[[package]]
-name = "getset"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e45727250e75cc04ff2846a66397da8ef2b3db8e40e0cef4df67950a07621eb9"
-dependencies = [
- "proc-macro-error",
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "gimli"
-version = "0.26.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4"
-
-[[package]]
-name = "git-version"
-version = "0.3.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f6b0decc02f4636b9ccad390dcbe77b722a77efedfa393caf8379a51d5c61899"
-dependencies = [
- "git-version-macro",
- "proc-macro-hack",
-]
-
-[[package]]
-name = "git-version-macro"
-version = "0.3.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fe69f1cbdb6e28af2bac214e943b99ce8a0a06b447d15d3e61161b0423139f3f"
-dependencies = [
- "proc-macro-hack",
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "git2"
-version = "0.13.25"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f29229cc1b24c0e6062f6e742aa3e256492a5323365e5ed3413599f8a5eff7d6"
-dependencies = [
- "bitflags",
- "libc",
- "libgit2-sys",
- "log",
- "url",
-]
-
-[[package]]
-name = "gjson"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4599d0e9dce476280e2da1f334811e2b26d63a6b000e13b7b50cc980bae49698"
-
-[[package]]
-name = "glob"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
-
-[[package]]
-name = "globset"
-version = "0.4.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "10463d9ff00a2a068db14231982f5132edebad0d7660cd956a1c30292dbcbfbd"
-dependencies = [
- "aho-corasick",
- "bstr",
- "fnv",
- "log",
- "regex",
-]
-
-[[package]]
-name = "grep-cli"
-version = "0.1.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dd110c34bb4460d0de5062413b773e385cbf8a85a63fc535590110a09e79e8a"
-dependencies = [
- "atty",
- "bstr",
- "globset",
- "lazy_static",
- "log",
- "regex",
- "same-file",
- "termcolor",
- "winapi-util",
-]
-
-[[package]]
-name = "h2"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fd819562fcebdac5afc5c113c3ec36f902840b70fd4fc458799c8ce4607ae55"
-dependencies = [
- "bytes 1.1.0",
- "fnv",
- "futures-core",
- "futures-sink",
- "futures-util",
- "http",
- "indexmap",
- "slab",
- "tokio",
- "tokio-util",
- "tracing",
-]
-
-[[package]]
-name = "hamcrest2"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49f837c62de05dc9cc71ff6486cd85de8856a330395ae338a04bfcefe5e91075"
-dependencies = [
- "num 0.2.1",
- "regex",
-]
-
-[[package]]
-name = "hash32"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67"
-dependencies = [
- "byteorder",
-]
-
-[[package]]
-name = "hash_hasher"
-version = "2.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "74721d007512d0cb3338cd20f0654ac913920061a4c4d0d8708edb3f2a698c0c"
-
-[[package]]
-name = "hashbrown"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
-dependencies = [
- "ahash",
- "rayon",
-]
-
-[[package]]
-name = "hashlink"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7249a3129cbc1ffccd74857f81464a323a152173cdb134e0fd81bc803b29facf"
-dependencies = [
- "hashbrown",
-]
-
-[[package]]
-name = "heapless"
-version = "0.7.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c1ad878e07405df82b695089e63d278244344f80e764074d0bdfe99b89460f3"
-dependencies = [
- "hash32",
- "spin",
- "stable_deref_trait",
-]
-
-[[package]]
-name = "heck"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
-dependencies = [
- "unicode-segmentation",
-]
-
-[[package]]
-name = "heck"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
-
-[[package]]
-name = "hermit-abi"
-version = "0.1.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "hex"
-version = "0.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
-
-[[package]]
-name = "hmac"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b"
-dependencies = [
- "crypto-mac",
- "digest",
-]
-
-[[package]]
-name = "hmac-sha1"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e1333fad8d94b82cab989da428b0b36a3435db3870d85e971a1d6dc0a8576722"
-dependencies = [
- "sha1",
-]
-
-[[package]]
-name = "html5ever"
-version = "0.25.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aafcf38a1a36118242d29b92e1b08ef84e67e4a5ed06e0a80be20e6a32bfed6b"
-dependencies = [
- "log",
- "mac",
- "markup5ever",
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "htmlescape"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e9025058dae765dee5070ec375f591e2ba14638c63feff74f13805a72e523163"
-
-[[package]]
-name = "http"
-version = "0.2.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b"
-dependencies = [
- "bytes 1.1.0",
- "fnv",
- "itoa",
-]
-
-[[package]]
-name = "http-body"
-version = "0.4.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6"
-dependencies = [
- "bytes 1.1.0",
- "http",
- "pin-project-lite",
-]
-
-[[package]]
-name = "httparse"
-version = "1.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503"
-
-[[package]]
-name = "httpdate"
-version = "1.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
-
-[[package]]
-name = "humantime"
-version = "1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
-dependencies = [
- "quick-error",
-]
-
-[[package]]
-name = "hyper"
-version = "0.14.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "436ec0091e4f20e655156a30a0df3770fe2900aa301e548e08446ec794b6953c"
-dependencies = [
- "bytes 1.1.0",
- "futures-channel",
- "futures-core",
- "futures-util",
- "h2",
- "http",
- "http-body",
- "httparse",
- "httpdate",
- "itoa",
- "pin-project-lite",
- "socket2",
- "tokio",
- "tower-service",
- "tracing",
- "want",
-]
-
-[[package]]
-name = "hyper-tls"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
-dependencies = [
- "bytes 1.1.0",
- "hyper",
- "native-tls",
- "tokio",
- "tokio-native-tls",
-]
-
-[[package]]
-name = "ical"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a9f7215ad0d77e69644570dee000c7678a47ba7441062c1b5f918adde0d73cf"
-dependencies = [
- "thiserror",
-]
-
-[[package]]
-name = "idna"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
-dependencies = [
- "matches",
- "unicode-bidi",
- "unicode-normalization",
-]
-
-[[package]]
-name = "image"
-version = "0.23.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "24ffcb7e7244a9bf19d35bf2883b9c080c4ced3c07a9895572178cdb8f13f6a1"
-dependencies = [
- "bytemuck",
- "byteorder",
- "color_quant",
- "jpeg-decoder",
- "num-iter",
- "num-rational 0.3.2",
- "num-traits",
- "png",
-]
-
-[[package]]
-name = "indexmap"
-version = "1.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
-dependencies = [
- "autocfg",
- "hashbrown",
- "serde",
-]
-
-[[package]]
-name = "insta"
-version = "1.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "15226a375927344c78d39dc6b49e2d5562a5b0705e26a589093c6792e52eed8e"
-dependencies = [
- "console",
- "lazy_static",
- "serde",
- "serde_json",
- "serde_yaml",
- "similar",
- "uuid",
-]
-
-[[package]]
-name = "instant"
-version = "0.1.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
-dependencies = [
- "cfg-if 1.0.0",
-]
-
-[[package]]
-name = "integer-encoding"
-version = "3.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90c11140ffea82edce8dcd74137ce9324ec24b3cf0175fc9d7e29164da9915b8"
-dependencies = [
- "async-trait",
- "futures-util",
-]
-
-[[package]]
-name = "iovec"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "ipnet"
-version = "2.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9"
-
-[[package]]
-name = "is_debug"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "06d198e9919d9822d5f7083ba8530e04de87841eaf21ead9af8f2304efd57c89"
-
-[[package]]
-name = "is_executable"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa9acdc6d67b75e626ad644734e8bc6df893d9cd2a834129065d3dd6158ea9c8"
-dependencies = [
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "itertools"
-version = "0.10.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf"
-dependencies = [
- "either",
-]
-
-[[package]]
-name = "itoa"
-version = "0.4.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
-
-[[package]]
-name = "jobserver"
-version = "0.1.24"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "jpeg-decoder"
-version = "0.1.22"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2"
-
-[[package]]
-name = "js-sys"
-version = "0.3.55"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84"
-dependencies = [
- "wasm-bindgen",
-]
-
-[[package]]
-name = "lazy_static"
-version = "1.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
-
-[[package]]
-name = "lazycell"
-version = "1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
-
-[[package]]
-name = "lexical"
-version = "6.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c34e981f88d060a67815388470172638f1af16b3a12e581cb75142f190161bf9"
-dependencies = [
- "lexical-core",
-]
-
-[[package]]
-name = "lexical-core"
-version = "0.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a3926d8f156019890be4abe5fd3785e0cff1001e06f59c597641fd513a5a284"
-dependencies = [
- "lexical-parse-float",
- "lexical-parse-integer",
- "lexical-util",
- "lexical-write-float",
- "lexical-write-integer",
-]
-
-[[package]]
-name = "lexical-parse-float"
-version = "0.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b4d066d004fa762d9da995ed21aa8845bb9f6e4265f540d716fb4b315197bf0e"
-dependencies = [
- "lexical-parse-integer",
- "lexical-util",
- "static_assertions",
-]
-
-[[package]]
-name = "lexical-parse-integer"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2c92badda8cc0fc4f3d3cc1c30aaefafb830510c8781ce4e8669881f3ed53ac"
-dependencies = [
- "lexical-util",
- "static_assertions",
-]
-
-[[package]]
-name = "lexical-util"
-version = "0.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ff669ccaae16ee33af90dc51125755efed17f1309626ba5c12052512b11e291"
-dependencies = [
- "static_assertions",
-]
-
-[[package]]
-name = "lexical-write-float"
-version = "0.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b5186948c7b297abaaa51560f2581dae625e5ce7dfc2d8fdc56345adb6dc576"
-dependencies = [
- "lexical-util",
- "lexical-write-integer",
- "static_assertions",
-]
-
-[[package]]
-name = "lexical-write-integer"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ece956492e0e40fd95ef8658a34d53a3b8c2015762fdcaaff2167b28de1f56ef"
-dependencies = [
- "lexical-util",
- "static_assertions",
-]
-
-[[package]]
-name = "libc"
-version = "0.2.112"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
-
-[[package]]
-name = "libgit2-sys"
-version = "0.12.26+1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "19e1c899248e606fbfe68dcb31d8b0176ebab833b103824af31bddf4b7457494"
-dependencies = [
- "cc",
- "libc",
- "libz-sys",
- "pkg-config",
-]
-
-[[package]]
-name = "libm"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a"
-
-[[package]]
-name = "libsqlite3-sys"
-version = "0.23.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "abd5850c449b40bacb498b2bbdfaff648b1b055630073ba8db499caf2d0ea9f2"
-dependencies = [
- "cc",
- "pkg-config",
- "vcpkg",
-]
-
-[[package]]
-name = "libz-sys"
-version = "1.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66"
-dependencies = [
- "cc",
- "libc",
- "pkg-config",
- "vcpkg",
-]
-
-[[package]]
-name = "line-wrap"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9"
-dependencies = [
- "safemem",
-]
-
-[[package]]
-name = "linked-hash-map"
-version = "0.5.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
-dependencies = [
- "serde",
- "serde_test",
-]
-
-[[package]]
-name = "lock_api"
-version = "0.4.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109"
-dependencies = [
- "scopeguard",
-]
-
-[[package]]
-name = "log"
-version = "0.4.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
-dependencies = [
- "cfg-if 1.0.0",
-]
-
-[[package]]
-name = "lz4"
-version = "1.23.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aac20ed6991e01bf6a2e68cc73df2b389707403662a8ba89f68511fb340f724c"
-dependencies = [
- "libc",
- "lz4-sys",
-]
-
-[[package]]
-name = "lz4-sys"
-version = "1.9.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dca79aa95d8b3226213ad454d328369853be3a1382d89532a854f4d69640acae"
-dependencies = [
- "cc",
- "libc",
-]
-
-[[package]]
-name = "mac"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
-
-[[package]]
-name = "malloc_buf"
-version = "0.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "markup5ever"
-version = "0.10.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd"
-dependencies = [
- "log",
- "phf",
- "phf_codegen",
- "string_cache",
- "string_cache_codegen",
- "tendril",
-]
-
-[[package]]
-name = "matches"
-version = "0.1.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
-
-[[package]]
-name = "md-5"
-version = "0.9.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15"
-dependencies = [
- "block-buffer",
- "digest",
- "opaque-debug",
-]
-
-[[package]]
-name = "md5"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771"
-
-[[package]]
-name = "memchr"
-version = "2.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
-
-[[package]]
-name = "memmap2"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4647a11b578fead29cdbb34d4adef8dd3dc35b876c9c6d5240d83f205abfe96e"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "memoffset"
-version = "0.6.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
-dependencies = [
- "autocfg",
-]
-
-[[package]]
-name = "meval"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f79496a5651c8d57cd033c5add8ca7ee4e3d5f7587a4777484640d9cb60392d9"
-dependencies = [
- "fnv",
- "nom",
-]
-
-[[package]]
-name = "mime"
-version = "0.3.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
-
-[[package]]
-name = "mime_guess"
-version = "2.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212"
-dependencies = [
- "mime",
- "unicase",
-]
-
-[[package]]
-name = "miniz_oxide"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435"
-dependencies = [
- "adler32",
-]
-
-[[package]]
-name = "miniz_oxide"
-version = "0.4.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b"
-dependencies = [
- "adler",
- "autocfg",
-]
-
-[[package]]
-name = "mio"
-version = "0.7.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc"
-dependencies = [
- "libc",
- "log",
- "miow",
- "ntapi",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "miow"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
-dependencies = [
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "mp4"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "85660d4d88b9318d95396943adc4a254b3ed8bf1de917e6f093abda1ccf0bec0"
-dependencies = [
- "byteorder",
- "bytes 0.5.6",
- "num-rational 0.3.2",
- "serde",
- "serde_json",
- "thiserror",
-]
-
-[[package]]
-name = "multiversion"
-version = "0.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "025c962a3dd3cc5e0e520aa9c612201d127dcdf28616974961a649dca64f5373"
-dependencies = [
- "multiversion-macros",
-]
-
-[[package]]
-name = "multiversion-macros"
-version = "0.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a8a3e2bde382ebf960c1f3e79689fa5941625fe9bf694a1cb64af3e85faff3af"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "native-tls"
-version = "0.2.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d"
-dependencies = [
- "lazy_static",
- "libc",
- "log",
- "openssl",
- "openssl-probe",
- "openssl-sys",
- "schannel",
- "security-framework",
- "security-framework-sys",
- "tempfile",
-]
-
-[[package]]
-name = "neso"
-version = "0.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6b3c31defbcb081163db18437fd88c2a267cb3e26f7bd5e4b186e4b1b38fe8c8"
-dependencies = [
- "bincode",
- "cfg-if 0.1.10",
- "log",
- "serde",
- "serde_derive",
- "wasm-bindgen",
-]
-
-[[package]]
-name = "new_debug_unreachable"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54"
-
-[[package]]
-name = "nibble_vec"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43"
-dependencies = [
- "smallvec",
-]
-
-[[package]]
-name = "nix"
-version = "0.22.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3bb9a13fa32bc5aeb64150cd3f32d6cf4c748f8f8a417cce5d2eb976a8370ba"
-dependencies = [
- "bitflags",
- "cc",
- "cfg-if 1.0.0",
- "libc",
- "memoffset",
-]
-
-[[package]]
-name = "nodrop"
-version = "0.1.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
-
-[[package]]
-name = "nom"
-version = "1.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a5b8c256fd9471521bcb84c3cdba98921497f1a331cbc15b8030fc63b82050ce"
-
-[[package]]
-name = "ntapi"
-version = "0.3.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44"
-dependencies = [
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "nu"
-version = "0.43.0"
-dependencies = [
- "ctrlc",
- "futures 0.3.18",
- "hamcrest2",
- "itertools",
- "nu-cli",
- "nu-command",
- "nu-completion",
- "nu-data",
- "nu-engine",
- "nu-errors",
- "nu-parser",
- "nu-path",
- "nu-plugin",
- "nu-protocol",
- "nu-source",
- "nu-test-support",
- "nu-value-ext",
- "nu_plugin_binaryview",
- "nu_plugin_chart",
- "nu_plugin_from_bson",
- "nu_plugin_from_sqlite",
- "nu_plugin_inc",
- "nu_plugin_match",
- "nu_plugin_query_json",
- "nu_plugin_s3",
- "nu_plugin_selector",
- "nu_plugin_start",
- "nu_plugin_textview",
- "nu_plugin_to_bson",
- "nu_plugin_to_sqlite",
- "nu_plugin_tree",
- "nu_plugin_xpath",
- "rstest",
- "serial_test",
-]
-
-[[package]]
-name = "nu-ansi-term"
-version = "0.43.0"
-dependencies = [
- "doc-comment",
- "overload",
- "regex",
- "serde",
- "serde_json",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "nu-cli"
-version = "0.43.0"
-dependencies = [
- "ctrlc",
- "indexmap",
- "lazy_static",
- "log",
- "nu-ansi-term",
- "nu-command",
- "nu-completion",
- "nu-data",
- "nu-engine",
- "nu-errors",
- "nu-parser",
- "nu-path",
- "nu-protocol",
- "nu-source",
- "nu-stream",
- "pretty_env_logger",
- "rustyline",
- "serde",
- "serde_yaml",
- "shadow-rs",
- "strip-ansi-escapes",
-]
-
-[[package]]
-name = "nu-command"
-version = "0.43.0"
-dependencies = [
- "base64",
- "bigdecimal",
- "calamine",
- "chrono",
- "chrono-tz",
- "crossterm",
- "csv",
- "ctrlc",
- "derive-new",
- "digest",
- "dirs-next",
- "dtparse",
- "eml-parser",
- "encoding_rs",
- "filesize",
- "futures 0.3.18",
- "glob",
- "hamcrest2",
- "heck 0.4.0",
- "htmlescape",
- "ical",
- "indexmap",
- "itertools",
- "lazy_static",
- "log",
- "md-5",
- "meval",
- "mime",
- "nu-ansi-term",
- "nu-data",
- "nu-engine",
- "nu-errors",
- "nu-json",
- "nu-parser",
- "nu-path",
- "nu-plugin",
- "nu-pretty-hex",
- "nu-protocol",
- "nu-serde",
- "nu-source",
- "nu-stream",
- "nu-table",
- "nu-test-support",
- "nu-value-ext",
- "num-bigint 0.4.3",
- "num-format",
- "num-traits",
- "parking_lot",
- "polars",
- "quick-xml 0.22.0",
- "quickcheck",
- "quickcheck_macros",
- "rand 0.8.4",
- "regex",
- "reqwest",
- "roxmltree",
- "rust-embed",
- "rustyline",
- "serde",
- "serde_ini",
- "serde_json",
- "serde_urlencoded",
- "serde_yaml",
- "sha2",
- "shadow-rs",
- "strip-ansi-escapes",
- "sysinfo",
- "term",
- "term_size",
- "thiserror",
- "titlecase",
- "tokio",
- "toml",
- "trash",
- "umask",
- "unicode-segmentation",
- "url",
- "users",
- "uuid",
- "which",
- "zip",
-]
-
-[[package]]
-name = "nu-completion"
-version = "0.43.0"
-dependencies = [
- "indexmap",
- "is_executable",
- "nu-data",
- "nu-engine",
- "nu-parser",
- "nu-path",
- "nu-protocol",
- "nu-source",
- "nu-test-support",
- "parking_lot",
-]
-
-[[package]]
-name = "nu-data"
-version = "0.43.0"
-dependencies = [
- "bigdecimal",
- "byte-unit",
- "chrono",
- "common-path",
- "derive-new",
- "directories-next",
- "getset",
- "indexmap",
- "log",
- "nu-ansi-term",
- "nu-errors",
- "nu-path",
- "nu-protocol",
- "nu-source",
- "nu-table",
- "nu-test-support",
- "nu-value-ext",
- "num-bigint 0.4.3",
- "num-format",
- "num-traits",
- "serde",
- "sha2",
- "sys-locale",
- "toml",
-]
-
-[[package]]
-name = "nu-engine"
-version = "0.43.0"
-dependencies = [
- "bigdecimal",
- "bytes 1.1.0",
- "chrono",
- "codespan-reporting",
- "derive-new",
- "dirs-next",
- "encoding_rs",
- "filesize",
- "fs_extra",
- "getset",
- "glob",
- "hamcrest2",
- "indexmap",
- "itertools",
- "lazy_static",
- "log",
- "nu-ansi-term",
- "nu-data",
- "nu-errors",
- "nu-parser",
- "nu-path",
- "nu-plugin",
- "nu-protocol",
- "nu-source",
- "nu-stream",
- "nu-test-support",
- "nu-value-ext",
- "num-bigint 0.4.3",
- "parking_lot",
- "rayon",
- "serde",
- "serde_json",
- "tempfile",
- "term_size",
- "termcolor",
- "trash",
- "umask",
- "users",
- "which",
-]
-
-[[package]]
-name = "nu-errors"
-version = "0.43.0"
-dependencies = [
- "bigdecimal",
- "codespan-reporting",
- "derive-new",
- "getset",
- "glob",
- "nu-ansi-term",
- "nu-source",
- "num-bigint 0.4.3",
- "num-traits",
- "serde",
- "serde_json",
- "serde_yaml",
- "toml",
-]
-
-[[package]]
-name = "nu-json"
-version = "0.43.0"
-dependencies = [
- "lazy_static",
- "linked-hash-map",
- "nu-path",
- "nu-test-support",
- "num-traits",
- "regex",
- "serde",
- "serde_json",
-]
-
-[[package]]
-name = "nu-parser"
-version = "0.43.0"
-dependencies = [
- "bigdecimal",
- "derive-new",
- "indexmap",
- "itertools",
- "log",
- "nu-data",
- "nu-errors",
- "nu-path",
- "nu-protocol",
- "nu-source",
- "nu-test-support",
- "num-bigint 0.4.3",
- "smart-default",
-]
-
-[[package]]
-name = "nu-path"
-version = "0.43.0"
-dependencies = [
- "dirs-next",
- "dunce",
-]
-
-[[package]]
-name = "nu-plugin"
-version = "0.43.0"
-dependencies = [
- "indexmap",
- "nu-errors",
- "nu-protocol",
- "nu-source",
- "nu-test-support",
- "nu-value-ext",
- "serde",
- "serde_json",
-]
-
-[[package]]
-name = "nu-pretty-hex"
-version = "0.43.0"
-dependencies = [
- "heapless",
- "nu-ansi-term",
- "rand 0.8.4",
-]
-
-[[package]]
-name = "nu-protocol"
-version = "0.43.0"
-dependencies = [
- "bigdecimal",
- "byte-unit",
- "chrono",
- "chrono-humanize",
- "derive-new",
- "getset",
- "indexmap",
- "log",
- "nu-errors",
- "nu-source",
- "num-bigint 0.4.3",
- "num-integer",
- "num-traits",
- "polars",
- "serde",
- "serde_bytes",
-]
-
-[[package]]
-name = "nu-serde"
-version = "0.43.0"
-dependencies = [
- "bigdecimal",
- "insta",
- "nu-protocol",
- "nu-source",
- "serde",
- "thiserror",
-]
-
-[[package]]
-name = "nu-source"
-version = "0.43.0"
-dependencies = [
- "derive-new",
- "getset",
- "pretty",
- "serde",
- "termcolor",
-]
-
-[[package]]
-name = "nu-stream"
-version = "0.43.0"
-dependencies = [
- "nu-errors",
- "nu-protocol",
- "nu-source",
-]
-
-[[package]]
-name = "nu-table"
-version = "0.43.0"
-dependencies = [
- "atty",
- "nu-ansi-term",
- "regex",
- "strip-ansi-escapes",
- "unicode-width",
-]
-
-[[package]]
-name = "nu-test-support"
-version = "0.43.0"
-dependencies = [
- "bigdecimal",
- "chrono",
- "getset",
- "glob",
- "hamcrest2",
- "indexmap",
- "nu-errors",
- "nu-path",
- "nu-protocol",
- "nu-source",
- "num-bigint 0.4.3",
- "tempfile",
-]
-
-[[package]]
-name = "nu-value-ext"
-version = "0.43.0"
-dependencies = [
- "indexmap",
- "itertools",
- "nu-errors",
- "nu-protocol",
- "nu-source",
- "num-traits",
-]
-
-[[package]]
-name = "nu_plugin_binaryview"
-version = "0.43.0"
-dependencies = [
- "crossterm",
- "image",
- "neso",
- "nu-ansi-term",
- "nu-errors",
- "nu-plugin",
- "nu-pretty-hex",
- "nu-protocol",
- "nu-source",
- "rawkey",
-]
-
-[[package]]
-name = "nu_plugin_chart"
-version = "0.43.0"
-dependencies = [
- "crossterm",
- "nu-data",
- "nu-errors",
- "nu-plugin",
- "nu-protocol",
- "nu-source",
- "nu-value-ext",
- "tui",
-]
-
-[[package]]
-name = "nu_plugin_from_bson"
-version = "0.43.0"
-dependencies = [
- "bigdecimal",
- "bson",
- "nu-errors",
- "nu-plugin",
- "nu-protocol",
- "nu-source",
-]
-
-[[package]]
-name = "nu_plugin_from_mp4"
-version = "0.43.0"
-dependencies = [
- "mp4",
- "nu-errors",
- "nu-plugin",
- "nu-protocol",
- "nu-source",
- "tempfile",
-]
-
-[[package]]
-name = "nu_plugin_from_sqlite"
-version = "0.43.0"
-dependencies = [
- "bigdecimal",
- "nu-errors",
- "nu-plugin",
- "nu-protocol",
- "nu-source",
- "rusqlite",
- "tempfile",
-]
-
-[[package]]
-name = "nu_plugin_inc"
-version = "0.43.0"
-dependencies = [
- "nu-errors",
- "nu-plugin",
- "nu-protocol",
- "nu-source",
- "nu-test-support",
- "nu-value-ext",
- "semver 0.11.0",
-]
-
-[[package]]
-name = "nu_plugin_match"
-version = "0.43.0"
-dependencies = [
- "nu-errors",
- "nu-plugin",
- "nu-protocol",
- "regex",
-]
-
-[[package]]
-name = "nu_plugin_query_json"
-version = "0.43.0"
-dependencies = [
- "gjson",
- "nu-errors",
- "nu-plugin",
- "nu-protocol",
- "nu-source",
-]
-
-[[package]]
-name = "nu_plugin_s3"
-version = "0.43.0"
-dependencies = [
- "futures 0.3.18",
- "nu-errors",
- "nu-plugin",
- "nu-protocol",
- "nu-source",
- "s3handler",
-]
-
-[[package]]
-name = "nu_plugin_selector"
-version = "0.43.0"
-dependencies = [
- "indexmap",
- "nu-errors",
- "nu-plugin",
- "nu-protocol",
- "nu-source",
- "scraper",
-]
-
-[[package]]
-name = "nu_plugin_start"
-version = "0.43.0"
-dependencies = [
- "glob",
- "nu-errors",
- "nu-plugin",
- "nu-protocol",
- "nu-source",
- "open",
- "url",
- "webbrowser",
-]
-
-[[package]]
-name = "nu_plugin_textview"
-version = "0.43.0"
-dependencies = [
- "bat",
- "nu-data",
- "nu-errors",
- "nu-plugin",
- "nu-protocol",
- "nu-source",
- "term_size",
- "url",
-]
-
-[[package]]
-name = "nu_plugin_to_bson"
-version = "0.43.0"
-dependencies = [
- "bson",
- "nu-errors",
- "nu-plugin",
- "nu-protocol",
- "nu-source",
- "num-traits",
-]
-
-[[package]]
-name = "nu_plugin_to_sqlite"
-version = "0.43.0"
-dependencies = [
- "hex",
- "nu-errors",
- "nu-plugin",
- "nu-protocol",
- "nu-source",
- "rusqlite",
- "tempfile",
-]
-
-[[package]]
-name = "nu_plugin_tree"
-version = "0.43.0"
-dependencies = [
- "derive-new",
- "nu-errors",
- "nu-plugin",
- "nu-protocol",
- "ptree",
-]
-
-[[package]]
-name = "nu_plugin_xpath"
-version = "0.43.0"
-dependencies = [
- "bigdecimal",
- "indexmap",
- "nu-errors",
- "nu-plugin",
- "nu-protocol",
- "nu-source",
- "nu-test-support",
- "sxd-document",
- "sxd-xpath",
-]
-
-[[package]]
-name = "num"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36"
-dependencies = [
- "num-bigint 0.2.6",
- "num-complex 0.2.4",
- "num-integer",
- "num-iter",
- "num-rational 0.2.4",
- "num-traits",
-]
-
-[[package]]
-name = "num"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606"
-dependencies = [
- "num-bigint 0.4.3",
- "num-complex 0.4.0",
- "num-integer",
- "num-iter",
- "num-rational 0.4.0",
- "num-traits",
-]
-
-[[package]]
-name = "num-bigint"
-version = "0.2.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304"
-dependencies = [
- "autocfg",
- "num-integer",
- "num-traits",
-]
-
-[[package]]
-name = "num-bigint"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3"
-dependencies = [
- "autocfg",
- "num-integer",
- "num-traits",
-]
-
-[[package]]
-name = "num-bigint"
-version = "0.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f"
-dependencies = [
- "autocfg",
- "num-integer",
- "num-traits",
- "serde",
-]
-
-[[package]]
-name = "num-complex"
-version = "0.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95"
-dependencies = [
- "autocfg",
- "num-traits",
-]
-
-[[package]]
-name = "num-complex"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26873667bbbb7c5182d4a37c1add32cdf09f841af72da53318fdb81543c15085"
-dependencies = [
- "num-traits",
-]
-
-[[package]]
-name = "num-format"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bafe4179722c2894288ee77a9f044f02811c86af699344c498b0840c698a2465"
-dependencies = [
- "arrayvec 0.4.12",
- "itoa",
- "num-bigint 0.2.6",
-]
-
-[[package]]
-name = "num-integer"
-version = "0.1.44"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
-dependencies = [
- "autocfg",
- "num-traits",
-]
-
-[[package]]
-name = "num-iter"
-version = "0.1.42"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59"
-dependencies = [
- "autocfg",
- "num-integer",
- "num-traits",
-]
-
-[[package]]
-name = "num-rational"
-version = "0.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef"
-dependencies = [
- "autocfg",
- "num-bigint 0.2.6",
- "num-integer",
- "num-traits",
-]
-
-[[package]]
-name = "num-rational"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07"
-dependencies = [
- "autocfg",
- "num-bigint 0.3.3",
- "num-integer",
- "num-traits",
- "serde",
-]
-
-[[package]]
-name = "num-rational"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d41702bd167c2df5520b384281bc111a4b5efcf7fbc4c9c222c815b07e0a6a6a"
-dependencies = [
- "autocfg",
- "num-bigint 0.4.3",
- "num-integer",
- "num-traits",
-]
-
-[[package]]
-name = "num-traits"
-version = "0.2.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
-dependencies = [
- "autocfg",
- "libm",
-]
-
-[[package]]
-name = "num_cpus"
-version = "1.13.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
-dependencies = [
- "hermit-abi",
- "libc",
-]
-
-[[package]]
-name = "objc"
-version = "0.2.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
-dependencies = [
- "malloc_buf",
-]
-
-[[package]]
-name = "object"
-version = "0.27.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9"
-dependencies = [
- "memchr",
-]
-
-[[package]]
-name = "once_cell"
-version = "1.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
-
-[[package]]
-name = "onig"
-version = "6.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "67ddfe2c93bb389eea6e6d713306880c7f6dcc99a75b659ce145d962c861b225"
-dependencies = [
- "bitflags",
- "lazy_static",
- "libc",
- "onig_sys",
-]
-
-[[package]]
-name = "onig_sys"
-version = "69.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5dd3eee045c84695b53b20255bb7317063df090b68e18bfac0abb6c39cf7f33e"
-dependencies = [
- "cc",
- "pkg-config",
-]
-
-[[package]]
-name = "opaque-debug"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
-
-[[package]]
-name = "open"
-version = "1.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dcea7a30d6b81a2423cc59c43554880feff7b57d12916f231a79f8d6d9470201"
-dependencies = [
- "pathdiff",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "openssl"
-version = "0.10.38"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95"
-dependencies = [
- "bitflags",
- "cfg-if 1.0.0",
- "foreign-types",
- "libc",
- "once_cell",
- "openssl-sys",
-]
-
-[[package]]
-name = "openssl-probe"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a"
-
-[[package]]
-name = "openssl-sys"
-version = "0.9.71"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7df13d165e607909b363a4757a6f133f8a818a74e9d3a98d09c6128e15fa4c73"
-dependencies = [
- "autocfg",
- "cc",
- "libc",
- "pkg-config",
- "vcpkg",
-]
-
-[[package]]
-name = "ordered-float"
-version = "1.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3305af35278dd29f46fcdd139e0b1fbfae2153f0e5928b39b035542dd31e37b7"
-dependencies = [
- "num-traits",
-]
-
-[[package]]
-name = "overload"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
-
-[[package]]
-name = "parking_lot"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
-dependencies = [
- "instant",
- "lock_api",
- "parking_lot_core",
-]
-
-[[package]]
-name = "parking_lot_core"
-version = "0.8.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
-dependencies = [
- "cfg-if 1.0.0",
- "instant",
- "libc",
- "redox_syscall",
- "smallvec",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "parquet-format-async-temp"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03abc2f9c83fe9ceec83f47c76cc071bfd56caba33794340330f35623ab1f544"
-dependencies = [
- "async-trait",
- "byteorder",
- "futures 0.3.18",
- "integer-encoding",
- "ordered-float",
-]
-
-[[package]]
-name = "parquet2"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "db82df54cdd88931d29b850190915b9069bb93fba8e1aefc0d59d8ca81603d6d"
-dependencies = [
- "async-stream",
- "bitpacking",
- "brotli",
- "flate2",
- "futures 0.3.18",
- "lz4",
- "parquet-format-async-temp",
- "snap",
- "streaming-decompression",
- "zstd",
-]
-
-[[package]]
-name = "parse-zoneinfo"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c705f256449c60da65e11ff6626e0c16a0a0b96aaa348de61376b249bc340f41"
-dependencies = [
- "regex",
-]
-
-[[package]]
-name = "path_abs"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "05ef02f6342ac01d8a93b65f96db53fe68a92a15f41144f97fb00a9e669633c3"
-dependencies = [
- "std_prelude",
-]
-
-[[package]]
-name = "pathdiff"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
-
-[[package]]
-name = "percent-encoding"
-version = "2.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
-
-[[package]]
-name = "peresil"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f658886ed52e196e850cfbbfddab9eaa7f6d90dd0929e264c31e5cec07e09e57"
-
-[[package]]
-name = "pest"
-version = "2.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53"
-dependencies = [
- "ucd-trie",
-]
-
-[[package]]
-name = "phf"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"
-dependencies = [
- "phf_macros",
- "phf_shared",
- "proc-macro-hack",
-]
-
-[[package]]
-name = "phf_codegen"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815"
-dependencies = [
- "phf_generator",
- "phf_shared",
-]
-
-[[package]]
-name = "phf_generator"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526"
-dependencies = [
- "phf_shared",
- "rand 0.7.3",
-]
-
-[[package]]
-name = "phf_macros"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f6fde18ff429ffc8fe78e2bf7f8b7a5a5a6e2a8b58bc5a9ac69198bbda9189c"
-dependencies = [
- "phf_generator",
- "phf_shared",
- "proc-macro-hack",
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "phf_shared"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7"
-dependencies = [
- "siphasher",
-]
-
-[[package]]
-name = "pin-project-lite"
-version = "0.2.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443"
-
-[[package]]
-name = "pin-utils"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
-
-[[package]]
-name = "pkg-config"
-version = "0.3.22"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12295df4f294471248581bc09bef3c38a5e46f1e36d6a37353621a0c6c357e1f"
-
-[[package]]
-name = "plist"
-version = "1.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd39bc6cdc9355ad1dc5eeedefee696bb35c34caf21768741e81826c0bbd7225"
-dependencies = [
- "base64",
- "indexmap",
- "line-wrap",
- "serde",
- "time 0.3.5",
- "xml-rs",
-]
-
-[[package]]
-name = "png"
-version = "0.16.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6"
-dependencies = [
- "bitflags",
- "crc32fast",
- "deflate",
- "miniz_oxide 0.3.7",
-]
-
-[[package]]
-name = "polars"
-version = "0.17.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7c94a25d46e93b64eac7848c028a545dc08fa01e148e4942c5442b3843c3a598"
-dependencies = [
- "polars-core",
- "polars-io",
- "polars-lazy",
-]
-
-[[package]]
-name = "polars-arrow"
-version = "0.17.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1cc4488d2f2d6b901bb6e5728e58966013a272cae48861070b676215a79b4a99"
-dependencies = [
- "arrow2",
- "num 0.4.0",
- "thiserror",
-]
-
-[[package]]
-name = "polars-core"
-version = "0.17.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6771524063d742a08163d96875ca5df71dff7113f27da58db5ec5fa164165bf6"
-dependencies = [
- "ahash",
- "anyhow",
- "arrow2",
- "chrono",
- "comfy-table",
- "hashbrown",
- "itertools",
- "lazy_static",
- "num 0.4.0",
- "num_cpus",
- "polars-arrow",
- "rand 0.7.3",
- "rand_distr",
- "rayon",
- "regex",
- "serde",
- "serde_json",
- "thiserror",
- "unsafe_unwrap",
-]
-
-[[package]]
-name = "polars-io"
-version = "0.17.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "11a5f5f51525043ee7befd49e586e6919345237826a5f17b53956f8242100957"
-dependencies = [
- "ahash",
- "anyhow",
- "arrow2",
- "csv-core",
- "dirs",
- "lazy_static",
- "lexical",
- "memchr",
- "memmap2",
- "num 0.4.0",
- "num_cpus",
- "polars-arrow",
- "polars-core",
- "rayon",
- "regex",
- "simdutf8",
-]
-
-[[package]]
-name = "polars-lazy"
-version = "0.17.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da3ea647e2fa59d1bbbf90929c5d10ef6a9018aac256d1c6d0e8248211804b61"
-dependencies = [
- "ahash",
- "itertools",
- "polars-arrow",
- "polars-core",
- "polars-io",
- "rayon",
-]
-
-[[package]]
-name = "ppv-lite86"
-version = "0.2.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba"
-
-[[package]]
-name = "precomputed-hash"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
-
-[[package]]
-name = "pretty"
-version = "0.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f60c0d9f6fc88ecdd245d90c1920ff76a430ab34303fc778d33b1d0a4c3bf6d3"
-dependencies = [
- "typed-arena",
-]
-
-[[package]]
-name = "pretty_env_logger"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d"
-dependencies = [
- "env_logger 0.7.1",
- "log",
-]
-
-[[package]]
-name = "proc-macro-error"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
-dependencies = [
- "proc-macro-error-attr",
- "proc-macro2",
- "quote",
- "syn",
- "version_check",
-]
-
-[[package]]
-name = "proc-macro-error-attr"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
-dependencies = [
- "proc-macro2",
- "quote",
- "version_check",
-]
-
-[[package]]
-name = "proc-macro-hack"
-version = "0.5.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
-
-[[package]]
-name = "proc-macro2"
-version = "1.0.32"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43"
-dependencies = [
- "unicode-xid",
-]
-
-[[package]]
-name = "ptree"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a0de80796b316aec75344095a6d2ef68ec9b8f573b9e7adc821149ba3598e270"
-dependencies = [
- "serde",
-]
-
-[[package]]
-name = "quick-error"
-version = "1.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
-
-[[package]]
-name = "quick-xml"
-version = "0.19.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b3d72d5477478f85bd00b6521780dfba1ec6cdaadcf90b8b181c36d7de561f9b"
-dependencies = [
- "encoding_rs",
- "memchr",
-]
-
-[[package]]
-name = "quick-xml"
-version = "0.22.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8533f14c8382aaad0d592c812ac3b826162128b65662331e1127b45c3d18536b"
-dependencies = [
- "memchr",
-]
-
-[[package]]
-name = "quickcheck"
-version = "1.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "588f6378e4dd99458b60ec275b4477add41ce4fa9f64dcba6f15adccb19b50d6"
-dependencies = [
- "env_logger 0.8.4",
- "log",
- "rand 0.8.4",
-]
-
-[[package]]
-name = "quickcheck_macros"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b22a693222d716a9587786f37ac3f6b4faedb5b80c23914e7303ff5a1d8016e9"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "quote"
-version = "1.0.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
-dependencies = [
- "proc-macro2",
-]
-
-[[package]]
-name = "radix_trie"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd"
-dependencies = [
- "endian-type",
- "nibble_vec",
-]
-
-[[package]]
-name = "rand"
-version = "0.7.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
-dependencies = [
- "getrandom 0.1.16",
- "libc",
- "rand_chacha 0.2.2",
- "rand_core 0.5.1",
- "rand_hc 0.2.0",
- "rand_pcg",
-]
-
-[[package]]
-name = "rand"
-version = "0.8.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
-dependencies = [
- "libc",
- "rand_chacha 0.3.1",
- "rand_core 0.6.3",
- "rand_hc 0.3.1",
-]
-
-[[package]]
-name = "rand_chacha"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
-dependencies = [
- "ppv-lite86",
- "rand_core 0.5.1",
-]
-
-[[package]]
-name = "rand_chacha"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
-dependencies = [
- "ppv-lite86",
- "rand_core 0.6.3",
-]
-
-[[package]]
-name = "rand_core"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
-dependencies = [
- "getrandom 0.1.16",
-]
-
-[[package]]
-name = "rand_core"
-version = "0.6.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
-dependencies = [
- "getrandom 0.2.3",
-]
-
-[[package]]
-name = "rand_distr"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c9e9532ada3929fb8b2e9dbe28d1e06c9b2cc65813f074fcb6bd5fbefeff9d56"
-dependencies = [
- "num-traits",
- "rand 0.7.3",
-]
-
-[[package]]
-name = "rand_hc"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
-dependencies = [
- "rand_core 0.5.1",
-]
-
-[[package]]
-name = "rand_hc"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7"
-dependencies = [
- "rand_core 0.6.3",
-]
-
-[[package]]
-name = "rand_pcg"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429"
-dependencies = [
- "rand_core 0.5.1",
-]
-
-[[package]]
-name = "rawkey"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ad6efac35ef044d565b23f0d111d76aa21ab2e86934b1225f7071d42e58ebad"
-dependencies = [
- "readkey",
- "user32-sys",
- "winapi 0.3.9",
- "x11",
-]
-
-[[package]]
-name = "rayon"
-version = "1.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90"
-dependencies = [
- "autocfg",
- "crossbeam-deque",
- "either",
- "rayon-core",
-]
-
-[[package]]
-name = "rayon-core"
-version = "1.9.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e"
-dependencies = [
- "crossbeam-channel",
- "crossbeam-deque",
- "crossbeam-utils",
- "lazy_static",
- "num_cpus",
-]
-
-[[package]]
-name = "readkey"
-version = "0.1.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86d401b6d6a1725a59f1b4e813275d289dff3ad09c72b373a10a7a8217ba3146"
-
-[[package]]
-name = "redox_syscall"
-version = "0.2.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff"
-dependencies = [
- "bitflags",
-]
-
-[[package]]
-name = "redox_users"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64"
-dependencies = [
- "getrandom 0.2.3",
- "redox_syscall",
-]
-
-[[package]]
-name = "regex"
-version = "1.5.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
-dependencies = [
- "aho-corasick",
- "memchr",
- "regex-syntax",
-]
-
-[[package]]
-name = "regex-automata"
-version = "0.1.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
-
-[[package]]
-name = "regex-syntax"
-version = "0.6.25"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
-
-[[package]]
-name = "remove_dir_all"
-version = "0.5.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
-dependencies = [
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "reqwest"
-version = "0.11.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "07bea77bc708afa10e59905c3d4af7c8fd43c9214251673095ff8b14345fcbc5"
-dependencies = [
- "base64",
- "bytes 1.1.0",
- "encoding_rs",
- "futures-core",
- "futures-util",
- "http",
- "http-body",
- "hyper",
- "hyper-tls",
- "ipnet",
- "js-sys",
- "lazy_static",
- "log",
- "mime",
- "native-tls",
- "percent-encoding",
- "pin-project-lite",
- "serde",
- "serde_json",
- "serde_urlencoded",
- "tokio",
- "tokio-native-tls",
- "url",
- "wasm-bindgen",
- "wasm-bindgen-futures",
- "web-sys",
- "winreg",
-]
-
-[[package]]
-name = "result"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "194d8e591e405d1eecf28819740abed6d719d1a2db87fc0bcdedee9a26d55560"
-
-[[package]]
-name = "roxmltree"
-version = "0.14.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "921904a62e410e37e215c40381b7117f830d9d89ba60ab5236170541dd25646b"
-dependencies = [
- "xmlparser",
-]
-
-[[package]]
-name = "rstest"
-version = "0.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "041bb0202c14f6a158bbbf086afb03d0c6e975c2dec7d4912f8061ed44f290af"
-dependencies = [
- "cfg-if 1.0.0",
- "proc-macro2",
- "quote",
- "rustc_version 0.3.3",
- "syn",
-]
-
-[[package]]
-name = "rusqlite"
-version = "0.26.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a82b0b91fad72160c56bf8da7a549b25d7c31109f52cc1437eac4c0ad2550a7"
-dependencies = [
- "bitflags",
- "fallible-iterator",
- "fallible-streaming-iterator",
- "hashlink",
- "libsqlite3-sys",
- "memchr",
- "smallvec",
-]
-
-[[package]]
-name = "rust-embed"
-version = "5.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fe1fe6aac5d6bb9e1ffd81002340363272a7648234ec7bdfac5ee202cb65523"
-dependencies = [
- "rust-embed-impl",
- "rust-embed-utils",
- "walkdir",
-]
-
-[[package]]
-name = "rust-embed-impl"
-version = "5.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3ed91c41c42ef7bf687384439c312e75e0da9c149b0390889b94de3c7d9d9e66"
-dependencies = [
- "proc-macro2",
- "quote",
- "rust-embed-utils",
- "syn",
- "walkdir",
-]
-
-[[package]]
-name = "rust-embed-utils"
-version = "5.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2a512219132473ab0a77b52077059f1c47ce4af7fbdc94503e9862a34422876d"
-dependencies = [
- "walkdir",
-]
-
-[[package]]
-name = "rust_decimal"
-version = "0.10.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a93c95e3d5c1d997e6e4ba9bda898f4e1d73934cd05510c972f10087d0ef00c1"
-dependencies = [
- "byteorder",
- "lazy_static",
- "num 0.2.1",
- "serde",
-]
-
-[[package]]
-name = "rustc-demangle"
-version = "0.1.21"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
-
-[[package]]
-name = "rustc-serialize"
-version = "0.3.24"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
-
-[[package]]
-name = "rustc_version"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee"
-dependencies = [
- "semver 0.11.0",
-]
-
-[[package]]
-name = "rustc_version"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
-dependencies = [
- "semver 1.0.4",
-]
-
-[[package]]
-name = "rustversion"
-version = "1.0.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "61b3909d758bb75c79f23d4736fac9433868679d3ad2ea7a61e3c25cfda9a088"
-
-[[package]]
-name = "rustyline"
-version = "9.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "790487c3881a63489ae77126f57048b42d62d3b2bafbf37453ea19eedb6340d6"
-dependencies = [
- "bitflags",
- "cfg-if 1.0.0",
- "clipboard-win",
- "dirs-next",
- "fd-lock",
- "libc",
- "log",
- "memchr",
- "nix",
- "radix_trie",
- "scopeguard",
- "smallvec",
- "unicode-segmentation",
- "unicode-width",
- "utf8parse",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "ryu"
-version = "1.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c9613b5a66ab9ba26415184cfc41156594925a9cf3a2057e57f31ff145f6568"
-
-[[package]]
-name = "s3handler"
-version = "0.7.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00b9590f1cae0b8b38aceabab05885c754416b6d33089c244a25441ae997fdb1"
-dependencies = [
- "async-trait",
- "base64",
- "bytes 1.1.0",
- "chrono",
- "dyn-clone",
- "failure",
- "failure_derive",
- "futures 0.3.18",
- "hex",
- "hmac",
- "hmac-sha1",
- "log",
- "md5",
- "mime_guess",
- "quick-xml 0.22.0",
- "regex",
- "reqwest",
- "rustc-serialize",
- "serde",
- "serde_derive",
- "serde_json",
- "sha2",
- "tokio",
- "url",
-]
-
-[[package]]
-name = "safemem"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072"
-
-[[package]]
-name = "same-file"
-version = "1.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
-dependencies = [
- "winapi-util",
-]
-
-[[package]]
-name = "schannel"
-version = "0.1.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75"
-dependencies = [
- "lazy_static",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "scopeguard"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
-
-[[package]]
-name = "scraper"
-version = "0.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48e02aa790c80c2e494130dec6a522033b6a23603ffc06360e9fe6c611ea2c12"
-dependencies = [
- "cssparser",
- "ego-tree",
- "getopts",
- "html5ever",
- "matches",
- "selectors",
- "smallvec",
- "tendril",
-]
-
-[[package]]
-name = "security-framework"
-version = "2.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "23a2ac85147a3a11d77ecf1bc7166ec0b92febfa4461c37944e180f319ece467"
-dependencies = [
- "bitflags",
- "core-foundation",
- "core-foundation-sys",
- "libc",
- "security-framework-sys",
-]
-
-[[package]]
-name = "security-framework-sys"
-version = "2.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9dd14d83160b528b7bfd66439110573efcfbe281b17fc2ca9f39f550d619c7e"
-dependencies = [
- "core-foundation-sys",
- "libc",
-]
-
-[[package]]
-name = "selectors"
-version = "0.22.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df320f1889ac4ba6bc0cdc9c9af7af4bd64bb927bccdf32d81140dc1f9be12fe"
-dependencies = [
- "bitflags",
- "cssparser",
- "derive_more",
- "fxhash",
- "log",
- "matches",
- "phf",
- "phf_codegen",
- "precomputed-hash",
- "servo_arc",
- "smallvec",
- "thin-slice",
-]
-
-[[package]]
-name = "semver"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6"
-dependencies = [
- "semver-parser",
-]
-
-[[package]]
-name = "semver"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012"
-
-[[package]]
-name = "semver-parser"
-version = "0.10.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7"
-dependencies = [
- "pest",
-]
-
-[[package]]
-name = "serde"
-version = "1.0.130"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913"
-dependencies = [
- "serde_derive",
-]
-
-[[package]]
-name = "serde_bytes"
-version = "0.11.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "16ae07dd2f88a366f15bd0632ba725227018c69a1c8550a927324f8eb8368bb9"
-dependencies = [
- "serde",
-]
-
-[[package]]
-name = "serde_derive"
-version = "1.0.130"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "serde_ini"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eb236687e2bb073a7521c021949be944641e671b8505a94069ca37b656c81139"
-dependencies = [
- "result",
- "serde",
- "void",
-]
-
-[[package]]
-name = "serde_json"
-version = "1.0.72"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d0ffa0837f2dfa6fb90868c2b5468cad482e175f7dad97e7421951e663f2b527"
-dependencies = [
- "indexmap",
- "itoa",
- "ryu",
- "serde",
-]
-
-[[package]]
-name = "serde_test"
-version = "1.0.130"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d82178225dbdeae2d5d190e8649287db6a3a32c6d24da22ae3146325aa353e4c"
-dependencies = [
- "serde",
-]
-
-[[package]]
-name = "serde_urlencoded"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9"
-dependencies = [
- "form_urlencoded",
- "itoa",
- "ryu",
- "serde",
-]
-
-[[package]]
-name = "serde_yaml"
-version = "0.8.21"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d8c608a35705a5d3cdc9fbe403147647ff34b921f8e833e49306df898f9b20af"
-dependencies = [
- "dtoa",
- "indexmap",
- "serde",
- "yaml-rust",
-]
-
-[[package]]
-name = "serial_test"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e0bccbcf40c8938196944a3da0e133e031a33f4d6b72db3bda3cc556e361905d"
-dependencies = [
- "lazy_static",
- "parking_lot",
- "serial_test_derive",
-]
-
-[[package]]
-name = "serial_test_derive"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b2acd6defeddb41eb60bb468f8825d0cfd0c2a76bc03bfd235b6a1dc4f6a1ad5"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "servo_arc"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d98238b800e0d1576d8b6e3de32827c2d74bee68bb97748dcf5071fb53965432"
-dependencies = [
- "nodrop",
- "stable_deref_trait",
-]
-
-[[package]]
-name = "sha1"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc30b1e1e8c40c121ca33b86c23308a090d19974ef001b4bf6e61fd1a0fb095c"
-
-[[package]]
-name = "sha2"
-version = "0.9.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa"
-dependencies = [
- "block-buffer",
- "cfg-if 1.0.0",
- "cpufeatures",
- "digest",
- "opaque-debug",
-]
-
-[[package]]
-name = "shadow-rs"
-version = "0.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8935e920eb80ff8f5a5bced990325d12f6cc1015154a3852c6a23cf5bd71c447"
-dependencies = [
- "chrono",
- "git2",
- "is_debug",
-]
-
-[[package]]
-name = "shell-escape"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f"
-
-[[package]]
-name = "shell-words"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b6fa3938c99da4914afedd13bf3d79bcb6c277d1b2c398d23257a304d9e1b074"
-
-[[package]]
-name = "signal-hook"
-version = "0.1.17"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7e31d442c16f047a671b5a71e2161d6e68814012b7f5379d269ebd915fac2729"
-dependencies = [
- "libc",
- "mio",
- "signal-hook-registry",
-]
-
-[[package]]
-name = "signal-hook-registry"
-version = "1.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "simdutf8"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c970da16e7c682fa90a261cf0724dee241c9f7831635ecc4e988ae8f3b505559"
-
-[[package]]
-name = "similar"
-version = "1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ad1d488a557b235fc46dae55512ffbfc429d2482b08b4d9435ab07384ca8aec"
-
-[[package]]
-name = "siphasher"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "533494a8f9b724d33625ab53c6c4800f7cc445895924a8ef649222dcb76e938b"
-
-[[package]]
-name = "slab"
-version = "0.4.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5"
-
-[[package]]
-name = "smallvec"
-version = "1.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309"
-
-[[package]]
-name = "smart-default"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "snap"
-version = "1.0.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "45456094d1983e2ee2a18fdfebce3189fa451699d0502cb8e3b49dba5ba41451"
-
-[[package]]
-name = "socket2"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516"
-dependencies = [
- "libc",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "spin"
-version = "0.9.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "511254be0c5bcf062b019a6c89c01a664aa359ded62f78aa72c6fc137c0590e5"
-dependencies = [
- "lock_api",
-]
-
-[[package]]
-name = "stable_deref_trait"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
-
-[[package]]
-name = "static_assertions"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
-
-[[package]]
-name = "std_prelude"
-version = "0.2.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8207e78455ffdf55661170876f88daf85356e4edd54e0a3dbc79586ca1e50cbe"
-
-[[package]]
-name = "str-buf"
-version = "1.0.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d44a3643b4ff9caf57abcee9c2c621d6c03d9135e0d8b589bd9afb5992cb176a"
-
-[[package]]
-name = "streaming-decompression"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9bc687acd5dc742c4a7094f2927a8614a68e4743ef682e7a2f9f0f711656cc92"
-dependencies = [
- "fallible-streaming-iterator",
-]
-
-[[package]]
-name = "streaming-iterator"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "303235c177994a476226b80d076bd333b7b560fb05bd242a10609d11b07f81f5"
-
-[[package]]
-name = "strength_reduce"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a3ff2f71c82567c565ba4b3009a9350a96a7269eaa4001ebedae926230bc2254"
-
-[[package]]
-name = "string_cache"
-version = "0.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "923f0f39b6267d37d23ce71ae7235602134b250ace715dd2c90421998ddac0c6"
-dependencies = [
- "lazy_static",
- "new_debug_unreachable",
- "parking_lot",
- "phf_shared",
- "precomputed-hash",
- "serde",
-]
-
-[[package]]
-name = "string_cache_codegen"
-version = "0.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f24c8e5e19d22a726626f1a5e16fe15b132dcf21d10177fa5a45ce7962996b97"
-dependencies = [
- "phf_generator",
- "phf_shared",
- "proc-macro2",
- "quote",
-]
-
-[[package]]
-name = "strip-ansi-escapes"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "011cbb39cf7c1f62871aea3cc46e5817b0937b49e9447370c93cacbe93a766d8"
-dependencies = [
- "vte",
-]
-
-[[package]]
-name = "strum"
-version = "0.20.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7318c509b5ba57f18533982607f24070a55d353e90d4cae30c467cdb2ad5ac5c"
-
-[[package]]
-name = "strum_macros"
-version = "0.20.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ee8bc6b87a5112aeeab1f4a9f7ab634fe6cbefc4850006df31267f4cfb9e3149"
-dependencies = [
- "heck 0.3.3",
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "subtle"
-version = "2.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
-
-[[package]]
-name = "sxd-document"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "94d82f37be9faf1b10a82c4bd492b74f698e40082f0f40de38ab275f31d42078"
-dependencies = [
- "peresil",
- "typed-arena",
-]
-
-[[package]]
-name = "sxd-xpath"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "36e39da5d30887b5690e29de4c5ebb8ddff64ebd9933f98a01daaa4fd11b36ea"
-dependencies = [
- "peresil",
- "quick-error",
- "sxd-document",
-]
-
-[[package]]
-name = "syn"
-version = "1.0.82"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59"
-dependencies = [
- "proc-macro2",
- "quote",
- "unicode-xid",
-]
-
-[[package]]
-name = "synstructure"
-version = "0.12.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
- "unicode-xid",
-]
-
-[[package]]
-name = "syntect"
-version = "4.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b20815bbe80ee0be06e6957450a841185fcf690fe0178f14d77a05ce2caa031"
-dependencies = [
- "bincode",
- "bitflags",
- "flate2",
- "fnv",
- "lazy_static",
- "lazycell",
- "onig",
- "plist",
- "regex-syntax",
- "serde",
- "serde_derive",
- "serde_json",
- "walkdir",
- "yaml-rust",
-]
-
-[[package]]
-name = "sys-info"
-version = "0.9.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b3a0d0aba8bf96a0e1ddfdc352fc53b3df7f39318c71854910c3c4b024ae52c"
-dependencies = [
- "cc",
- "libc",
-]
-
-[[package]]
-name = "sys-locale"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "91f89ebb59fa30d4f65fafc2d68e94f6975256fd87e812dd99cb6e020c8563df"
-dependencies = [
- "cc",
- "cstr_core",
- "libc",
- "web-sys",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "sysinfo"
-version = "0.23.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e757000a4bed2b1be9be65a3f418b9696adf30bb419214c73997422de73a591"
-dependencies = [
- "cfg-if 1.0.0",
- "core-foundation-sys",
- "libc",
- "ntapi",
- "once_cell",
- "rayon",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "tempfile"
-version = "3.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
-dependencies = [
- "cfg-if 1.0.0",
- "libc",
- "rand 0.8.4",
- "redox_syscall",
- "remove_dir_all",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "tendril"
-version = "0.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9ef557cb397a4f0a5a3a628f06515f78563f2209e64d47055d9dc6052bf5e33"
-dependencies = [
- "futf",
- "mac",
- "utf-8",
-]
-
-[[package]]
-name = "term"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f"
-dependencies = [
- "dirs-next",
- "rustversion",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "term_size"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9"
-dependencies = [
- "libc",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "termcolor"
-version = "1.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
-dependencies = [
- "winapi-util",
-]
-
-[[package]]
-name = "terminal_size"
-version = "0.1.17"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df"
-dependencies = [
- "libc",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "thin-slice"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c"
-
-[[package]]
-name = "thiserror"
-version = "1.0.30"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417"
-dependencies = [
- "thiserror-impl",
-]
-
-[[package]]
-name = "thiserror-impl"
-version = "1.0.30"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "time"
-version = "0.1.44"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
-dependencies = [
- "libc",
- "wasi 0.10.0+wasi-snapshot-preview1",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "time"
-version = "0.3.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41effe7cfa8af36f439fac33861b66b049edc6f9a32331e2312660529c1c24ad"
-dependencies = [
- "itoa",
- "libc",
-]
-
-[[package]]
-name = "tinyvec"
-version = "1.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"
-dependencies = [
- "tinyvec_macros",
-]
-
-[[package]]
-name = "tinyvec_macros"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
-
-[[package]]
-name = "titlecase"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f565e410cfc24c2f2a89960b023ca192689d7f77d3f8d4f4af50c2d8affe1117"
-dependencies = [
- "lazy_static",
- "regex",
-]
-
-[[package]]
-name = "tokio"
-version = "1.14.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70e992e41e0d2fb9f755b37446f20900f64446ef54874f40a60c78f021ac6144"
-dependencies = [
- "autocfg",
- "bytes 1.1.0",
- "libc",
- "memchr",
- "mio",
- "num_cpus",
- "pin-project-lite",
- "tokio-macros",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "tokio-io"
-version = "0.1.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674"
-dependencies = [
- "bytes 0.4.12",
- "futures 0.1.31",
- "log",
-]
-
-[[package]]
-name = "tokio-macros"
-version = "1.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c9efc1aba077437943f7515666aa2b882dfabfbfdf89c819ea75a8d6e9eaba5e"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "tokio-native-tls"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b"
-dependencies = [
- "native-tls",
- "tokio",
-]
-
-[[package]]
-name = "tokio-util"
-version = "0.6.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0"
-dependencies = [
- "bytes 1.1.0",
- "futures-core",
- "futures-sink",
- "log",
- "pin-project-lite",
- "tokio",
-]
-
-[[package]]
-name = "toml"
-version = "0.5.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
-dependencies = [
- "serde",
-]
-
-[[package]]
-name = "tower-service"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6"
-
-[[package]]
-name = "tracing"
-version = "0.1.29"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105"
-dependencies = [
- "cfg-if 1.0.0",
- "pin-project-lite",
- "tracing-core",
-]
-
-[[package]]
-name = "tracing-core"
-version = "0.1.21"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4"
-dependencies = [
- "lazy_static",
-]
-
-[[package]]
-name = "trash"
-version = "2.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3ebb6cb2db7947ab9f65dec9f7c5dbe01042b708f564242dcfb6d5cb2957cbc"
-dependencies = [
- "chrono",
- "libc",
- "log",
- "objc",
- "scopeguard",
- "url",
- "windows",
-]
-
-[[package]]
-name = "try-lock"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642"
-
-[[package]]
-name = "tui"
-version = "0.15.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "861d8f3ad314ede6219bcb2ab844054b1de279ee37a9bc38e3d606f9d3fb2a71"
-dependencies = [
- "bitflags",
- "cassowary",
- "crossterm",
- "unicode-segmentation",
- "unicode-width",
-]
-
-[[package]]
-name = "typed-arena"
-version = "1.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9b2228007eba4120145f785df0f6c92ea538f5a3635a612ecf4e334c8c1446d"
-
-[[package]]
-name = "typenum"
-version = "1.14.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec"
-
-[[package]]
-name = "ucd-trie"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
-
-[[package]]
-name = "umask"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "982efbf70ec4d28f7862062c03dd1a4def601a5079e0faf1edc55f2ad0f6fe46"
-
-[[package]]
-name = "unicase"
-version = "2.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
-dependencies = [
- "version_check",
-]
-
-[[package]]
-name = "unicode-bidi"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f"
-
-[[package]]
-name = "unicode-normalization"
-version = "0.1.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
-dependencies = [
- "tinyvec",
-]
-
-[[package]]
-name = "unicode-segmentation"
-version = "1.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
-
-[[package]]
-name = "unicode-width"
-version = "0.1.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
-
-[[package]]
-name = "unicode-xid"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
-
-[[package]]
-name = "unsafe_unwrap"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1230ec65f13e0f9b28d789da20d2d419511893ea9dac2c1f4ef67b8b14e5da80"
-
-[[package]]
-name = "url"
-version = "2.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c"
-dependencies = [
- "form_urlencoded",
- "idna",
- "matches",
- "percent-encoding",
-]
-
-[[package]]
-name = "user32-sys"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47"
-dependencies = [
- "winapi 0.2.8",
- "winapi-build",
-]
-
-[[package]]
-name = "users"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "24cc0f6d6f267b73e5a2cadf007ba8f9bc39c6a6f9666f8cf25ea809a153b032"
-dependencies = [
- "libc",
- "log",
-]
-
-[[package]]
-name = "utf-8"
-version = "0.7.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
-
-[[package]]
-name = "utf8-width"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7cf7d77f457ef8dfa11e4cd5933c5ddb5dc52a94664071951219a97710f0a32b"
-
-[[package]]
-name = "utf8parse"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "936e4b492acfd135421d8dca4b1aa80a7bfc26e702ef3af710e0752684df5372"
-
-[[package]]
-name = "uuid"
-version = "0.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
-dependencies = [
- "getrandom 0.2.3",
-]
-
-[[package]]
-name = "vcpkg"
-version = "0.2.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
-
-[[package]]
-name = "version_check"
-version = "0.9.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
-
-[[package]]
-name = "void"
-version = "1.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
-
-[[package]]
-name = "vte"
-version = "0.10.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6cbce692ab4ca2f1f3047fcf732430249c0e971bfdd2b234cf2c47ad93af5983"
-dependencies = [
- "arrayvec 0.5.2",
- "utf8parse",
- "vte_generate_state_changes",
-]
-
-[[package]]
-name = "vte_generate_state_changes"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d257817081c7dffcdbab24b9e62d2def62e2ff7d00b1c20062551e6cccc145ff"
-dependencies = [
- "proc-macro2",
- "quote",
-]
-
-[[package]]
-name = "walkdir"
-version = "2.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
-dependencies = [
- "same-file",
- "winapi 0.3.9",
- "winapi-util",
-]
-
-[[package]]
-name = "want"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0"
-dependencies = [
- "log",
- "try-lock",
-]
-
-[[package]]
-name = "wasi"
-version = "0.9.0+wasi-snapshot-preview1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
-
-[[package]]
-name = "wasi"
-version = "0.10.0+wasi-snapshot-preview1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
-
-[[package]]
-name = "wasm-bindgen"
-version = "0.2.78"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce"
-dependencies = [
- "cfg-if 1.0.0",
- "wasm-bindgen-macro",
-]
-
-[[package]]
-name = "wasm-bindgen-backend"
-version = "0.2.78"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b"
-dependencies = [
- "bumpalo",
- "lazy_static",
- "log",
- "proc-macro2",
- "quote",
- "syn",
- "wasm-bindgen-shared",
-]
-
-[[package]]
-name = "wasm-bindgen-futures"
-version = "0.4.28"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39"
-dependencies = [
- "cfg-if 1.0.0",
- "js-sys",
- "wasm-bindgen",
- "web-sys",
-]
-
-[[package]]
-name = "wasm-bindgen-macro"
-version = "0.2.78"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9"
-dependencies = [
- "quote",
- "wasm-bindgen-macro-support",
-]
-
-[[package]]
-name = "wasm-bindgen-macro-support"
-version = "0.2.78"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
- "wasm-bindgen-backend",
- "wasm-bindgen-shared",
-]
-
-[[package]]
-name = "wasm-bindgen-shared"
-version = "0.2.78"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc"
-
-[[package]]
-name = "web-sys"
-version = "0.3.55"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb"
-dependencies = [
- "js-sys",
- "wasm-bindgen",
-]
-
-[[package]]
-name = "webbrowser"
-version = "0.5.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ecad156490d6b620308ed411cfee90d280b3cbd13e189ea0d3fada8acc89158a"
-dependencies = [
- "web-sys",
- "widestring",
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "which"
-version = "4.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea187a8ef279bc014ec368c27a920da2024d2a711109bfbe3440585d5cf27ad9"
-dependencies = [
- "either",
- "lazy_static",
- "libc",
-]
-
-[[package]]
-name = "widestring"
-version = "0.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c"
-
-[[package]]
-name = "winapi"
-version = "0.2.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
-
-[[package]]
-name = "winapi"
-version = "0.3.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
-dependencies = [
- "winapi-i686-pc-windows-gnu",
- "winapi-x86_64-pc-windows-gnu",
-]
-
-[[package]]
-name = "winapi-build"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
-
-[[package]]
-name = "winapi-i686-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
-
-[[package]]
-name = "winapi-util"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
-dependencies = [
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "winapi-x86_64-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
-
-[[package]]
-name = "windows"
-version = "0.9.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "361f3533a83ee1a28c9be59683f40043db02dbedf6479ce8795657386195c97f"
-dependencies = [
- "const-sha1",
- "windows_gen",
- "windows_macros",
-]
-
-[[package]]
-name = "windows-sys"
-version = "0.28.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82ca39602d5cbfa692c4b67e3bcbb2751477355141c1ed434c94da4186836ff6"
-dependencies = [
- "windows_aarch64_msvc",
- "windows_i686_gnu",
- "windows_i686_msvc",
- "windows_x86_64_gnu",
- "windows_x86_64_msvc",
-]
-
-[[package]]
-name = "windows_aarch64_msvc"
-version = "0.28.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "52695a41e536859d5308cc613b4a022261a274390b25bd29dfff4bf08505f3c2"
-
-[[package]]
-name = "windows_gen"
-version = "0.9.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "54154dbc515d58723f6b6053c12f1065da7389f733660581b2391bd1af480452"
-dependencies = [
- "syn",
-]
-
-[[package]]
-name = "windows_i686_gnu"
-version = "0.28.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f54725ac23affef038fecb177de6c9bf065787c2f432f79e3c373da92f3e1d8a"
-
-[[package]]
-name = "windows_i686_msvc"
-version = "0.28.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "51d5158a43cc43623c0729d1ad6647e62fa384a3d135fd15108d37c683461f64"
-
-[[package]]
-name = "windows_macros"
-version = "0.9.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0f7794c652845dc466cb8dc1b86c08345707c8144bc53e9086430047c7d33b76"
-dependencies = [
- "syn",
- "windows_gen",
-]
-
-[[package]]
-name = "windows_x86_64_gnu"
-version = "0.28.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bc31f409f565611535130cfe7ee8e6655d3fa99c1c61013981e491921b5ce954"
-
-[[package]]
-name = "windows_x86_64_msvc"
-version = "0.28.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f2b8c7cbd3bfdddd9ab98769f9746a7fad1bca236554cd032b78d768bc0e89f"
-
-[[package]]
-name = "winreg"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69"
-dependencies = [
- "winapi 0.3.9",
-]
-
-[[package]]
-name = "x11"
-version = "2.19.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6dd0565fa8bfba8c5efe02725b14dff114c866724eff2cfd44d76cea74bcd87a"
-dependencies = [
- "libc",
- "pkg-config",
-]
-
-[[package]]
-name = "xml-rs"
-version = "0.8.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3"
-
-[[package]]
-name = "xmlparser"
-version = "0.13.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "114ba2b24d2167ef6d67d7d04c8cc86522b87f490025f39f0303b7db5bf5e3d8"
-
-[[package]]
-name = "yaml-rust"
-version = "0.4.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
-dependencies = [
- "linked-hash-map",
-]
-
-[[package]]
-name = "zip"
-version = "0.5.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815"
-dependencies = [
- "byteorder",
- "bzip2",
- "crc32fast",
- "flate2",
- "thiserror",
- "time 0.1.44",
-]
-
-[[package]]
-name = "zstd"
-version = "0.9.0+zstd.1.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "07749a5dc2cb6b36661290245e350f15ec3bbb304e493db54a1d354480522ccd"
-dependencies = [
- "zstd-safe",
-]
-
-[[package]]
-name = "zstd-safe"
-version = "4.1.1+zstd.1.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c91c90f2c593b003603e5e0493c837088df4469da25aafff8bce42ba48caf079"
-dependencies = [
- "libc",
- "zstd-sys",
-]
-
-[[package]]
-name = "zstd-sys"
-version = "1.6.1+zstd.1.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "615120c7a2431d16cf1cf979e7fc31ba7a5b5e5707b29c8a99e5dbf8a8392a33"
-dependencies = [
- "cc",
- "libc",
-]
diff --git a/old_nushell/Cargo_old.toml b/old_nushell/Cargo_old.toml
deleted file mode 100644
index a83162319..000000000
--- a/old_nushell/Cargo_old.toml
+++ /dev/null
@@ -1,229 +0,0 @@
-[package]
-authors = ["The Nu Project Contributors"]
-default-run = "nu"
-description = "A new type of shell"
-documentation = "https://www.nushell.sh/book/"
-edition = "2018"
-exclude = ["images"]
-homepage = "https://www.nushell.sh"
-license = "MIT"
-name = "nu"
-readme = "README.md"
-repository = "https://github.com/nushell/nushell"
-version = "0.43.0"
-
-[workspace]
-members = ["crates/*/"]
-
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
-
-[dependencies]
-nu-cli = { version = "0.43.0", path="./crates/nu-cli", default-features=false }
-nu-command = { version = "0.43.0", path="./crates/nu-command" }
-nu-completion = { version = "0.43.0", path="./crates/nu-completion" }
-nu-data = { version = "0.43.0", path="./crates/nu-data" }
-nu-engine = { version = "0.43.0", path="./crates/nu-engine" }
-nu-errors = { version = "0.43.0", path="./crates/nu-errors" }
-nu-parser = { version = "0.43.0", path="./crates/nu-parser" }
-nu-path = { version = "0.43.0", path="./crates/nu-path" }
-nu-plugin = { version = "0.43.0", path="./crates/nu-plugin" }
-nu-protocol = { version = "0.43.0", path="./crates/nu-protocol" }
-nu-source = { version = "0.43.0", path="./crates/nu-source" }
-nu-value-ext = { version = "0.43.0", path="./crates/nu-value-ext" }
-
-nu_plugin_binaryview = { version = "0.43.0", path="./crates/nu_plugin_binaryview", optional=true }
-nu_plugin_chart = { version = "0.43.0", path="./crates/nu_plugin_chart", optional=true }
-nu_plugin_from_bson = { version = "0.43.0", path="./crates/nu_plugin_from_bson", optional=true }
-nu_plugin_from_sqlite = { version = "0.43.0", path="./crates/nu_plugin_from_sqlite", optional=true }
-nu_plugin_inc = { version = "0.43.0", path="./crates/nu_plugin_inc", optional=true }
-nu_plugin_match = { version = "0.43.0", path="./crates/nu_plugin_match", optional=true }
-nu_plugin_query_json = { version = "0.43.0", path="./crates/nu_plugin_query_json", optional=true }
-nu_plugin_s3 = { version = "0.43.0", path="./crates/nu_plugin_s3", optional=true }
-nu_plugin_selector = { version = "0.43.0", path="./crates/nu_plugin_selector", optional=true }
-nu_plugin_start = { version = "0.43.0", path="./crates/nu_plugin_start", optional=true }
-nu_plugin_textview = { version = "0.43.0", path="./crates/nu_plugin_textview", optional=true }
-nu_plugin_to_bson = { version = "0.43.0", path="./crates/nu_plugin_to_bson", optional=true }
-nu_plugin_to_sqlite = { version = "0.43.0", path="./crates/nu_plugin_to_sqlite", optional=true }
-nu_plugin_tree = { version = "0.43.0", path="./crates/nu_plugin_tree", optional=true }
-nu_plugin_xpath = { version = "0.43.0", path="./crates/nu_plugin_xpath", optional=true }
-
-# Required to bootstrap the main binary
-ctrlc = { version="3.1.7", optional=true }
-futures = { version="0.3.12", features=["compat", "io-compat"] }
-itertools = "0.10.0"
-
-[dev-dependencies]
-nu-test-support = { version = "0.43.0", path="./crates/nu-test-support" }
-serial_test = "0.5.1"
-hamcrest2 = "0.3.0"
-rstest = "0.10.0"
-
-[build-dependencies]
-
-[features]
-fetch-support = ["nu-command/fetch", "nu-command/post"]
-sys-support = ["nu-command/sys", "nu-command/ps"]
-ctrlc-support = ["nu-cli/ctrlc", "nu-command/ctrlc"]
-rustyline-support = ["nu-cli/rustyline-support", "nu-command/rustyline-support"]
-term-support = ["nu-command/term"]
-uuid-support = ["nu-command/uuid_crate"]
-which-support = ["nu-command/which", "nu-engine/which"]
-
-default = [
- "nu-cli/shadow-rs",
- "sys-support",
- "ctrlc-support",
- "which-support",
- "term-support",
- "rustyline-support",
- "match",
- "fetch-support",
- "zip-support",
- "dataframe",
-]
-
-stable = ["default"]
-extra = [
- "default",
- "binaryview",
- "inc",
- "tree",
- "textview",
- "trash-support",
- "uuid-support",
- "start",
- "bson",
- "sqlite",
- "s3",
- "chart",
- "xpath",
- "selector",
- "query-json",
-]
-
-wasi = ["inc", "match", "match", "tree", "rustyline-support"]
-
-# Stable (Default)
-inc = ["nu_plugin_inc"]
-match = ["nu_plugin_match"]
-textview = ["nu_plugin_textview"]
-
-# Extra
-binaryview = ["nu_plugin_binaryview"]
-bson = ["nu_plugin_from_bson", "nu_plugin_to_bson"]
-chart = ["nu_plugin_chart"]
-query-json = ["nu_plugin_query_json"]
-s3 = ["nu_plugin_s3"]
-selector = ["nu_plugin_selector"]
-sqlite = ["nu_plugin_from_sqlite", "nu_plugin_to_sqlite"]
-start = ["nu_plugin_start"]
-trash-support = [
- "nu-command/trash-support",
- "nu-engine/trash-support",
-]
-tree = ["nu_plugin_tree"]
-xpath = ["nu_plugin_xpath"]
-zip-support = ["nu-command/zip"]
-
-#dataframe feature for nushell
-dataframe = [
- "nu-engine/dataframe",
- "nu-protocol/dataframe",
- "nu-command/dataframe",
- "nu-value-ext/dataframe",
- "nu-data/dataframe",
- "nu_plugin_to_bson/dataframe",
-]
-
-[profile.release]
-opt-level = "s" # Optimize for size.
-
-# Core plugins that ship with `cargo install nu` by default
-# Currently, Cargo limits us to installing only one binary
-# unless we use [[bin]], so we use this as a workaround
-[[bin]]
-name = "nu_plugin_core_textview"
-path = "src/plugins/nu_plugin_core_textview.rs"
-required-features = ["textview"]
-
-[[bin]]
-name = "nu_plugin_core_inc"
-path = "src/plugins/nu_plugin_core_inc.rs"
-required-features = ["inc"]
-
-[[bin]]
-name = "nu_plugin_core_match"
-path = "src/plugins/nu_plugin_core_match.rs"
-required-features = ["match"]
-
-# Extra plugins
-
-[[bin]]
-name = "nu_plugin_extra_binaryview"
-path = "src/plugins/nu_plugin_extra_binaryview.rs"
-required-features = ["binaryview"]
-
-[[bin]]
-name = "nu_plugin_extra_tree"
-path = "src/plugins/nu_plugin_extra_tree.rs"
-required-features = ["tree"]
-
-[[bin]]
-name = "nu_plugin_extra_query_json"
-path = "src/plugins/nu_plugin_extra_query_json.rs"
-required-features = ["query-json"]
-
-[[bin]]
-name = "nu_plugin_extra_start"
-path = "src/plugins/nu_plugin_extra_start.rs"
-required-features = ["start"]
-
-[[bin]]
-name = "nu_plugin_extra_s3"
-path = "src/plugins/nu_plugin_extra_s3.rs"
-required-features = ["s3"]
-
-[[bin]]
-name = "nu_plugin_extra_chart_bar"
-path = "src/plugins/nu_plugin_extra_chart_bar.rs"
-required-features = ["chart"]
-
-[[bin]]
-name = "nu_plugin_extra_chart_line"
-path = "src/plugins/nu_plugin_extra_chart_line.rs"
-required-features = ["chart"]
-
-[[bin]]
-name = "nu_plugin_extra_xpath"
-path = "src/plugins/nu_plugin_extra_xpath.rs"
-required-features = ["xpath"]
-
-[[bin]]
-name = "nu_plugin_extra_selector"
-path = "src/plugins/nu_plugin_extra_selector.rs"
-required-features = ["selector"]
-
-[[bin]]
-name = "nu_plugin_extra_from_bson"
-path = "src/plugins/nu_plugin_extra_from_bson.rs"
-required-features = ["bson"]
-
-[[bin]]
-name = "nu_plugin_extra_to_bson"
-path = "src/plugins/nu_plugin_extra_to_bson.rs"
-required-features = ["bson"]
-
-[[bin]]
-name = "nu_plugin_extra_from_sqlite"
-path = "src/plugins/nu_plugin_extra_from_sqlite.rs"
-required-features = ["sqlite"]
-
-[[bin]]
-name = "nu_plugin_extra_to_sqlite"
-path = "src/plugins/nu_plugin_extra_to_sqlite.rs"
-required-features = ["sqlite"]
-
-# Main nu binary
-[[bin]]
-name = "nu"
-path = "src/main.rs"
diff --git a/old_nushell/README.md b/old_nushell/README.md
deleted file mode 100644
index ea2da1fb1..000000000
--- a/old_nushell/README.md
+++ /dev/null
@@ -1,283 +0,0 @@
-# README
-
-[![Crates.io](https://img.shields.io/crates/v/nu.svg)](https://crates.io/crates/nu)
-[![Build Status](https://dev.azure.com/nushell/nushell/_apis/build/status/nushell.nushell?branchName=main)](https://dev.azure.com/nushell/nushell/_build/latest?definitionId=2&branchName=main)
-[![Discord](https://img.shields.io/discord/601130461678272522.svg?logo=discord)](https://discord.gg/NtAbbGn)
-[![The Changelog #363](https://img.shields.io/badge/The%20Changelog-%23363-61c192.svg)](https://changelog.com/podcast/363)
-[![@nu_shell](https://img.shields.io/badge/twitter-@nu_shell-1DA1F3?style=flat-square)](https://twitter.com/nu_shell)
-![GitHub commit activity](https://img.shields.io/github/commit-activity/m/nushell/nushell)
-![GitHub contributors](https://img.shields.io/github/contributors/nushell/nushell)
-
-## Nushell
-
-A new type of shell.
-
-![Example of nushell](images/nushell-autocomplete5.gif "Example of nushell")
-
-## Status
-
-This project has reached a minimum-viable product level of quality.
-While contributors dogfood it as their daily driver, it may be unstable for some commands.
-Future releases will work to fill out missing features and improve stability.
-Its design is also subject to change as it matures.
-
-Nu comes with a set of built-in commands (listed below).
-If a command is unknown, the command will shell-out and execute it (using cmd on Windows or bash on Linux and macOS), correctly passing through stdin, stdout, and stderr, so things like your daily git workflows and even `vim` will work just fine.
-
-## Learning more
-
-There are a few good resources to learn about Nu.
-There is a [book](https://www.nushell.sh/book/) about Nu that is currently in progress.
-The book focuses on using Nu and its core concepts.
-
-If you're a developer who would like to contribute to Nu, we're also working on a [book for developers](https://www.nushell.sh/contributor-book/) to help you get started.
-There are also [good first issues](https://github.com/nushell/nushell/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) to help you dive in.
-
-We also have an active [Discord](https://discord.gg/NtAbbGn) and [Twitter](https://twitter.com/nu_shell) if you'd like to come and chat with us.
-
-You can also find information on more specific topics in our [cookbook](https://www.nushell.sh/cookbook/).
-
-## Installation
-
-### Local
-
-Up-to-date installation instructions can be found in the [installation chapter of the book](https://www.nushell.sh/book/installation.html). **Windows users**: please note that Nu works on Windows 10 and does not currently have Windows 7/8.1 support.
-
-To build Nu, you will need to use the **latest stable (1.51 or later)** version of the compiler.
-
-Required dependencies:
-
-- pkg-config and libssl (only needed on Linux)
- - On Debian/Ubuntu: `apt install pkg-config libssl-dev`
-
-Optional dependencies:
-
-- To use Nu with all possible optional features enabled, you'll also need the following:
- - On Linux (on Debian/Ubuntu): `apt install libxcb-composite0-dev libx11-dev`
-
-To install Nu via cargo (make sure you have installed [rustup](https://rustup.rs/) and the latest stable compiler via `rustup install stable`):
-
-```shell
-cargo install nu
-```
-
-To install Nu via the [Windows Package Manager](https://aka.ms/winget-cli):
-
-```shell
-winget install nushell
-```
-
-You can also build Nu yourself with all the bells and whistles (be sure to have installed the [dependencies](https://www.nushell.sh/book/installation.html#dependencies) for your platform), once you have checked out this repo with git:
-
-```shell
-cargo build --workspace --features=extra
-```
-### Packaging status
-
-[![Packaging status](https://repology.org/badge/vertical-allrepos/nushell.svg)](https://repology.org/project/nushell/versions)
-
-#### Fedora
-
-[COPR repo](https://copr.fedorainfracloud.org/coprs/atim/nushell/): `sudo dnf copr enable atim/nushell -y && sudo dnf install nushell -y`
-
-## Philosophy
-
-Nu draws inspiration from projects like PowerShell, functional programming languages, and modern CLI tools.
-Rather than thinking of files and services as raw streams of text, Nu looks at each input as something with structure.
-For example, when you list the contents of a directory, what you get back is a table of rows, where each row represents an item in that directory.
-These values can be piped through a series of steps, in a series of commands called a 'pipeline'.
-
-### Pipelines
-
-In Unix, it's common to pipe between commands to split up a sophisticated command over multiple steps.
-Nu takes this a step further and builds heavily on the idea of _pipelines_.
-Just as the Unix philosophy, Nu allows commands to output to stdout and read from stdin.
-Additionally, commands can output structured data (you can think of this as a third kind of stream).
-Commands that work in the pipeline fit into one of three categories:
-
-- Commands that produce a stream (e.g., `ls`)
-- Commands that filter a stream (eg, `where type == "Dir"`)
-- Commands that consume the output of the pipeline (e.g., `autoview`)
-
-Commands are separated by the pipe symbol (`|`) to denote a pipeline flowing left to right.
-
-```shell
-> ls | where type == "Dir" | autoview
-───┬────────┬──────┬───────┬──────────────
- # │ name │ type │ size │ modified
-───┼────────┼──────┼───────┼──────────────
- 0 │ assets │ Dir │ 128 B │ 5 months ago
- 1 │ crates │ Dir │ 704 B │ 50 mins ago
- 2 │ debian │ Dir │ 352 B │ 5 months ago
- 3 │ docs │ Dir │ 192 B │ 50 mins ago
- 4 │ images │ Dir │ 160 B │ 5 months ago
- 5 │ src │ Dir │ 128 B │ 1 day ago
- 6 │ target │ Dir │ 160 B │ 5 days ago
- 7 │ tests │ Dir │ 192 B │ 3 months ago
-───┴────────┴──────┴───────┴──────────────
-```
-
-Because most of the time you'll want to see the output of a pipeline, `autoview` is assumed.
-We could have also written the above:
-
-```shell
-> ls | where type == Dir
-```
-
-Being able to use the same commands and compose them differently is an important philosophy in Nu.
-For example, we could use the built-in `ps` command to get a list of the running processes, using the same `where` as above.
-
-```shell
-> ps | where cpu > 0
-───┬────────┬───────────────────┬──────────┬─────────┬──────────┬──────────
- # │ pid │ name │ status │ cpu │ mem │ virtual
-───┼────────┼───────────────────┼──────────┼─────────┼──────────┼──────────
- 0 │ 435 │ irq/142-SYNA327 │ Sleeping │ 7.5699 │ 0 B │ 0 B
- 1 │ 1609 │ pulseaudio │ Sleeping │ 6.5605 │ 10.6 MB │ 2.3 GB
- 2 │ 1625 │ gnome-shell │ Sleeping │ 6.5684 │ 639.6 MB │ 7.3 GB
- 3 │ 2202 │ Web Content │ Sleeping │ 6.8157 │ 320.8 MB │ 3.0 GB
- 4 │ 328788 │ nu_plugin_core_ps │ Sleeping │ 92.5750 │ 5.9 MB │ 633.2 MB
-───┴────────┴───────────────────┴──────────┴─────────┴──────────┴──────────
-```
-
-### Opening files
-
-Nu can load file and URL contents as raw text or structured data (if it recognizes the format).
-For example, you can load a .toml file as structured data and explore it:
-
-```shell
-> open Cargo.toml
-────────────────────┬───────────────────────────
- bin │ [table 18 rows]
- build-dependencies │ [row serde toml]
- dependencies │ [row 29 columns]
- dev-dependencies │ [row nu-test-support]
- features │ [row 19 columns]
- package │ [row 12 columns]
- workspace │ [row members]
-────────────────────┴───────────────────────────
-```
-
-We can pipeline this into a command that gets the contents of one of the columns:
-
-```shell
-> open Cargo.toml | get package
-───────────────┬────────────────────────────────────
- authors │ [table 1 rows]
- default-run │ nu
- description │ A new type of shell
- documentation │ https://www.nushell.sh/book/
- edition │ 2018
- exclude │ [table 1 rows]
- homepage │ https://www.nushell.sh
- license │ MIT
- name │ nu
- readme │ README.md
- repository │ https://github.com/nushell/nushell
- version │ 0.32.0
-───────────────┴────────────────────────────────────
-```
-
-Finally, we can use commands outside of Nu once we have the data we want:
-
-```shell
-> open Cargo.toml | get package.version
-0.32.0
-```
-
-### Configuration
-
-Nu has early support for configuring the shell. You can refer to the book for a list of [all supported variables](https://www.nushell.sh/book/configuration.html).
-
-To set one of these variables, you can use `config set`. For example:
-
-```shell
-> config set line_editor.edit_mode "vi"
-> config set path $nu.path
-```
-
-### Shells
-
-Nu will work inside of a single directory and allow you to navigate around your filesystem by default.
-Nu also offers a way of adding additional working directories that you can jump between, allowing you to work in multiple directories simultaneously.
-
-To do so, use the `enter` command, which will allow you to create a new "shell" and enter it at the specified path.
-You can toggle between this new shell and the original shell with the `p` (for previous) and `n` (for next), allowing you to navigate around a ring buffer of shells.
-Once you're done with a shell, you can `exit` it and remove it from the ring buffer.
-
-Finally, to get a list of all the current shells, you can use the `shells` command.
-
-### Plugins
-
-Nu supports plugins that offer additional functionality to the shell and follow the same structured data model that built-in commands use.
-This allows you to extend nu for your needs.
-
-There are a few examples in the `plugins` directory.
-
-Plugins are binaries that are available in your path and follow a `nu_plugin_*` naming convention.
-These binaries interact with nu via a simple JSON-RPC protocol where the command identifies itself and passes along its configuration, making it available for use.
-If the plugin is a filter, data streams to it one element at a time, and it can stream data back in return via stdin/stdout.
-If the plugin is a sink, it is given the full vector of final data and is given free reign over stdin/stdout to use as it pleases.
-
-## Goals
-
-Nu adheres closely to a set of goals that make up its design philosophy. As features are added, they are checked against these goals.
-
-- First and foremost, Nu is cross-platform. Commands and techniques should carry between platforms and offer consistent first-class support for Windows, macOS, and Linux.
-
-- Nu ensures direct compatibility with existing platform-specific executables that make up people's workflows.
-
-- Nu's workflow and tools should have the usability in day-to-day experience of using a shell in 2019 (and beyond).
-
-- Nu views data as both structured and unstructured. It is a structured shell like PowerShell.
-
-- Finally, Nu views data functionally. Rather than using mutation, pipelines act as a means to load, change, and save data without mutable state.
-
-## Commands
-
-You can find a list of Nu commands, complete with documentation, in [quick command references](https://www.nushell.sh/book/command_reference.html).
-
-## Progress
-
-Nu is in heavy development and will naturally change as it matures and people use it. The chart below isn't meant to be exhaustive, but rather helps give an idea for some of the areas of development and their relative completion:
-
-| Features | Not started | Prototype | MVP | Preview | Mature | Notes |
-| ------------- | :---------: | :-------: | :-: | :-----: | :----: | -------------------------------------------------------------------- |
-| Aliases | | | X | | | Aliases allow for shortening large commands, while passing flags |
-| Notebook | | X | | | | Initial jupyter support, but it loses state and lacks features |
-| File ops | | | X | | | cp, mv, rm, mkdir have some support, but lacking others |
-| Environment | | | X | | | Temporary environment and scoped environment variables |
-| Shells | | X | | | | Basic value and file shells, but no opt-in/opt-out for commands |
-| Protocol | | | X | | | Streaming protocol is serviceable |
-| Plugins | | X | | | | Plugins work on one row at a time, lack batching and expression eval |
-| Errors | | | X | | | Error reporting works, but could use usability polish |
-| Documentation | | | X | | | Book updated to latest release, including usage examples |
-| Paging | | X | | | | Textview has paging, but we'd like paging for tables |
-| Functions | | | X | | | Functions and aliases are supported |
-| Variables | | | X | | | Nu supports variables and environment variables |
-| Completions | | | X | | | Completions for filepaths |
-| Type-checking | | | X | | | Commands check basic types, but input/output isn't checked |
-
-## Officially Supported By
-
-Please submit an issue or PR to be added to this list.
-
-### Integrations
-- [zoxide](https://github.com/ajeetdsouza/zoxide)
-- [starship](https://github.com/starship/starship)
-### Mentions
-- [The Python Launcher for Unix](https://github.com/brettcannon/python-launcher#how-do-i-get-a-table-of-python-executables-in-nushell)
-
-## Contributing
-
-See [Contributing](CONTRIBUTING.md) for details.
-
-Thanks to all the people who already contributed!
-
-
-
-
-
-## License
-
-The project is made available under the MIT license. See the `LICENSE` file for more information.
diff --git a/old_nushell/crates/README.md b/old_nushell/crates/README.md
deleted file mode 100644
index ca1e44bcc..000000000
--- a/old_nushell/crates/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Nushell core libraries and plugins
-
-These sub-crates form both the foundation for Nu and a set of plugins which extend Nu with additional functionality.
-
-Foundational libraries are split into two kinds of crates:
-
-* Core crates - those crates that work together to build the Nushell language engine
-* Support crates - a set of crates that support the engine with additional features like JSON support, ANSI support, and more.
-
-Plugins are likewise also split into two types:
-
-* Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features.
-* Extra plugins - these plugins run a wide range of different capabilities like working with different file types, charting, viewing binary data, and more.
diff --git a/old_nushell/crates/nu-ansi-term/.gitignore b/old_nushell/crates/nu-ansi-term/.gitignore
deleted file mode 100644
index f2f9e58ec..000000000
--- a/old_nushell/crates/nu-ansi-term/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-target
-Cargo.lock
\ No newline at end of file
diff --git a/old_nushell/crates/nu-ansi-term/Cargo.toml b/old_nushell/crates/nu-ansi-term/Cargo.toml
deleted file mode 100644
index 00d744d7a..000000000
--- a/old_nushell/crates/nu-ansi-term/Cargo.toml
+++ /dev/null
@@ -1,39 +0,0 @@
-[package]
-authors = [
- "ogham@bsago.me",
- "Ryan Scheel (Havvy) ",
- "Josh Triplett ",
- "The Nu Project Contributors",
-]
-description = "Library for ANSI terminal colors and styles (bold, underline)"
-edition = "2018"
-license = "MIT"
-name = "nu-ansi-term"
-version = "0.43.0"
-
-[lib]
-doctest = false
-# name = "nu-ansi-term"
-
-[features]
-derive_serde_style = ["serde"]
-
-[dependencies]
-overload = "0.1.1"
-serde = { version="1.0.90", features=["derive"], optional=true }
-
-# [dependencies.serde]
-# version = "1.0.90"
-# features = ["derive"]
-# optional = true
-
-[target.'cfg(target_os="windows")'.dependencies.winapi]
-version = "0.3.4"
-features = ["consoleapi", "errhandlingapi", "fileapi", "handleapi", "processenv"]
-
-[dev-dependencies]
-doc-comment = "0.3"
-regex = "1.1.9"
-
-[dev-dependencies.serde_json]
-version = "1.0.39"
diff --git a/old_nushell/crates/nu-ansi-term/LICENCE b/old_nushell/crates/nu-ansi-term/LICENCE
deleted file mode 100644
index 3228cc99b..000000000
--- a/old_nushell/crates/nu-ansi-term/LICENCE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Benjamin Sago
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/old_nushell/crates/nu-ansi-term/README.md b/old_nushell/crates/nu-ansi-term/README.md
deleted file mode 100644
index 8143bb4d3..000000000
--- a/old_nushell/crates/nu-ansi-term/README.md
+++ /dev/null
@@ -1,182 +0,0 @@
-# nu-ansi-term
-
-> This is a copy of rust-ansi-term but with Color change to Color and light foreground colors added (90-97) as well as light background colors added (100-107).
-
-This is a library for controlling colors and formatting, such as red bold text or blue underlined text, on ANSI terminals.
-
-### [View the Rustdoc](https://docs.rs/nu_ansi_term/)
-
-# Installation
-
-This crate works with [Cargo](http://crates.io). Add the following to your `Cargo.toml` dependencies section:
-
-```toml
-[dependencies]
-nu_ansi_term = "0.13"
-```
-
-## Basic usage
-
-There are three main types in this crate that you need to be concerned with: `ANSIString`, `Style`, and `Color`.
-
-A `Style` holds stylistic information: foreground and background colors, whether the text should be bold, or blinking, or other properties.
-The `Color` enum represents the available colors.
-And an `ANSIString` is a string paired with a `Style`.
-
-`Color` is also available as an alias to `Color`.
-
-To format a string, call the `paint` method on a `Style` or a `Color`, passing in the string you want to format as the argument.
-For example, here’s how to get some red text:
-
-```rust
-use nu_ansi_term::Color::Red;
-
-println!("This is in red: {}", Red.paint("a red string"));
-```
-
-It’s important to note that the `paint` method does _not_ actually return a string with the ANSI control characters surrounding it.
-Instead, it returns an `ANSIString` value that has a `Display` implementation that, when formatted, returns the characters.
-This allows strings to be printed with a minimum of `String` allocations being performed behind the scenes.
-
-If you _do_ want to get at the escape codes, then you can convert the `ANSIString` to a string as you would any other `Display` value:
-
-```rust
-use nu_ansi_term::Color::Red;
-
-let red_string = Red.paint("a red string").to_string();
-```
-
-**Note for Windows 10 users:** On Windows 10, the application must enable ANSI support first:
-
-```rust,ignore
-let enabled = nu_ansi_term::enable_ansi_support();
-```
-
-## Bold, underline, background, and other styles
-
-For anything more complex than plain foreground color changes, you need to construct `Style` values themselves, rather than beginning with a `Color`.
-You can do this by chaining methods based on a new `Style`, created with `Style::new()`.
-Each method creates a new style that has that specific property set.
-For example:
-
-```rust
-use nu_ansi_term::Style;
-
-println!("How about some {} and {}?",
- Style::new().bold().paint("bold"),
- Style::new().underline().paint("underline"));
-```
-
-For brevity, these methods have also been implemented for `Color` values, so you can give your styles a foreground color without having to begin with an empty `Style` value:
-
-```rust
-use nu_ansi_term::Color::{Blue, Yellow};
-
-println!("Demonstrating {} and {}!",
- Blue.bold().paint("blue bold"),
- Yellow.underline().paint("yellow underline"));
-
-println!("Yellow on blue: {}", Yellow.on(Blue).paint("wow!"));
-```
-
-The complete list of styles you can use are:
-`bold`, `dimmed`, `italic`, `underline`, `blink`, `reverse`, `hidden`, and `on` for background colors.
-
-In some cases, you may find it easier to change the foreground on an existing `Style` rather than starting from the appropriate `Color`.
-You can do this using the `fg` method:
-
-```rust
-use nu_ansi_term::Style;
-use nu_ansi_term::Color::{Blue, Cyan, Yellow};
-
-println!("Yellow on blue: {}", Style::new().on(Blue).fg(Yellow).paint("yow!"));
-println!("Also yellow on blue: {}", Cyan.on(Blue).fg(Yellow).paint("zow!"));
-```
-
-You can turn a `Color` into a `Style` with the `normal` method.
-This will produce the exact same `ANSIString` as if you just used the `paint` method on the `Color` directly, but it’s useful in certain cases: for example, you may have a method that returns `Styles`, and need to represent both the “red bold” and “red, but not bold” styles with values of the same type. The `Style` struct also has a `Default` implementation if you want to have a style with _nothing_ set.
-
-```rust
-use nu_ansi_term::Style;
-use nu_ansi_term::Color::Red;
-
-Red.normal().paint("yet another red string");
-Style::default().paint("a completely regular string");
-```
-
-## Extended colors
-
-You can access the extended range of 256 colors by using the `Color::Fixed` variant, which takes an argument of the color number to use.
-This can be included wherever you would use a `Color`:
-
-```rust
-use nu_ansi_term::Color::Fixed;
-
-Fixed(134).paint("A sort of light purple");
-Fixed(221).on(Fixed(124)).paint("Mustard in the ketchup");
-```
-
-The first sixteen of these values are the same as the normal and bold standard color variants.
-There’s nothing stopping you from using these as `Fixed` colors instead, but there’s nothing to be gained by doing so either.
-
-You can also access full 24-bit color by using the `Color::RGB` variant, which takes separate `u8` arguments for red, green, and blue:
-
-```rust
-use nu_ansi_term::Color::RGB;
-
-RGB(70, 130, 180).paint("Steel blue");
-```
-
-## Combining successive coloured strings
-
-The benefit of writing ANSI escape codes to the terminal is that they _stack_: you do not need to end every coloured string with a reset code if the text that follows it is of a similar style.
-For example, if you want to have some blue text followed by some blue bold text, it’s possible to send the ANSI code for blue, followed by the ANSI code for bold, and finishing with a reset code without having to have an extra one between the two strings.
-
-This crate can optimise the ANSI codes that get printed in situations like this, making life easier for your terminal renderer.
-The `ANSIStrings` struct takes a slice of several `ANSIString` values, and will iterate over each of them, printing only the codes for the styles that need to be updated as part of its formatting routine.
-
-The following code snippet uses this to enclose a binary number displayed in red bold text inside some red, but not bold, brackets:
-
-```rust
-use nu_ansi_term::Color::Red;
-use nu_ansi_term::{ANSIString, ANSIStrings};
-
-let some_value = format!("{:b}", 42);
-let strings: &[ANSIString<'static>] = &[
- Red.paint("["),
- Red.bold().paint(some_value),
- Red.paint("]"),
-];
-
-println!("Value: {}", ANSIStrings(strings));
-```
-
-There are several things to note here.
-Firstly, the `paint` method can take _either_ an owned `String` or a borrowed `&str`.
-Internally, an `ANSIString` holds a copy-on-write (`Cow`) string value to deal with both owned and borrowed strings at the same time.
-This is used here to display a `String`, the result of the `format!` call, using the same mechanism as some statically-available `&str` slices.
-Secondly, that the `ANSIStrings` value works in the same way as its singular counterpart, with a `Display` implementation that only performs the formatting when required.
-
-## Byte strings
-
-This library also supports formatting `[u8]` byte strings; this supports applications working with text in an unknown encoding.
-`Style` and `Color` support painting `[u8]` values, resulting in an `ANSIByteString`.
-This type does not implement `Display`, as it may not contain UTF-8, but it does provide a method `write_to` to write the result to any value that implements `Write`:
-
-```rust
-use nu_ansi_term::Color::Green;
-
-Green.paint("user data".as_bytes()).write_to(&mut std::io::stdout()).unwrap();
-```
-
-Similarly, the type `ANSIByteStrings` supports writing a list of `ANSIByteString` values with minimal escape sequences:
-
-```rust
-use nu_ansi_term::Color::Green;
-use nu_ansi_term::ANSIByteStrings;
-
-ANSIByteStrings(&[
- Green.paint("user data 1\n".as_bytes()),
- Green.bold().paint("user data 2\n".as_bytes()),
-]).write_to(&mut std::io::stdout()).unwrap();
-```
diff --git a/old_nushell/crates/nu-ansi-term/examples/256_colors.rs b/old_nushell/crates/nu-ansi-term/examples/256_colors.rs
deleted file mode 100644
index 4766dcdb6..000000000
--- a/old_nushell/crates/nu-ansi-term/examples/256_colors.rs
+++ /dev/null
@@ -1,72 +0,0 @@
-extern crate nu_ansi_term;
-use nu_ansi_term::Color;
-
-// This example prints out the 256 colors.
-// They're arranged like this:
-//
-// - 0 to 8 are the eight standard colors.
-// - 9 to 15 are the eight bold colors.
-// - 16 to 231 are six blocks of six-by-six color squares.
-// - 232 to 255 are shades of grey.
-
-fn main() {
- // First two lines
- for c in 0..8 {
- glow(c, c != 0);
- print!(" ");
- }
- println!();
- for c in 8..16 {
- glow(c, c != 8);
- print!(" ");
- }
- println!("\n");
-
- // Six lines of the first three squares
- for row in 0..6 {
- for square in 0..3 {
- for column in 0..6 {
- glow(16 + square * 36 + row * 6 + column, row >= 3);
- print!(" ");
- }
-
- print!(" ");
- }
-
- println!();
- }
- println!();
-
- // Six more lines of the other three squares
- for row in 0..6 {
- for square in 0..3 {
- for column in 0..6 {
- glow(124 + square * 36 + row * 6 + column, row >= 3);
- print!(" ");
- }
-
- print!(" ");
- }
-
- println!();
- }
- println!();
-
- // The last greyscale lines
- for c in 232..=243 {
- glow(c, false);
- print!(" ");
- }
- println!();
- for c in 244..=255 {
- glow(c, true);
- print!(" ");
- }
- println!();
-}
-
-fn glow(c: u8, light_bg: bool) {
- let base = if light_bg { Color::Black } else { Color::White };
- let style = base.on(Color::Fixed(c));
- print!("{}", style.paint(&format!(" {:3} ", c)));
-}
diff --git a/old_nushell/crates/nu-ansi-term/examples/basic_colors.rs b/old_nushell/crates/nu-ansi-term/examples/basic_colors.rs
deleted file mode 100644
index 3c2b6817f..000000000
--- a/old_nushell/crates/nu-ansi-term/examples/basic_colors.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-extern crate nu_ansi_term;
-use nu_ansi_term::{Color::*, Style};
-
-// This example prints out the 16 basic colors.
-
-fn main() {
- let normal = Style::default();
-
- println!("{} {}", normal.paint("Normal"), normal.bold().paint("bold"));
- println!("{} {}", Black.paint("Black"), Black.bold().paint("bold"));
- println!("{} {}", Red.paint("Red"), Red.bold().paint("bold"));
- println!("{} {}", Green.paint("Green"), Green.bold().paint("bold"));
- println!("{} {}", Yellow.paint("Yellow"), Yellow.bold().paint("bold"));
- println!("{} {}", Blue.paint("Blue"), Blue.bold().paint("bold"));
- println!("{} {}", Purple.paint("Purple"), Purple.bold().paint("bold"));
- println!("{} {}", Cyan.paint("Cyan"), Cyan.bold().paint("bold"));
- println!("{} {}", White.paint("White"), White.bold().paint("bold"));
-}
diff --git a/old_nushell/crates/nu-ansi-term/examples/gradient_colors.rs b/old_nushell/crates/nu-ansi-term/examples/gradient_colors.rs
deleted file mode 100644
index 1c9583865..000000000
--- a/old_nushell/crates/nu-ansi-term/examples/gradient_colors.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-use nu_ansi_term::{build_all_gradient_text, Color, Gradient, Rgb, TargetGround};
-
-fn main() {
- let text = "lorem ipsum quia dolor sit amet, consectetur, adipisci velit";
-
- // a gradient from hex colors
- let start = Rgb::from_hex(0x40c9ff);
- let end = Rgb::from_hex(0xe81cff);
- let grad0 = Gradient::new(start, end);
-
- // a gradient from color::rgb()
- let start = Color::Rgb(64, 201, 255);
- let end = Color::Rgb(232, 28, 255);
- let gradient = Gradient::from_color_rgb(start, end);
-
- // a slightly different gradient
- let start2 = Color::Rgb(128, 64, 255);
- let end2 = Color::Rgb(0, 28, 255);
- let gradient2 = Gradient::from_color_rgb(start2, end2);
-
- // reverse the gradient
- let gradient3 = gradient.reverse();
-
- let build_fg = gradient.build(text, TargetGround::Foreground);
- println!("{}", build_fg);
- let build_bg = gradient.build(text, TargetGround::Background);
- println!("{}", build_bg);
- let bgt = build_all_gradient_text(text, gradient, gradient2);
- println!("{}", bgt);
- let bgt2 = build_all_gradient_text(text, gradient, gradient3);
- println!("{}", bgt2);
-
- println!(
- "{}",
- grad0.build("nushell is awesome", TargetGround::Foreground)
- );
-}
diff --git a/old_nushell/crates/nu-ansi-term/examples/rgb_colors.rs b/old_nushell/crates/nu-ansi-term/examples/rgb_colors.rs
deleted file mode 100644
index 4657d401f..000000000
--- a/old_nushell/crates/nu-ansi-term/examples/rgb_colors.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-extern crate nu_ansi_term;
-use nu_ansi_term::{Color, Style};
-
-// This example prints out a color gradient in a grid by calculating each
-// character’s red, green, and blue components, and using 24-bit color codes
-// to display them.
-
-const WIDTH: i32 = 80;
-const HEIGHT: i32 = 24;
-
-fn main() {
- for row in 0..HEIGHT {
- for col in 0..WIDTH {
- let r = (row * 255 / HEIGHT) as u8;
- let g = (col * 255 / WIDTH) as u8;
- let b = 128;
-
- print!("{}", Style::default().on(Color::Rgb(r, g, b)).paint(" "));
- }
-
- println!();
- }
-}
diff --git a/old_nushell/crates/nu-ansi-term/src/ansi.rs b/old_nushell/crates/nu-ansi-term/src/ansi.rs
deleted file mode 100644
index 8f2454dba..000000000
--- a/old_nushell/crates/nu-ansi-term/src/ansi.rs
+++ /dev/null
@@ -1,405 +0,0 @@
-#![allow(missing_docs)]
-use crate::style::{Color, Style};
-use crate::write::AnyWrite;
-use std::fmt;
-
-impl Style {
- /// Write any bytes that go *before* a piece of text to the given writer.
- fn write_prefix(&self, f: &mut W) -> Result<(), W::Error> {
- // If there are actually no styles here, then don’t write *any* codes
- // as the prefix. An empty ANSI code may not affect the terminal
- // output at all, but a user may just want a code-free string.
- if self.is_plain() {
- return Ok(());
- }
-
- // Write the codes’ prefix, then write numbers, separated by
- // semicolons, for each text style we want to apply.
- write!(f, "\x1B[")?;
- let mut written_anything = false;
-
- {
- let mut write_char = |c| {
- if written_anything {
- write!(f, ";")?;
- }
- written_anything = true;
- write!(f, "{}", c)?;
- Ok(())
- };
-
- if self.is_bold {
- write_char('1')?
- }
- if self.is_dimmed {
- write_char('2')?
- }
- if self.is_italic {
- write_char('3')?
- }
- if self.is_underline {
- write_char('4')?
- }
- if self.is_blink {
- write_char('5')?
- }
- if self.is_reverse {
- write_char('7')?
- }
- if self.is_hidden {
- write_char('8')?
- }
- if self.is_strikethrough {
- write_char('9')?
- }
- }
-
- // The foreground and background colors, if specified, need to be
- // handled specially because the number codes are more complicated.
- // (see `write_background_code` and `write_foreground_code`)
- if let Some(bg) = self.background {
- if written_anything {
- write!(f, ";")?;
- }
- written_anything = true;
- bg.write_background_code(f)?;
- }
-
- if let Some(fg) = self.foreground {
- if written_anything {
- write!(f, ";")?;
- }
- fg.write_foreground_code(f)?;
- }
-
- // All the codes end with an `m`, because reasons.
- write!(f, "m")?;
-
- Ok(())
- }
-
- /// Write any bytes that go *after* a piece of text to the given writer.
- fn write_suffix(&self, f: &mut W) -> Result<(), W::Error> {
- if self.is_plain() {
- Ok(())
- } else {
- write!(f, "{}", RESET)
- }
- }
-}
-
-/// The code to send to reset all styles and return to `Style::default()`.
-pub static RESET: &str = "\x1B[0m";
-
-impl Color {
- fn write_foreground_code(&self, f: &mut W) -> Result<(), W::Error> {
- match self {
- Color::Black => write!(f, "30"),
- Color::Red => write!(f, "31"),
- Color::Green => write!(f, "32"),
- Color::Yellow => write!(f, "33"),
- Color::Blue => write!(f, "34"),
- Color::Purple => write!(f, "35"),
- Color::Magenta => write!(f, "35"),
- Color::Cyan => write!(f, "36"),
- Color::White => write!(f, "37"),
- Color::Fixed(num) => write!(f, "38;5;{}", num),
- Color::Rgb(r, g, b) => write!(f, "38;2;{};{};{}", r, g, b),
- Color::DarkGray => write!(f, "90"),
- Color::LightRed => write!(f, "91"),
- Color::LightGreen => write!(f, "92"),
- Color::LightYellow => write!(f, "93"),
- Color::LightBlue => write!(f, "94"),
- Color::LightPurple => write!(f, "95"),
- Color::LightMagenta => write!(f, "95"),
- Color::LightCyan => write!(f, "96"),
- Color::LightGray => write!(f, "97"),
- }
- }
-
- fn write_background_code(&self, f: &mut W) -> Result<(), W::Error> {
- match self {
- Color::Black => write!(f, "40"),
- Color::Red => write!(f, "41"),
- Color::Green => write!(f, "42"),
- Color::Yellow => write!(f, "43"),
- Color::Blue => write!(f, "44"),
- Color::Purple => write!(f, "45"),
- Color::Magenta => write!(f, "45"),
- Color::Cyan => write!(f, "46"),
- Color::White => write!(f, "47"),
- Color::Fixed(num) => write!(f, "48;5;{}", num),
- Color::Rgb(r, g, b) => write!(f, "48;2;{};{};{}", r, g, b),
- Color::DarkGray => write!(f, "100"),
- Color::LightRed => write!(f, "101"),
- Color::LightGreen => write!(f, "102"),
- Color::LightYellow => write!(f, "103"),
- Color::LightBlue => write!(f, "104"),
- Color::LightPurple => write!(f, "105"),
- Color::LightMagenta => write!(f, "105"),
- Color::LightCyan => write!(f, "106"),
- Color::LightGray => write!(f, "107"),
- }
- }
-}
-
-/// Like `ANSIString`, but only displays the style prefix.
-///
-/// This type implements the `Display` trait, meaning it can be written to a
-/// `std::fmt` formatting without doing any extra allocation, and written to a
-/// string with the `.to_string()` method. For examples, see
-/// [`Style::prefix`](struct.Style.html#method.prefix).
-#[derive(Clone, Copy, Debug)]
-pub struct Prefix(Style);
-
-/// Like `ANSIString`, but only displays the difference between two
-/// styles.
-///
-/// This type implements the `Display` trait, meaning it can be written to a
-/// `std::fmt` formatting without doing any extra allocation, and written to a
-/// string with the `.to_string()` method. For examples, see
-/// [`Style::infix`](struct.Style.html#method.infix).
-#[derive(Clone, Copy, Debug)]
-pub struct Infix(Style, Style);
-
-/// Like `ANSIString`, but only displays the style suffix.
-///
-/// This type implements the `Display` trait, meaning it can be written to a
-/// `std::fmt` formatting without doing any extra allocation, and written to a
-/// string with the `.to_string()` method. For examples, see
-/// [`Style::suffix`](struct.Style.html#method.suffix).
-#[derive(Clone, Copy, Debug)]
-pub struct Suffix(Style);
-
-impl Style {
- /// The prefix bytes for this style. These are the bytes that tell the
- /// terminal to use a different color or font style.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::{Style, Color::Blue};
- ///
- /// let style = Style::default().bold();
- /// assert_eq!("\x1b[1m",
- /// style.prefix().to_string());
- ///
- /// let style = Blue.bold();
- /// assert_eq!("\x1b[1;34m",
- /// style.prefix().to_string());
- ///
- /// let style = Style::default();
- /// assert_eq!("",
- /// style.prefix().to_string());
- /// ```
- pub fn prefix(self) -> Prefix {
- Prefix(self)
- }
-
- /// The infix bytes between this style and `next` style. These are the bytes
- /// that tell the terminal to change the style to `next`. These may include
- /// a reset followed by the next color and style, depending on the two styles.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::{Style, Color::Green};
- ///
- /// let style = Style::default().bold();
- /// assert_eq!("\x1b[32m",
- /// style.infix(Green.bold()).to_string());
- ///
- /// let style = Green.normal();
- /// assert_eq!("\x1b[1m",
- /// style.infix(Green.bold()).to_string());
- ///
- /// let style = Style::default();
- /// assert_eq!("",
- /// style.infix(style).to_string());
- /// ```
- pub fn infix(self, next: Style) -> Infix {
- Infix(self, next)
- }
-
- /// The suffix for this style. These are the bytes that tell the terminal
- /// to reset back to its normal color and font style.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::{Style, Color::Green};
- ///
- /// let style = Style::default().bold();
- /// assert_eq!("\x1b[0m",
- /// style.suffix().to_string());
- ///
- /// let style = Green.normal().bold();
- /// assert_eq!("\x1b[0m",
- /// style.suffix().to_string());
- ///
- /// let style = Style::default();
- /// assert_eq!("",
- /// style.suffix().to_string());
- /// ```
- pub fn suffix(self) -> Suffix {
- Suffix(self)
- }
-}
-
-impl Color {
- /// The prefix bytes for this color as a `Style`. These are the bytes
- /// that tell the terminal to use a different color or font style.
- ///
- /// See also [`Style::prefix`](struct.Style.html#method.prefix).
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Color::Green;
- ///
- /// assert_eq!("\x1b[0m",
- /// Green.suffix().to_string());
- /// ```
- pub fn prefix(self) -> Prefix {
- Prefix(self.normal())
- }
-
- /// The infix bytes between this color and `next` color. These are the bytes
- /// that tell the terminal to use the `next` color, or to do nothing if
- /// the two colors are equal.
- ///
- /// See also [`Style::infix`](struct.Style.html#method.infix).
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Color::{Red, Yellow};
- ///
- /// assert_eq!("\x1b[33m",
- /// Red.infix(Yellow).to_string());
- /// ```
- pub fn infix(self, next: Color) -> Infix {
- Infix(self.normal(), next.normal())
- }
-
- /// The suffix for this color as a `Style`. These are the bytes that
- /// tell the terminal to reset back to its normal color and font style.
- ///
- /// See also [`Style::suffix`](struct.Style.html#method.suffix).
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Color::Purple;
- ///
- /// assert_eq!("\x1b[0m",
- /// Purple.suffix().to_string());
- /// ```
- pub fn suffix(self) -> Suffix {
- Suffix(self.normal())
- }
-}
-
-impl fmt::Display for Prefix {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- let f: &mut dyn fmt::Write = f;
- self.0.write_prefix(f)
- }
-}
-
-impl fmt::Display for Infix {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- use crate::difference::Difference;
-
- match Difference::between(&self.0, &self.1) {
- Difference::ExtraStyles(style) => {
- let f: &mut dyn fmt::Write = f;
- style.write_prefix(f)
- }
- Difference::Reset => {
- let f: &mut dyn fmt::Write = f;
- write!(f, "{}{}", RESET, self.1.prefix())
- }
- Difference::Empty => {
- Ok(()) // nothing to write
- }
- }
- }
-}
-
-impl fmt::Display for Suffix {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- let f: &mut dyn fmt::Write = f;
- self.0.write_suffix(f)
- }
-}
-
-#[cfg(test)]
-mod test {
- use crate::style::Color::*;
- use crate::style::Style;
-
- macro_rules! test {
- ($name: ident: $style: expr; $input: expr => $result: expr) => {
- #[test]
- fn $name() {
- assert_eq!($style.paint($input).to_string(), $result.to_string());
-
- let mut v = Vec::new();
- $style.paint($input.as_bytes()).write_to(&mut v).unwrap();
- assert_eq!(v.as_slice(), $result.as_bytes());
- }
- };
- }
-
- test!(plain: Style::default(); "text/plain" => "text/plain");
- test!(red: Red; "hi" => "\x1B[31mhi\x1B[0m");
- test!(black: Black.normal(); "hi" => "\x1B[30mhi\x1B[0m");
- test!(yellow_bold: Yellow.bold(); "hi" => "\x1B[1;33mhi\x1B[0m");
- test!(yellow_bold_2: Yellow.normal().bold(); "hi" => "\x1B[1;33mhi\x1B[0m");
- test!(blue_underline: Blue.underline(); "hi" => "\x1B[4;34mhi\x1B[0m");
- test!(green_bold_ul: Green.bold().underline(); "hi" => "\x1B[1;4;32mhi\x1B[0m");
- test!(green_bold_ul_2: Green.underline().bold(); "hi" => "\x1B[1;4;32mhi\x1B[0m");
- test!(purple_on_white: Purple.on(White); "hi" => "\x1B[47;35mhi\x1B[0m");
- test!(purple_on_white_2: Purple.normal().on(White); "hi" => "\x1B[47;35mhi\x1B[0m");
- test!(yellow_on_blue: Style::new().on(Blue).fg(Yellow); "hi" => "\x1B[44;33mhi\x1B[0m");
- test!(magenta_on_white: Magenta.on(White); "hi" => "\x1B[47;35mhi\x1B[0m");
- test!(magenta_on_white_2: Magenta.normal().on(White); "hi" => "\x1B[47;35mhi\x1B[0m");
- test!(yellow_on_blue_2: Cyan.on(Blue).fg(Yellow); "hi" => "\x1B[44;33mhi\x1B[0m");
- test!(cyan_bold_on_white: Cyan.bold().on(White); "hi" => "\x1B[1;47;36mhi\x1B[0m");
- test!(cyan_ul_on_white: Cyan.underline().on(White); "hi" => "\x1B[4;47;36mhi\x1B[0m");
- test!(cyan_bold_ul_on_white: Cyan.bold().underline().on(White); "hi" => "\x1B[1;4;47;36mhi\x1B[0m");
- test!(cyan_ul_bold_on_white: Cyan.underline().bold().on(White); "hi" => "\x1B[1;4;47;36mhi\x1B[0m");
- test!(fixed: Fixed(100); "hi" => "\x1B[38;5;100mhi\x1B[0m");
- test!(fixed_on_purple: Fixed(100).on(Purple); "hi" => "\x1B[45;38;5;100mhi\x1B[0m");
- test!(fixed_on_fixed: Fixed(100).on(Fixed(200)); "hi" => "\x1B[48;5;200;38;5;100mhi\x1B[0m");
- test!(rgb: Rgb(70,130,180); "hi" => "\x1B[38;2;70;130;180mhi\x1B[0m");
- test!(rgb_on_blue: Rgb(70,130,180).on(Blue); "hi" => "\x1B[44;38;2;70;130;180mhi\x1B[0m");
- test!(blue_on_rgb: Blue.on(Rgb(70,130,180)); "hi" => "\x1B[48;2;70;130;180;34mhi\x1B[0m");
- test!(rgb_on_rgb: Rgb(70,130,180).on(Rgb(5,10,15)); "hi" => "\x1B[48;2;5;10;15;38;2;70;130;180mhi\x1B[0m");
- test!(bold: Style::new().bold(); "hi" => "\x1B[1mhi\x1B[0m");
- test!(underline: Style::new().underline(); "hi" => "\x1B[4mhi\x1B[0m");
- test!(bunderline: Style::new().bold().underline(); "hi" => "\x1B[1;4mhi\x1B[0m");
- test!(dimmed: Style::new().dimmed(); "hi" => "\x1B[2mhi\x1B[0m");
- test!(italic: Style::new().italic(); "hi" => "\x1B[3mhi\x1B[0m");
- test!(blink: Style::new().blink(); "hi" => "\x1B[5mhi\x1B[0m");
- test!(reverse: Style::new().reverse(); "hi" => "\x1B[7mhi\x1B[0m");
- test!(hidden: Style::new().hidden(); "hi" => "\x1B[8mhi\x1B[0m");
- test!(stricken: Style::new().strikethrough(); "hi" => "\x1B[9mhi\x1B[0m");
- test!(lr_on_lr: LightRed.on(LightRed); "hi" => "\x1B[101;91mhi\x1B[0m");
-
- #[test]
- fn test_infix() {
- assert_eq!(
- Style::new().dimmed().infix(Style::new()).to_string(),
- "\x1B[0m"
- );
- assert_eq!(
- White.dimmed().infix(White.normal()).to_string(),
- "\x1B[0m\x1B[37m"
- );
- assert_eq!(White.normal().infix(White.bold()).to_string(), "\x1B[1m");
- assert_eq!(White.normal().infix(Blue.normal()).to_string(), "\x1B[34m");
- assert_eq!(Blue.bold().infix(Blue.bold()).to_string(), "");
- }
-}
diff --git a/old_nushell/crates/nu-ansi-term/src/debug.rs b/old_nushell/crates/nu-ansi-term/src/debug.rs
deleted file mode 100644
index 1dcde52be..000000000
--- a/old_nushell/crates/nu-ansi-term/src/debug.rs
+++ /dev/null
@@ -1,152 +0,0 @@
-use crate::style::Style;
-use std::fmt;
-
-/// Styles have a special `Debug` implementation that only shows the fields that
-/// are set. Fields that haven’t been touched aren’t included in the output.
-///
-/// This behaviour gets bypassed when using the alternate formatting mode
-/// `format!("{:#?}")`.
-///
-/// use nu_ansi_term::Color::{Red, Blue};
-/// assert_eq!("Style { fg(Red), on(Blue), bold, italic }",
-/// format!("{:?}", Red.on(Blue).bold().italic()));
-impl fmt::Debug for Style {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
- if fmt.alternate() {
- fmt.debug_struct("Style")
- .field("foreground", &self.foreground)
- .field("background", &self.background)
- .field("blink", &self.is_blink)
- .field("bold", &self.is_bold)
- .field("dimmed", &self.is_dimmed)
- .field("hidden", &self.is_hidden)
- .field("italic", &self.is_italic)
- .field("reverse", &self.is_reverse)
- .field("strikethrough", &self.is_strikethrough)
- .field("underline", &self.is_underline)
- .finish()
- } else if self.is_plain() {
- fmt.write_str("Style {}")
- } else {
- fmt.write_str("Style { ")?;
-
- let mut written_anything = false;
-
- if let Some(fg) = self.foreground {
- if written_anything {
- fmt.write_str(", ")?
- }
- written_anything = true;
- write!(fmt, "fg({:?})", fg)?
- }
-
- if let Some(bg) = self.background {
- if written_anything {
- fmt.write_str(", ")?
- }
- written_anything = true;
- write!(fmt, "on({:?})", bg)?
- }
-
- {
- let mut write_flag = |name| {
- if written_anything {
- fmt.write_str(", ")?
- }
- written_anything = true;
- fmt.write_str(name)
- };
-
- if self.is_blink {
- write_flag("blink")?
- }
- if self.is_bold {
- write_flag("bold")?
- }
- if self.is_dimmed {
- write_flag("dimmed")?
- }
- if self.is_hidden {
- write_flag("hidden")?
- }
- if self.is_italic {
- write_flag("italic")?
- }
- if self.is_reverse {
- write_flag("reverse")?
- }
- if self.is_strikethrough {
- write_flag("strikethrough")?
- }
- if self.is_underline {
- write_flag("underline")?
- }
- }
-
- write!(fmt, " }}")
- }
- }
-}
-
-#[cfg(test)]
-mod test {
- use crate::style::Color::*;
- use crate::style::Style;
-
- fn style() -> Style {
- Style::new()
- }
-
- macro_rules! test {
- ($name: ident: $obj: expr => $result: expr) => {
- #[test]
- fn $name() {
- assert_eq!($result, format!("{:?}", $obj));
- }
- };
- }
-
- test!(empty: style() => "Style {}");
- test!(bold: style().bold() => "Style { bold }");
- test!(italic: style().italic() => "Style { italic }");
- test!(both: style().bold().italic() => "Style { bold, italic }");
-
- test!(red: Red.normal() => "Style { fg(Red) }");
- test!(redblue: Red.normal().on(Rgb(3, 2, 4)) => "Style { fg(Red), on(Rgb(3, 2, 4)) }");
-
- test!(everything:
- Red.on(Blue).blink().bold().dimmed().hidden().italic().reverse().strikethrough().underline() =>
- "Style { fg(Red), on(Blue), blink, bold, dimmed, hidden, italic, reverse, strikethrough, underline }");
-
- #[test]
- fn long_and_detailed() {
- extern crate regex;
- let expected_debug = "Style { fg(Blue), bold }";
- let expected_pretty_repat = r##"(?x)
- Style\s+\{\s+
- foreground:\s+Some\(\s+
- Blue,?\s+
- \),\s+
- background:\s+None,\s+
- blink:\s+false,\s+
- bold:\s+true,\s+
- dimmed:\s+false,\s+
- hidden:\s+false,\s+
- italic:\s+false,\s+
- reverse:\s+false,\s+
- strikethrough:\s+
- false,\s+
- underline:\s+false,?\s+
- \}"##;
- let re = regex::Regex::new(expected_pretty_repat).unwrap();
-
- let style = Blue.bold();
- let style_fmt_debug = format!("{:?}", style);
- let style_fmt_pretty = format!("{:#?}", style);
- println!("style_fmt_debug:\n{}", style_fmt_debug);
- println!("style_fmt_pretty:\n{}", style_fmt_pretty);
-
- assert_eq!(expected_debug, style_fmt_debug);
- assert!(re.is_match(&style_fmt_pretty));
- }
-}
diff --git a/old_nushell/crates/nu-ansi-term/src/difference.rs b/old_nushell/crates/nu-ansi-term/src/difference.rs
deleted file mode 100644
index beee8ea25..000000000
--- a/old_nushell/crates/nu-ansi-term/src/difference.rs
+++ /dev/null
@@ -1,174 +0,0 @@
-use super::Style;
-
-/// When printing out one colored string followed by another, use one of
-/// these rules to figure out which *extra* control codes need to be sent.
-#[derive(PartialEq, Clone, Copy, Debug)]
-pub enum Difference {
- /// Print out the control codes specified by this style to end up looking
- /// like the second string's styles.
- ExtraStyles(Style),
-
- /// Converting between these two is impossible, so just send a reset
- /// command and then the second string's styles.
- Reset,
-
- /// The before style is exactly the same as the after style, so no further
- /// control codes need to be printed.
- Empty,
-}
-
-impl Difference {
- /// Compute the 'style difference' required to turn an existing style into
- /// the given, second style.
- ///
- /// For example, to turn green text into green bold text, it's redundant
- /// to write a reset command then a second green+bold command, instead of
- /// just writing one bold command. This method should see that both styles
- /// use the foreground color green, and reduce it to a single command.
- ///
- /// This method returns an enum value because it's not actually always
- /// possible to turn one style into another: for example, text could be
- /// made bold and underlined, but you can't remove the bold property
- /// without also removing the underline property. So when this has to
- /// happen, this function returns None, meaning that the entire set of
- /// styles should be reset and begun again.
- pub fn between(first: &Style, next: &Style) -> Difference {
- use self::Difference::*;
-
- // XXX(Havvy): This algorithm is kind of hard to replicate without
- // having the Plain/Foreground enum variants, so I'm just leaving
- // it commented out for now, and defaulting to Reset.
-
- if first == next {
- return Empty;
- }
-
- // Cannot un-bold, so must Reset.
- if first.is_bold && !next.is_bold {
- return Reset;
- }
-
- if first.is_dimmed && !next.is_dimmed {
- return Reset;
- }
-
- if first.is_italic && !next.is_italic {
- return Reset;
- }
-
- // Cannot un-underline, so must Reset.
- if first.is_underline && !next.is_underline {
- return Reset;
- }
-
- if first.is_blink && !next.is_blink {
- return Reset;
- }
-
- if first.is_reverse && !next.is_reverse {
- return Reset;
- }
-
- if first.is_hidden && !next.is_hidden {
- return Reset;
- }
-
- if first.is_strikethrough && !next.is_strikethrough {
- return Reset;
- }
-
- // Cannot go from foreground to no foreground, so must Reset.
- if first.foreground.is_some() && next.foreground.is_none() {
- return Reset;
- }
-
- // Cannot go from background to no background, so must Reset.
- if first.background.is_some() && next.background.is_none() {
- return Reset;
- }
-
- let mut extra_styles = Style::default();
-
- if first.is_bold != next.is_bold {
- extra_styles.is_bold = true;
- }
-
- if first.is_dimmed != next.is_dimmed {
- extra_styles.is_dimmed = true;
- }
-
- if first.is_italic != next.is_italic {
- extra_styles.is_italic = true;
- }
-
- if first.is_underline != next.is_underline {
- extra_styles.is_underline = true;
- }
-
- if first.is_blink != next.is_blink {
- extra_styles.is_blink = true;
- }
-
- if first.is_reverse != next.is_reverse {
- extra_styles.is_reverse = true;
- }
-
- if first.is_hidden != next.is_hidden {
- extra_styles.is_hidden = true;
- }
-
- if first.is_strikethrough != next.is_strikethrough {
- extra_styles.is_strikethrough = true;
- }
-
- if first.foreground != next.foreground {
- extra_styles.foreground = next.foreground;
- }
-
- if first.background != next.background {
- extra_styles.background = next.background;
- }
-
- ExtraStyles(extra_styles)
- }
-}
-
-#[cfg(test)]
-mod test {
- use super::Difference::*;
- use super::*;
- use crate::style::Color::*;
- use crate::style::Style;
-
- fn style() -> Style {
- Style::new()
- }
-
- macro_rules! test {
- ($name: ident: $first: expr; $next: expr => $result: expr) => {
- #[test]
- fn $name() {
- assert_eq!($result, Difference::between(&$first, &$next));
- }
- };
- }
-
- test!(nothing: Green.normal(); Green.normal() => Empty);
- test!(uppercase: Green.normal(); Green.bold() => ExtraStyles(style().bold()));
- test!(lowercase: Green.bold(); Green.normal() => Reset);
- test!(nothing2: Green.bold(); Green.bold() => Empty);
-
- test!(color_change: Red.normal(); Blue.normal() => ExtraStyles(Blue.normal()));
-
- test!(addition_of_blink: style(); style().blink() => ExtraStyles(style().blink()));
- test!(addition_of_dimmed: style(); style().dimmed() => ExtraStyles(style().dimmed()));
- test!(addition_of_hidden: style(); style().hidden() => ExtraStyles(style().hidden()));
- test!(addition_of_reverse: style(); style().reverse() => ExtraStyles(style().reverse()));
- test!(addition_of_strikethrough: style(); style().strikethrough() => ExtraStyles(style().strikethrough()));
-
- test!(removal_of_strikethrough: style().strikethrough(); style() => Reset);
- test!(removal_of_reverse: style().reverse(); style() => Reset);
- test!(removal_of_hidden: style().hidden(); style() => Reset);
- test!(removal_of_dimmed: style().dimmed(); style() => Reset);
- test!(removal_of_blink: style().blink(); style() => Reset);
-}
diff --git a/old_nushell/crates/nu-ansi-term/src/display.rs b/old_nushell/crates/nu-ansi-term/src/display.rs
deleted file mode 100644
index db5221f35..000000000
--- a/old_nushell/crates/nu-ansi-term/src/display.rs
+++ /dev/null
@@ -1,303 +0,0 @@
-use crate::ansi::RESET;
-use crate::difference::Difference;
-use crate::style::{Color, Style};
-use crate::write::AnyWrite;
-use std::borrow::Cow;
-use std::fmt;
-use std::io;
-use std::ops::Deref;
-
-/// An `ANSIGenericString` includes a generic string type and a `Style` to
-/// display that string. `ANSIString` and `ANSIByteString` are aliases for
-/// this type on `str` and `\[u8]`, respectively.
-#[derive(PartialEq, Debug)]
-pub struct AnsiGenericString<'a, S: 'a + ToOwned + ?Sized>
-where
- ::Owned: fmt::Debug,
-{
- style: Style,
- string: Cow<'a, S>,
-}
-
-/// Cloning an `ANSIGenericString` will clone its underlying string.
-///
-/// # Examples
-///
-/// ```
-/// use nu_ansi_term::ANSIString;
-///
-/// let plain_string = ANSIString::from("a plain string");
-/// let clone_string = plain_string.clone();
-/// assert_eq!(clone_string, plain_string);
-/// ```
-impl<'a, S: 'a + ToOwned + ?Sized> Clone for AnsiGenericString<'a, S>
-where
- ::Owned: fmt::Debug,
-{
- fn clone(&self) -> AnsiGenericString<'a, S> {
- AnsiGenericString {
- style: self.style,
- string: self.string.clone(),
- }
- }
-}
-
-// You might think that the hand-written Clone impl above is the same as the
-// one that gets generated with #[derive]. But it’s not *quite* the same!
-//
-// `str` is not Clone, and the derived Clone implementation puts a Clone
-// constraint on the S type parameter (generated using --pretty=expanded):
-//
-// ↓_________________↓
-// impl <'a, S: ::std::clone::Clone + 'a + ToOwned + ?Sized> ::std::clone::Clone
-// for ANSIGenericString<'a, S> where
-// ::Owned: fmt::Debug { ... }
-//
-// This resulted in compile errors when you tried to derive Clone on a type
-// that used it:
-//
-// #[derive(PartialEq, Debug, Clone, Default)]
-// pub struct TextCellContents(Vec>);
-// ^^^^^^^^^^^^^^^^^^^^^^^^^
-// error[E0277]: the trait `std::clone::Clone` is not implemented for `str`
-//
-// The hand-written impl above can ignore that constraint and still compile.
-
-/// An ANSI String is a string coupled with the `Style` to display it
-/// in a terminal.
-///
-/// Although not technically a string itself, it can be turned into
-/// one with the `to_string` method.
-///
-/// # Examples
-///
-/// ```
-/// use nu_ansi_term::ANSIString;
-/// use nu_ansi_term::Color::Red;
-///
-/// let red_string = Red.paint("a red string");
-/// println!("{}", red_string);
-/// ```
-///
-/// ```
-/// use nu_ansi_term::ANSIString;
-///
-/// let plain_string = ANSIString::from("a plain string");
-/// assert_eq!(&*plain_string, "a plain string");
-/// ```
-pub type AnsiString<'a> = AnsiGenericString<'a, str>;
-
-/// An `AnsiByteString` represents a formatted series of bytes. Use
-/// `AnsiByteString` when styling text with an unknown encoding.
-pub type AnsiByteString<'a> = AnsiGenericString<'a, [u8]>;
-
-impl<'a, I, S: 'a + ToOwned + ?Sized> From for AnsiGenericString<'a, S>
-where
- I: Into>,
- ::Owned: fmt::Debug,
-{
- fn from(input: I) -> AnsiGenericString<'a, S> {
- AnsiGenericString {
- string: input.into(),
- style: Style::default(),
- }
- }
-}
-
-impl<'a, S: 'a + ToOwned + ?Sized> AnsiGenericString<'a, S>
-where
- ::Owned: fmt::Debug,
-{
- /// Directly access the style
- pub fn style_ref(&self) -> &Style {
- &self.style
- }
-
- /// Directly access the style mutably
- pub fn style_ref_mut(&mut self) -> &mut Style {
- &mut self.style
- }
-}
-
-impl<'a, S: 'a + ToOwned + ?Sized> Deref for AnsiGenericString<'a, S>
-where
- ::Owned: fmt::Debug,
-{
- type Target = S;
-
- fn deref(&self) -> &S {
- self.string.deref()
- }
-}
-
-/// A set of `AnsiGenericStrings`s collected together, in order to be
-/// written with a minimum of control characters.
-#[derive(Debug, PartialEq)]
-pub struct AnsiGenericStrings<'a, S: 'a + ToOwned + ?Sized>(pub &'a [AnsiGenericString<'a, S>])
-where
- ::Owned: fmt::Debug,
- S: PartialEq;
-
-/// A set of `AnsiString`s collected together, in order to be written with a
-/// minimum of control characters.
-pub type AnsiStrings<'a> = AnsiGenericStrings<'a, str>;
-
-/// A function to construct an `AnsiStrings` instance.
-#[allow(non_snake_case)]
-pub fn AnsiStrings<'a>(arg: &'a [AnsiString<'a>]) -> AnsiStrings<'a> {
- AnsiGenericStrings(arg)
-}
-
-/// A set of `AnsiByteString`s collected together, in order to be
-/// written with a minimum of control characters.
-pub type AnsiByteStrings<'a> = AnsiGenericStrings<'a, [u8]>;
-
-/// A function to construct an `ANSIByteStrings` instance.
-#[allow(non_snake_case)]
-pub fn ANSIByteStrings<'a>(arg: &'a [AnsiByteString<'a>]) -> AnsiByteStrings<'a> {
- AnsiGenericStrings(arg)
-}
-
-// ---- paint functions ----
-
-impl Style {
- /// Paints the given text with this color, returning an ANSI string.
- #[must_use]
- pub fn paint<'a, I, S: 'a + ToOwned + ?Sized>(self, input: I) -> AnsiGenericString<'a, S>
- where
- I: Into>,
- ::Owned: fmt::Debug,
- {
- AnsiGenericString {
- string: input.into(),
- style: self,
- }
- }
-}
-
-impl Color {
- /// Paints the given text with this color, returning an ANSI string.
- /// This is a short-cut so you don’t have to use `Blue.normal()` just
- /// to get blue text.
- ///
- /// ```
- /// use nu_ansi_term::Color::Blue;
- /// println!("{}", Blue.paint("da ba dee"));
- /// ```
- #[must_use]
- pub fn paint<'a, I, S: 'a + ToOwned + ?Sized>(self, input: I) -> AnsiGenericString<'a, S>
- where
- I: Into>,
- ::Owned: fmt::Debug,
- {
- AnsiGenericString {
- string: input.into(),
- style: self.normal(),
- }
- }
-}
-
-// ---- writers for individual ANSI strings ----
-
-impl<'a> fmt::Display for AnsiString<'a> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- let w: &mut dyn fmt::Write = f;
- self.write_to_any(w)
- }
-}
-
-impl<'a> AnsiByteString<'a> {
- /// Write an `ANSIByteString` to an `io::Write`. This writes the escape
- /// sequences for the associated `Style` around the bytes.
- pub fn write_to(&self, w: &mut W) -> io::Result<()> {
- let w: &mut dyn io::Write = w;
- self.write_to_any(w)
- }
-}
-
-impl<'a, S: 'a + ToOwned + ?Sized> AnsiGenericString<'a, S>
-where
- ::Owned: fmt::Debug,
- &'a S: AsRef<[u8]>,
-{
- fn write_to_any + ?Sized>(&self, w: &mut W) -> Result<(), W::Error> {
- write!(w, "{}", self.style.prefix())?;
- w.write_str(self.string.as_ref())?;
- write!(w, "{}", self.style.suffix())
- }
-}
-
-// ---- writers for combined ANSI strings ----
-
-impl<'a> fmt::Display for AnsiStrings<'a> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- let f: &mut dyn fmt::Write = f;
- self.write_to_any(f)
- }
-}
-
-impl<'a> AnsiByteStrings<'a> {
- /// Write `ANSIByteStrings` to an `io::Write`. This writes the minimal
- /// escape sequences for the associated `Style`s around each set of
- /// bytes.
- pub fn write_to(&self, w: &mut W) -> io::Result<()> {
- let w: &mut dyn io::Write = w;
- self.write_to_any(w)
- }
-}
-
-impl<'a, S: 'a + ToOwned + ?Sized + PartialEq> AnsiGenericStrings<'a, S>
-where
- ::Owned: fmt::Debug,
- &'a S: AsRef<[u8]>,
-{
- fn write_to_any + ?Sized>(&self, w: &mut W) -> Result<(), W::Error> {
- use self::Difference::*;
-
- let first = match self.0.first() {
- None => return Ok(()),
- Some(f) => f,
- };
-
- write!(w, "{}", first.style.prefix())?;
- w.write_str(first.string.as_ref())?;
-
- for window in self.0.windows(2) {
- match Difference::between(&window[0].style, &window[1].style) {
- ExtraStyles(style) => write!(w, "{}", style.prefix())?,
- Reset => write!(w, "{}{}", RESET, window[1].style.prefix())?,
- Empty => { /* Do nothing! */ }
- }
-
- w.write_str(&window[1].string)?;
- }
-
- // Write the final reset string after all of the ANSIStrings have been
- // written, *except* if the last one has no styles, because it would
- // have already been written by this point.
- if let Some(last) = self.0.last() {
- if !last.style.is_plain() {
- write!(w, "{}", RESET)?;
- }
- }
-
- Ok(())
- }
-}
-
-// ---- tests ----
-
-#[cfg(test)]
-mod tests {
- pub use super::super::AnsiStrings;
- pub use crate::style::Color::*;
- pub use crate::style::Style;
-
- #[test]
- fn no_control_codes_for_plain() {
- let one = Style::default().paint("one");
- let two = Style::default().paint("two");
- let output = AnsiStrings(&[one, two]).to_string();
- assert_eq!(output, "onetwo");
- }
-}
diff --git a/old_nushell/crates/nu-ansi-term/src/gradient.rs b/old_nushell/crates/nu-ansi-term/src/gradient.rs
deleted file mode 100644
index a0d94c8cd..000000000
--- a/old_nushell/crates/nu-ansi-term/src/gradient.rs
+++ /dev/null
@@ -1,105 +0,0 @@
-use crate::{rgb::Rgb, Color};
-
-/// Linear color gradient between two color stops
-#[derive(Debug, Clone, Copy, PartialEq, Eq)]
-pub struct Gradient {
- /// Start Color of Gradient
- pub start: Rgb,
-
- /// End Color of Gradient
- pub end: Rgb,
-}
-
-impl Gradient {
- /// Creates a new [Gradient] with two [Rgb] colors, `start` and `end`
- #[inline]
- pub const fn new(start: Rgb, end: Rgb) -> Self {
- Self { start, end }
- }
- pub const fn from_color_rgb(start: Color, end: Color) -> Self {
- let start_grad = match start {
- Color::Rgb(r, g, b) => Rgb { r, g, b },
- _ => Rgb { r: 0, g: 0, b: 0 },
- };
- let end_grad = match end {
- Color::Rgb(r, g, b) => Rgb { r, g, b },
- _ => Rgb { r: 0, g: 0, b: 0 },
- };
-
- Self {
- start: start_grad,
- end: end_grad,
- }
- }
-
- /// Computes the [Rgb] color between `start` and `end` for `t`
- pub fn at(&self, t: f32) -> Rgb {
- self.start.lerp(self.end, t)
- }
-
- /// Returns the reverse of `self`
- #[inline]
- pub const fn reverse(&self) -> Self {
- Self::new(self.end, self.start)
- }
-
- #[allow(dead_code)]
- pub fn build(&self, text: &str, target: TargetGround) -> String {
- let delta = 1.0 / text.len() as f32;
- let mut result = text.char_indices().fold(String::new(), |mut acc, (i, c)| {
- let temp = format!(
- "\x1B[{}m{}",
- self.at(i as f32 * delta).ansi_color_code(target),
- c
- );
- acc.push_str(&temp);
- acc
- });
-
- result.push_str("\x1B[0m");
- result
- }
-}
-
-#[allow(dead_code)]
-pub fn build_all_gradient_text(text: &str, foreground: Gradient, background: Gradient) -> String {
- let delta = 1.0 / text.len() as f32;
- let mut result = text.char_indices().fold(String::new(), |mut acc, (i, c)| {
- let step = i as f32 * delta;
- let temp = format!(
- "\x1B[{};{}m{}",
- foreground
- .at(step)
- .ansi_color_code(TargetGround::Foreground),
- background
- .at(step)
- .ansi_color_code(TargetGround::Background),
- c
- );
- acc.push_str(&temp);
- acc
- });
-
- result.push_str("\x1B[0m");
- result
-}
-
-#[derive(Debug, Clone, Copy, PartialEq, Eq)]
-pub enum TargetGround {
- Foreground,
- Background,
-}
-
-impl TargetGround {
- #[inline]
- pub const fn code(&self) -> u8 {
- match self {
- Self::Foreground => 30,
- Self::Background => 40,
- }
- }
-}
-
-pub trait ANSIColorCode {
- fn ansi_color_code(&self, target: TargetGround) -> String;
-}
diff --git a/old_nushell/crates/nu-ansi-term/src/lib.rs b/old_nushell/crates/nu-ansi-term/src/lib.rs
deleted file mode 100644
index d33b9bb52..000000000
--- a/old_nushell/crates/nu-ansi-term/src/lib.rs
+++ /dev/null
@@ -1,272 +0,0 @@
-//! This is a library for controlling colors and formatting, such as
-//! red bold text or blue underlined text, on ANSI terminals.
-//!
-//!
-//! ## Basic usage
-//!
-//! There are three main types in this crate that you need to be
-//! concerned with: [`ANSIString`], [`Style`], and [`Color`].
-//!
-//! A `Style` holds stylistic information: foreground and background colors,
-//! whether the text should be bold, or blinking, or other properties. The
-//! [`Color`] enum represents the available colors. And an [`ANSIString`] is a
-//! string paired with a [`Style`].
-//!
-//! [`Color`] is also available as an alias to `Color`.
-//!
-//! To format a string, call the `paint` method on a `Style` or a `Color`,
-//! passing in the string you want to format as the argument. For example,
-//! here’s how to get some red text:
-//!
-//! ```
-//! use nu_ansi_term::Color::Red;
-//!
-//! println!("This is in red: {}", Red.paint("a red string"));
-//! ```
-//!
-//! It’s important to note that the `paint` method does *not* actually return a
-//! string with the ANSI control characters surrounding it. Instead, it returns
-//! an [`ANSIString`] value that has a [`Display`] implementation that, when
-//! formatted, returns the characters. This allows strings to be printed with a
-//! minimum of [`String`] allocations being performed behind the scenes.
-//!
-//! If you *do* want to get at the escape codes, then you can convert the
-//! [`ANSIString`] to a string as you would any other `Display` value:
-//!
-//! ```
-//! use nu_ansi_term::Color::Red;
-//!
-//! let red_string = Red.paint("a red string").to_string();
-//! ```
-//!
-//!
-//! ## Bold, underline, background, and other styles
-//!
-//! For anything more complex than plain foreground color changes, you need to
-//! construct `Style` values themselves, rather than beginning with a `Color`.
-//! You can do this by chaining methods based on a new `Style`, created with
-//! [`Style::new()`]. Each method creates a new style that has that specific
-//! property set. For example:
-//!
-//! ```
-//! use nu_ansi_term::Style;
-//!
-//! println!("How about some {} and {}?",
-//! Style::new().bold().paint("bold"),
-//! Style::new().underline().paint("underline"));
-//! ```
-//!
-//! For brevity, these methods have also been implemented for `Color` values,
-//! so you can give your styles a foreground color without having to begin with
-//! an empty `Style` value:
-//!
-//! ```
-//! use nu_ansi_term::Color::{Blue, Yellow};
-//!
-//! println!("Demonstrating {} and {}!",
-//! Blue.bold().paint("blue bold"),
-//! Yellow.underline().paint("yellow underline"));
-//!
-//! println!("Yellow on blue: {}", Yellow.on(Blue).paint("wow!"));
-//! ```
-//!
-//! The complete list of styles you can use are: [`bold`], [`dimmed`], [`italic`],
-//! [`underline`], [`blink`], [`reverse`], [`hidden`], [`strikethrough`], and [`on`] for
-//! background colors.
-//!
-//! In some cases, you may find it easier to change the foreground on an
-//! existing `Style` rather than starting from the appropriate `Color`.
-//! You can do this using the [`fg`] method:
-//!
-//! ```
-//! use nu_ansi_term::Style;
-//! use nu_ansi_term::Color::{Blue, Cyan, Yellow};
-//!
-//! println!("Yellow on blue: {}", Style::new().on(Blue).fg(Yellow).paint("yow!"));
-//! println!("Also yellow on blue: {}", Cyan.on(Blue).fg(Yellow).paint("zow!"));
-//! ```
-//!
-//! You can turn a `Color` into a `Style` with the [`normal`] method.
-//! This will produce the exact same `ANSIString` as if you just used the
-//! `paint` method on the `Color` directly, but it’s useful in certain cases:
-//! for example, you may have a method that returns `Styles`, and need to
-//! represent both the “red bold” and “red, but not bold” styles with values of
-//! the same type. The `Style` struct also has a [`Default`] implementation if you
-//! want to have a style with *nothing* set.
-//!
-//! ```
-//! use nu_ansi_term::Style;
-//! use nu_ansi_term::Color::Red;
-//!
-//! Red.normal().paint("yet another red string");
-//! Style::default().paint("a completely regular string");
-//! ```
-//!
-//!
-//! ## Extended colors
-//!
-//! You can access the extended range of 256 colors by using the `Color::Fixed`
-//! variant, which takes an argument of the color number to use. This can be
-//! included wherever you would use a `Color`:
-//!
-//! ```
-//! use nu_ansi_term::Color::Fixed;
-//!
-//! Fixed(134).paint("A sort of light purple");
-//! Fixed(221).on(Fixed(124)).paint("Mustard in the ketchup");
-//! ```
-//!
-//! The first sixteen of these values are the same as the normal and bold
-//! standard color variants. There’s nothing stopping you from using these as
-//! `Fixed` colors instead, but there’s nothing to be gained by doing so
-//! either.
-//!
-//! You can also access full 24-bit color by using the `Color::Rgb` variant,
-//! which takes separate `u8` arguments for red, green, and blue:
-//!
-//! ```
-//! use nu_ansi_term::Color::Rgb;
-//!
-//! Rgb(70, 130, 180).paint("Steel blue");
-//! ```
-//!
-//! ## Combining successive colored strings
-//!
-//! The benefit of writing ANSI escape codes to the terminal is that they
-//! *stack*: you do not need to end every colored string with a reset code if
-//! the text that follows it is of a similar style. For example, if you want to
-//! have some blue text followed by some blue bold text, it’s possible to send
-//! the ANSI code for blue, followed by the ANSI code for bold, and finishing
-//! with a reset code without having to have an extra one between the two
-//! strings.
-//!
-//! This crate can optimise the ANSI codes that get printed in situations like
-//! this, making life easier for your terminal renderer. The [`ANSIStrings`]
-//! type takes a slice of several [`ANSIString`] values, and will iterate over
-//! each of them, printing only the codes for the styles that need to be updated
-//! as part of its formatting routine.
-//!
-//! The following code snippet uses this to enclose a binary number displayed in
-//! red bold text inside some red, but not bold, brackets:
-//!
-//! ```
-//! use nu_ansi_term::Color::Red;
-//! use nu_ansi_term::{ANSIString, ANSIStrings};
-//!
-//! let some_value = format!("{:b}", 42);
-//! let strings: &[ANSIString<'static>] = &[
-//! Red.paint("["),
-//! Red.bold().paint(some_value),
-//! Red.paint("]"),
-//! ];
-//!
-//! println!("Value: {}", ANSIStrings(strings));
-//! ```
-//!
-//! There are several things to note here. Firstly, the [`paint`] method can take
-//! *either* an owned [`String`] or a borrowed [`&str`]. Internally, an [`ANSIString`]
-//! holds a copy-on-write ([`Cow`]) string value to deal with both owned and
-//! borrowed strings at the same time. This is used here to display a `String`,
-//! the result of the `format!` call, using the same mechanism as some
-//! statically-available `&str` slices. Secondly, that the [`ANSIStrings`] value
-//! works in the same way as its singular counterpart, with a [`Display`]
-//! implementation that only performs the formatting when required.
-//!
-//! ## Byte strings
-//!
-//! This library also supports formatting `\[u8]` byte strings; this supports
-//! applications working with text in an unknown encoding. [`Style`] and
-//! [`Color`] support painting `\[u8]` values, resulting in an [`ANSIByteString`].
-//! This type does not implement [`Display`], as it may not contain UTF-8, but
-//! it does provide a method [`write_to`] to write the result to any value that
-//! implements [`Write`]:
-//!
-//! ```
-//! use nu_ansi_term::Color::Green;
-//!
-//! Green.paint("user data".as_bytes()).write_to(&mut std::io::stdout()).unwrap();
-//! ```
-//!
-//! Similarly, the type [`ANSIByteStrings`] supports writing a list of
-//! [`ANSIByteString`] values with minimal escape sequences:
-//!
-//! ```
-//! use nu_ansi_term::Color::Green;
-//! use nu_ansi_term::ANSIByteStrings;
-//!
-//! ANSIByteStrings(&[
-//! Green.paint("user data 1\n".as_bytes()),
-//! Green.bold().paint("user data 2\n".as_bytes()),
-//! ]).write_to(&mut std::io::stdout()).unwrap();
-//! ```
-//!
-//! [`Cow`]: https://doc.rust-lang.org/std/borrow/enum.Cow.html
-//! [`Display`]: https://doc.rust-lang.org/std/fmt/trait.Display.html
-//! [`Default`]: https://doc.rust-lang.org/std/default/trait.Default.html
-//! [`String`]: https://doc.rust-lang.org/std/string/struct.String.html
-//! [`&str`]: https://doc.rust-lang.org/std/primitive.str.html
-//! [`Write`]: https://doc.rust-lang.org/std/io/trait.Write.html
-//! [`Style`]: struct.Style.html
-//! [`Style::new()`]: struct.Style.html#method.new
-//! [`Color`]: enum.Color.html
-//! [`Color`]: enum.Color.html
-//! [`ANSIString`]: type.ANSIString.html
-//! [`ANSIStrings`]: type.ANSIStrings.html
-//! [`ANSIByteString`]: type.ANSIByteString.html
-//! [`ANSIByteStrings`]: type.ANSIByteStrings.html
-//! [`write_to`]: type.ANSIByteString.html#method.write_to
-//! [`paint`]: type.ANSIByteString.html#method.write_to
-//! [`normal`]: enum.Color.html#method.normal
-//!
-//! [`bold`]: struct.Style.html#method.bold
-//! [`dimmed`]: struct.Style.html#method.dimmed
-//! [`italic`]: struct.Style.html#method.italic
-//! [`underline`]: struct.Style.html#method.underline
-//! [`blink`]: struct.Style.html#method.blink
-//! [`reverse`]: struct.Style.html#method.reverse
-//! [`hidden`]: struct.Style.html#method.hidden
-//! [`strikethrough`]: struct.Style.html#method.strikethrough
-//! [`fg`]: struct.Style.html#method.fg
-//! [`on`]: struct.Style.html#method.on
-
-#![crate_name = "nu_ansi_term"]
-#![crate_type = "rlib"]
-#![warn(missing_copy_implementations)]
-// #![warn(missing_docs)]
-#![warn(trivial_casts, trivial_numeric_casts)]
-// #![warn(unused_extern_crates, unused_qualifications)]
-
-#[cfg(target_os = "windows")]
-extern crate winapi;
-#[cfg(test)]
-#[macro_use]
-extern crate doc_comment;
-
-#[cfg(test)]
-doctest!("../README.md");
-
-pub mod ansi;
-pub use ansi::{Infix, Prefix, Suffix};
-
-mod style;
-pub use style::{Color, Style};
-
-mod difference;
-mod display;
-pub use display::*;
-
-mod write;
-
-mod windows;
-pub use windows::*;
-
-mod util;
-pub use util::*;
-
-mod debug;
-
-pub mod gradient;
-pub use gradient::*;
-
-mod rgb;
-pub use rgb::*;
diff --git a/old_nushell/crates/nu-ansi-term/src/rgb.rs b/old_nushell/crates/nu-ansi-term/src/rgb.rs
deleted file mode 100644
index 19475c36b..000000000
--- a/old_nushell/crates/nu-ansi-term/src/rgb.rs
+++ /dev/null
@@ -1,173 +0,0 @@
-// Code liberally borrowed from here
-// https://github.com/navierr/coloriz
-use std::ops;
-use std::u32;
-#[derive(Debug, Clone, Copy, PartialEq, Eq)]
-pub struct Rgb {
- /// Red
- pub r: u8,
- /// Green
- pub g: u8,
- /// Blue
- pub b: u8,
-}
-
-impl Rgb {
- /// Creates a new [Rgb] color
- #[inline]
- pub const fn new(r: u8, g: u8, b: u8) -> Self {
- Self { r, g, b }
- }
-
- /// Creates a new [Rgb] color with a hex code
- #[inline]
- pub const fn from_hex(hex: u32) -> Self {
- Self::new((hex >> 16) as u8, (hex >> 8) as u8, hex as u8)
- }
-
- pub fn from_hex_string(hex: String) -> Self {
- if hex.chars().count() == 8 && hex.starts_with("0x") {
- // eprintln!("hex:{:?}", hex);
- let (_, value_string) = hex.split_at(2);
- // eprintln!("value_string:{:?}", value_string);
- let int_val = u64::from_str_radix(value_string, 16);
- match int_val {
- Ok(num) => Self::new(
- ((num & 0xff0000) >> 16) as u8,
- ((num & 0xff00) >> 8) as u8,
- (num & 0xff) as u8,
- ),
- // Don't fail, just make the color black
- // Should we fail?
- _ => Self::new(0, 0, 0),
- }
- } else {
- // Don't fail, just make the color black.
- // Should we fail?
- Self::new(0, 0, 0)
- }
- }
-
- /// Creates a new [Rgb] color with three [f32] values
- pub fn from_f32(r: f32, g: f32, b: f32) -> Self {
- Self::new(
- (r.clamp(0.0, 1.0) * 255.0) as u8,
- (g.clamp(0.0, 1.0) * 255.0) as u8,
- (b.clamp(0.0, 1.0) * 255.0) as u8,
- )
- }
-
- /// Creates a grayscale [Rgb] color
- #[inline]
- pub const fn gray(x: u8) -> Self {
- Self::new(x, x, x)
- }
-
- /// Creates a grayscale [Rgb] color with a [f32] value
- pub fn gray_f32(x: f32) -> Self {
- Self::from_f32(x, x, x)
- }
-
- /// Creates a new [Rgb] color from a [HSL] color
- // pub fn from_hsl(hsl: HSL) -> Self {
- // if hsl.s == 0.0 {
- // return Self::gray_f32(hsl.l);
- // }
-
- // let q = if hsl.l < 0.5 {
- // hsl.l * (1.0 + hsl.s)
- // } else {
- // hsl.l + hsl.s - hsl.l * hsl.s
- // };
- // let p = 2.0 * hsl.l - q;
- // let h2c = |t: f32| {
- // let t = t.clamp(0.0, 1.0);
- // if 6.0 * t < 1.0 {
- // p + 6.0 * (q - p) * t
- // } else if t < 0.5 {
- // q
- // } else if 1.0 < 1.5 * t {
- // p + 6.0 * (q - p) * (1.0 / 1.5 - t)
- // } else {
- // p
- // }
- // };
-
- // Self::from_f32(h2c(hsl.h + 1.0 / 3.0), h2c(hsl.h), h2c(hsl.h - 1.0 / 3.0))
- // }
-
- /// Computes the linear interpolation between `self` and `other` for `t`
- pub fn lerp(&self, other: Self, t: f32) -> Self {
- let t = t.clamp(0.0, 1.0);
- self * (1.0 - t) + other * t
- }
-}
-
-impl From<(u8, u8, u8)> for Rgb {
- fn from((r, g, b): (u8, u8, u8)) -> Self {
- Self::new(r, g, b)
- }
-}
-
-impl From<(f32, f32, f32)> for Rgb {
- fn from((r, g, b): (f32, f32, f32)) -> Self {
- Self::from_f32(r, g, b)
- }
-}
-
-use crate::ANSIColorCode;
-use crate::TargetGround;
-impl ANSIColorCode for Rgb {
- fn ansi_color_code(&self, target: TargetGround) -> String {
- format!("{};2;{};{};{}", target.code() + 8, self.r, self.g, self.b)
- }
-}
-
-overload::overload!(
- (lhs: ?Rgb) + (rhs: ?Rgb) -> Rgb {
- Rgb::new(
- lhs.r.saturating_add(rhs.r),
- lhs.g.saturating_add(rhs.g),
- lhs.b.saturating_add(rhs.b)
- )
- }
-);
-
-overload::overload!(
- (lhs: ?Rgb) - (rhs: ?Rgb) -> Rgb {
- Rgb::new(
- lhs.r.saturating_sub(rhs.r),
- lhs.g.saturating_sub(rhs.g),
- lhs.b.saturating_sub(rhs.b)
- )
- }
-);
-
-overload::overload!(
- (lhs: ?Rgb) * (rhs: ?f32) -> Rgb {
- Rgb::new(
- (lhs.r as f32 * rhs.clamp(0.0, 1.0)) as u8,
- (lhs.g as f32 * rhs.clamp(0.0, 1.0)) as u8,
- (lhs.b as f32 * rhs.clamp(0.0, 1.0)) as u8
- )
- }
-);
-
-overload::overload!(
- (lhs: ?f32) * (rhs: ?Rgb) -> Rgb {
- Rgb::new(
- (rhs.r as f32 * lhs.clamp(0.0, 1.0)) as u8,
- (rhs.g as f32 * lhs.clamp(0.0, 1.0)) as u8,
- (rhs.b as f32 * lhs.clamp(0.0, 1.0)) as u8
- )
- }
-);
-
-overload::overload!(
- -(rgb: ?Rgb) -> Rgb {
- Rgb::new(
- 255 - rgb.r,
- 255 - rgb.g,
- 255 - rgb.b)
- }
-);
diff --git a/old_nushell/crates/nu-ansi-term/src/style.rs b/old_nushell/crates/nu-ansi-term/src/style.rs
deleted file mode 100644
index c4f1d7514..000000000
--- a/old_nushell/crates/nu-ansi-term/src/style.rs
+++ /dev/null
@@ -1,626 +0,0 @@
-/// A style is a collection of properties that can format a string
-/// using ANSI escape codes.
-///
-/// # Examples
-///
-/// ```
-/// use nu_ansi_term::{Style, Color};
-///
-/// let style = Style::new().bold().on(Color::Black);
-/// println!("{}", style.paint("Bold on black"));
-/// ```
-#[derive(PartialEq, Clone, Copy)]
-#[cfg_attr(
- feature = "derive_serde_style",
- derive(serde::Deserialize, serde::Serialize)
-)]
-pub struct Style {
- /// The style's foreground color, if it has one.
- pub foreground: Option,
-
- /// The style's background color, if it has one.
- pub background: Option,
-
- /// Whether this style is bold.
- pub is_bold: bool,
-
- /// Whether this style is dimmed.
- pub is_dimmed: bool,
-
- /// Whether this style is italic.
- pub is_italic: bool,
-
- /// Whether this style is underlined.
- pub is_underline: bool,
-
- /// Whether this style is blinking.
- pub is_blink: bool,
-
- /// Whether this style has reverse colors.
- pub is_reverse: bool,
-
- /// Whether this style is hidden.
- pub is_hidden: bool,
-
- /// Whether this style is struckthrough.
- pub is_strikethrough: bool,
-}
-
-impl Style {
- /// Creates a new Style with no properties set.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Style;
- ///
- /// let style = Style::new();
- /// println!("{}", style.paint("hi"));
- /// ```
- pub fn new() -> Style {
- Style::default()
- }
-
- /// Returns a `Style` with the bold property set.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Style;
- ///
- /// let style = Style::new().bold();
- /// println!("{}", style.paint("hey"));
- /// ```
- pub fn bold(&self) -> Style {
- Style {
- is_bold: true,
- ..*self
- }
- }
-
- /// Returns a `Style` with the dimmed property set.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Style;
- ///
- /// let style = Style::new().dimmed();
- /// println!("{}", style.paint("sup"));
- /// ```
- pub fn dimmed(&self) -> Style {
- Style {
- is_dimmed: true,
- ..*self
- }
- }
-
- /// Returns a `Style` with the italic property set.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Style;
- ///
- /// let style = Style::new().italic();
- /// println!("{}", style.paint("greetings"));
- /// ```
- pub fn italic(&self) -> Style {
- Style {
- is_italic: true,
- ..*self
- }
- }
-
- /// Returns a `Style` with the underline property set.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Style;
- ///
- /// let style = Style::new().underline();
- /// println!("{}", style.paint("salutations"));
- /// ```
- pub fn underline(&self) -> Style {
- Style {
- is_underline: true,
- ..*self
- }
- }
-
- /// Returns a `Style` with the blink property set.
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Style;
- ///
- /// let style = Style::new().blink();
- /// println!("{}", style.paint("wazzup"));
- /// ```
- pub fn blink(&self) -> Style {
- Style {
- is_blink: true,
- ..*self
- }
- }
-
- /// Returns a `Style` with the reverse property set.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Style;
- ///
- /// let style = Style::new().reverse();
- /// println!("{}", style.paint("aloha"));
- /// ```
- pub fn reverse(&self) -> Style {
- Style {
- is_reverse: true,
- ..*self
- }
- }
-
- /// Returns a `Style` with the hidden property set.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Style;
- ///
- /// let style = Style::new().hidden();
- /// println!("{}", style.paint("ahoy"));
- /// ```
- pub fn hidden(&self) -> Style {
- Style {
- is_hidden: true,
- ..*self
- }
- }
-
- /// Returns a `Style` with the strikethrough property set.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Style;
- ///
- /// let style = Style::new().strikethrough();
- /// println!("{}", style.paint("yo"));
- /// ```
- pub fn strikethrough(&self) -> Style {
- Style {
- is_strikethrough: true,
- ..*self
- }
- }
-
- /// Returns a `Style` with the foreground color property set.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::{Style, Color};
- ///
- /// let style = Style::new().fg(Color::Yellow);
- /// println!("{}", style.paint("hi"));
- /// ```
- pub fn fg(&self, foreground: Color) -> Style {
- Style {
- foreground: Some(foreground),
- ..*self
- }
- }
-
- /// Returns a `Style` with the background color property set.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::{Style, Color};
- ///
- /// let style = Style::new().on(Color::Blue);
- /// println!("{}", style.paint("eyyyy"));
- /// ```
- pub fn on(&self, background: Color) -> Style {
- Style {
- background: Some(background),
- ..*self
- }
- }
-
- /// Return true if this `Style` has no actual styles, and can be written
- /// without any control characters.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Style;
- ///
- /// assert_eq!(true, Style::default().is_plain());
- /// assert_eq!(false, Style::default().bold().is_plain());
- /// ```
- pub fn is_plain(self) -> bool {
- self == Style::default()
- }
-}
-
-impl Default for Style {
- /// Returns a style with *no* properties set. Formatting text using this
- /// style returns the exact same text.
- ///
- /// ```
- /// use nu_ansi_term::Style;
- /// assert_eq!(None, Style::default().foreground);
- /// assert_eq!(None, Style::default().background);
- /// assert_eq!(false, Style::default().is_bold);
- /// assert_eq!("txt", Style::default().paint("txt").to_string());
- /// ```
- fn default() -> Style {
- Style {
- foreground: None,
- background: None,
- is_bold: false,
- is_dimmed: false,
- is_italic: false,
- is_underline: false,
- is_blink: false,
- is_reverse: false,
- is_hidden: false,
- is_strikethrough: false,
- }
- }
-}
-
-// ---- colors ----
-
-/// A color is one specific type of ANSI escape code, and can refer
-/// to either the foreground or background color.
-///
-/// These use the standard numeric sequences.
-/// See
-#[derive(PartialEq, Clone, Copy, Debug)]
-#[cfg_attr(
- feature = "derive_serde_style",
- derive(serde::Deserialize, serde::Serialize)
-)]
-pub enum Color {
- /// Color #0 (foreground code `30`, background code `40`).
- ///
- /// This is not necessarily the background color, and using it as one may
- /// render the text hard to read on terminals with dark backgrounds.
- Black,
-
- /// Color #0 (foreground code `90`, background code `100`).
- DarkGray,
-
- /// Color #1 (foreground code `31`, background code `41`).
- Red,
-
- /// Color #1 (foreground code `91`, background code `101`).
- LightRed,
-
- /// Color #2 (foreground code `32`, background code `42`).
- Green,
-
- /// Color #2 (foreground code `92`, background code `102`).
- LightGreen,
-
- /// Color #3 (foreground code `33`, background code `43`).
- Yellow,
-
- /// Color #3 (foreground code `93`, background code `103`).
- LightYellow,
-
- /// Color #4 (foreground code `34`, background code `44`).
- Blue,
-
- /// Color #4 (foreground code `94`, background code `104`).
- LightBlue,
-
- /// Color #5 (foreground code `35`, background code `45`).
- Purple,
-
- /// Color #5 (foreground code `95`, background code `105`).
- LightPurple,
-
- /// Color #5 (foreground code `35`, background code `45`).
- Magenta,
-
- /// Color #5 (foreground code `95`, background code `105`).
- LightMagenta,
-
- /// Color #6 (foreground code `36`, background code `46`).
- Cyan,
-
- /// Color #6 (foreground code `96`, background code `106`).
- LightCyan,
-
- /// Color #7 (foreground code `37`, background code `47`).
- ///
- /// As above, this is not necessarily the foreground color, and may be
- /// hard to read on terminals with light backgrounds.
- White,
-
- /// Color #7 (foreground code `97`, background code `107`).
- LightGray,
-
- /// A color number from 0 to 255, for use in 256-color terminal
- /// environments.
- ///
- /// - colors 0 to 7 are the `Black` to `White` variants respectively.
- /// These colors can usually be changed in the terminal emulator.
- /// - colors 8 to 15 are brighter versions of the eight colors above.
- /// These can also usually be changed in the terminal emulator, or it
- /// could be configured to use the original colors and show the text in
- /// bold instead. It varies depending on the program.
- /// - colors 16 to 231 contain several palettes of bright colors,
- /// arranged in six squares measuring six by six each.
- /// - colors 232 to 255 are shades of grey from black to white.
- ///
- /// It might make more sense to look at a [color chart][cc].
- ///
- /// [cc]: https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg
- Fixed(u8),
-
- /// A 24-bit Rgb color, as specified by ISO-8613-3.
- Rgb(u8, u8, u8),
-}
-
-impl Default for Color {
- fn default() -> Self {
- Color::White
- }
-}
-
-impl Color {
- /// Returns a `Style` with the foreground color set to this color.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Color;
- ///
- /// let style = Color::Red.normal();
- /// println!("{}", style.paint("hi"));
- /// ```
- pub fn normal(self) -> Style {
- Style {
- foreground: Some(self),
- ..Style::default()
- }
- }
-
- /// Returns a `Style` with the foreground color set to this color and the
- /// bold property set.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Color;
- ///
- /// let style = Color::Green.bold();
- /// println!("{}", style.paint("hey"));
- /// ```
- pub fn bold(self) -> Style {
- Style {
- foreground: Some(self),
- is_bold: true,
- ..Style::default()
- }
- }
-
- /// Returns a `Style` with the foreground color set to this color and the
- /// dimmed property set.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Color;
- ///
- /// let style = Color::Yellow.dimmed();
- /// println!("{}", style.paint("sup"));
- /// ```
- pub fn dimmed(self) -> Style {
- Style {
- foreground: Some(self),
- is_dimmed: true,
- ..Style::default()
- }
- }
-
- /// Returns a `Style` with the foreground color set to this color and the
- /// italic property set.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Color;
- ///
- /// let style = Color::Blue.italic();
- /// println!("{}", style.paint("greetings"));
- /// ```
- pub fn italic(self) -> Style {
- Style {
- foreground: Some(self),
- is_italic: true,
- ..Style::default()
- }
- }
-
- /// Returns a `Style` with the foreground color set to this color and the
- /// underline property set.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Color;
- ///
- /// let style = Color::Purple.underline();
- /// println!("{}", style.paint("salutations"));
- /// ```
- pub fn underline(self) -> Style {
- Style {
- foreground: Some(self),
- is_underline: true,
- ..Style::default()
- }
- }
-
- /// Returns a `Style` with the foreground color set to this color and the
- /// blink property set.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Color;
- ///
- /// let style = Color::Cyan.blink();
- /// println!("{}", style.paint("wazzup"));
- /// ```
- pub fn blink(self) -> Style {
- Style {
- foreground: Some(self),
- is_blink: true,
- ..Style::default()
- }
- }
-
- /// Returns a `Style` with the foreground color set to this color and the
- /// reverse property set.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Color;
- ///
- /// let style = Color::Black.reverse();
- /// println!("{}", style.paint("aloha"));
- /// ```
- pub fn reverse(self) -> Style {
- Style {
- foreground: Some(self),
- is_reverse: true,
- ..Style::default()
- }
- }
-
- /// Returns a `Style` with the foreground color set to this color and the
- /// hidden property set.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Color;
- ///
- /// let style = Color::White.hidden();
- /// println!("{}", style.paint("ahoy"));
- /// ```
- pub fn hidden(self) -> Style {
- Style {
- foreground: Some(self),
- is_hidden: true,
- ..Style::default()
- }
- }
-
- /// Returns a `Style` with the foreground color set to this color and the
- /// strikethrough property set.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Color;
- ///
- /// let style = Color::Fixed(244).strikethrough();
- /// println!("{}", style.paint("yo"));
- /// ```
- pub fn strikethrough(self) -> Style {
- Style {
- foreground: Some(self),
- is_strikethrough: true,
- ..Style::default()
- }
- }
-
- /// Returns a `Style` with the foreground color set to this color and the
- /// background color property set to the given color.
- ///
- /// # Examples
- ///
- /// ```
- /// use nu_ansi_term::Color;
- ///
- /// let style = Color::Rgb(31, 31, 31).on(Color::White);
- /// println!("{}", style.paint("eyyyy"));
- /// ```
- pub fn on(self, background: Color) -> Style {
- Style {
- foreground: Some(self),
- background: Some(background),
- ..Style::default()
- }
- }
-}
-
-impl From for Style {
- /// You can turn a `Color` into a `Style` with the foreground color set
- /// with the `From` trait.
- ///
- /// ```
- /// use nu_ansi_term::{Style, Color};
- /// let green_foreground = Style::default().fg(Color::Green);
- /// assert_eq!(green_foreground, Color::Green.normal());
- /// assert_eq!(green_foreground, Color::Green.into());
- /// assert_eq!(green_foreground, Style::from(Color::Green));
- /// ```
- fn from(color: Color) -> Style {
- color.normal()
- }
-}
-
-#[cfg(test)]
-#[cfg(feature = "derive_serde_style")]
-mod serde_json_tests {
- use super::{Color, Style};
-
- #[test]
- fn color_serialization() {
- let colors = &[
- Color::Red,
- Color::Blue,
- Color::Rgb(123, 123, 123),
- Color::Fixed(255),
- ];
-
- assert_eq!(
- serde_json::to_string(&colors).unwrap(),
- String::from("[\"Red\",\"Blue\",{\"Rgb\":[123,123,123]},{\"Fixed\":255}]")
- );
- }
-
- #[test]
- fn color_deserialization() {
- let colors = [
- Color::Red,
- Color::Blue,
- Color::Rgb(123, 123, 123),
- Color::Fixed(255),
- ];
-
- for color in colors {
- let serialized = serde_json::to_string(&color).unwrap();
- let deserialized: Color = serde_json::from_str(&serialized).unwrap();
-
- assert_eq!(color, deserialized);
- }
- }
-
- #[test]
- fn style_serialization() {
- let style = Style::default();
-
- assert_eq!(serde_json::to_string(&style).unwrap(), "{\"foreground\":null,\"background\":null,\"is_bold\":false,\"is_dimmed\":false,\"is_italic\":false,\"is_underline\":false,\"is_blink\":false,\"is_reverse\":false,\"is_hidden\":false,\"is_strikethrough\":false}".to_string());
- }
-}
diff --git a/old_nushell/crates/nu-ansi-term/src/util.rs b/old_nushell/crates/nu-ansi-term/src/util.rs
deleted file mode 100644
index d66645958..000000000
--- a/old_nushell/crates/nu-ansi-term/src/util.rs
+++ /dev/null
@@ -1,80 +0,0 @@
-use crate::display::{AnsiString, AnsiStrings};
-use std::ops::Deref;
-
-/// Return a substring of the given ANSIStrings sequence, while keeping the formatting.
-pub fn sub_string<'a>(
- start: usize,
- len: usize,
- strs: &AnsiStrings<'a>,
-) -> Vec> {
- let mut vec = Vec::new();
- let mut pos = start;
- let mut len_rem = len;
-
- for i in strs.0.iter() {
- let fragment = i.deref();
- let frag_len = fragment.len();
- if pos >= frag_len {
- pos -= frag_len;
- continue;
- }
- if len_rem == 0 {
- break;
- }
-
- let end = pos + len_rem;
- let pos_end = if end >= frag_len { frag_len } else { end };
-
- vec.push(i.style_ref().paint(String::from(&fragment[pos..pos_end])));
-
- if end <= frag_len {
- break;
- }
-
- len_rem -= pos_end - pos;
- pos = 0;
- }
-
- vec
-}
-
-/// Return a concatenated copy of `strs` without the formatting, as an allocated `String`.
-pub fn unstyle(strs: &AnsiStrings) -> String {
- let mut s = String::new();
-
- for i in strs.0.iter() {
- s += i.deref();
- }
-
- s
-}
-
-/// Return the unstyled length of ANSIStrings. This is equaivalent to `unstyle(strs).len()`.
-pub fn unstyled_len(strs: &AnsiStrings) -> usize {
- let mut l = 0;
- for i in strs.0.iter() {
- l += i.deref().len();
- }
- l
-}
-
-#[cfg(test)]
-mod test {
- use super::*;
- use crate::Color::*;
-
- #[test]
- fn test() {
- let l = [
- Black.paint("first"),
- Red.paint("-second"),
- White.paint("-third"),
- ];
- let a = AnsiStrings(&l);
- assert_eq!(unstyle(&a), "first-second-third");
- assert_eq!(unstyled_len(&a), 18);
-
- let l2 = [Black.paint("st"), Red.paint("-second"), White.paint("-t")];
- assert_eq!(sub_string(3, 11, &a), l2);
- }
-}
diff --git a/old_nushell/crates/nu-ansi-term/src/windows.rs b/old_nushell/crates/nu-ansi-term/src/windows.rs
deleted file mode 100644
index 828e35573..000000000
--- a/old_nushell/crates/nu-ansi-term/src/windows.rs
+++ /dev/null
@@ -1,62 +0,0 @@
-/// Enables ANSI code support on Windows 10.
-///
-/// This uses Windows API calls to alter the properties of the console that
-/// the program is running in.
-///
-/// https://msdn.microsoft.com/en-us/library/windows/desktop/mt638032(v=vs.85).aspx
-///
-/// Returns a `Result` with the Windows error code if unsuccessful.
-#[cfg(windows)]
-pub fn enable_ansi_support() -> Result<(), u32> {
- // ref: https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#EXAMPLE_OF_ENABLING_VIRTUAL_TERMINAL_PROCESSING @@ https://archive.is/L7wRJ#76%
-
- use std::ffi::OsStr;
- use std::iter::once;
- use std::os::windows::ffi::OsStrExt;
- use std::ptr::null_mut;
- use winapi::um::consoleapi::{GetConsoleMode, SetConsoleMode};
- use winapi::um::errhandlingapi::GetLastError;
- use winapi::um::fileapi::{CreateFileW, OPEN_EXISTING};
- use winapi::um::handleapi::INVALID_HANDLE_VALUE;
- use winapi::um::winnt::{FILE_SHARE_WRITE, GENERIC_READ, GENERIC_WRITE};
-
- const ENABLE_VIRTUAL_TERMINAL_PROCESSING: u32 = 0x0004;
-
- unsafe {
- // ref: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew
- // Using `CreateFileW("CONOUT$", ...)` to retrieve the console handle works correctly even if STDOUT and/or STDERR are redirected
- let console_out_name: Vec =
- OsStr::new("CONOUT$").encode_wide().chain(once(0)).collect();
- let console_handle = CreateFileW(
- console_out_name.as_ptr(),
- GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_WRITE,
- null_mut(),
- OPEN_EXISTING,
- 0,
- null_mut(),
- );
- if console_handle == INVALID_HANDLE_VALUE {
- return Err(GetLastError());
- }
-
- // ref: https://docs.microsoft.com/en-us/windows/console/getconsolemode
- let mut console_mode: u32 = 0;
- if 0 == GetConsoleMode(console_handle, &mut console_mode) {
- return Err(GetLastError());
- }
-
- // VT processing not already enabled?
- if console_mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING == 0 {
- // https://docs.microsoft.com/en-us/windows/console/setconsolemode
- if 0 == SetConsoleMode(
- console_handle,
- console_mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING,
- ) {
- return Err(GetLastError());
- }
- }
- }
-
- Ok(())
-}
diff --git a/old_nushell/crates/nu-ansi-term/src/write.rs b/old_nushell/crates/nu-ansi-term/src/write.rs
deleted file mode 100644
index 552771918..000000000
--- a/old_nushell/crates/nu-ansi-term/src/write.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-use std::fmt;
-use std::io;
-
-pub trait AnyWrite {
- type Wstr: ?Sized;
- type Error;
-
- fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<(), Self::Error>;
-
- fn write_str(&mut self, s: &Self::Wstr) -> Result<(), Self::Error>;
-}
-
-impl<'a> AnyWrite for dyn fmt::Write + 'a {
- type Wstr = str;
- type Error = fmt::Error;
-
- fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<(), Self::Error> {
- fmt::Write::write_fmt(self, fmt)
- }
-
- fn write_str(&mut self, s: &Self::Wstr) -> Result<(), Self::Error> {
- fmt::Write::write_str(self, s)
- }
-}
-
-impl<'a> AnyWrite for dyn io::Write + 'a {
- type Wstr = [u8];
- type Error = io::Error;
-
- fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<(), Self::Error> {
- io::Write::write_fmt(self, fmt)
- }
-
- fn write_str(&mut self, s: &Self::Wstr) -> Result<(), Self::Error> {
- io::Write::write_all(self, s)
- }
-}
diff --git a/old_nushell/crates/nu-cli/Cargo.toml b/old_nushell/crates/nu-cli/Cargo.toml
deleted file mode 100644
index 305edeb45..000000000
--- a/old_nushell/crates/nu-cli/Cargo.toml
+++ /dev/null
@@ -1,43 +0,0 @@
-[package]
-authors = ["The Nu Project Contributors"]
-description = "CLI for nushell"
-edition = "2018"
-license = "MIT"
-name = "nu-cli"
-version = "0.43.0"
-build = "build.rs"
-
-[lib]
-doctest = false
-
-[dependencies]
-nu-completion = { version = "0.43.0", path="../nu-completion" }
-nu-command = { version = "0.43.0", path="../nu-command" }
-nu-data = { version = "0.43.0", path="../nu-data" }
-nu-engine = { version = "0.43.0", path="../nu-engine" }
-nu-errors = { version = "0.43.0", path="../nu-errors" }
-nu-parser = { version = "0.43.0", path="../nu-parser" }
-nu-protocol = { version = "0.43.0", path="../nu-protocol" }
-nu-source = { version = "0.43.0", path="../nu-source" }
-nu-stream = { version = "0.43.0", path="../nu-stream" }
-nu-ansi-term = { version = "0.43.0", path="../nu-ansi-term" }
-nu-path = { version = "0.43.0", path="../nu-path" }
-
-indexmap ="1.6.1"
-log = "0.4.14"
-pretty_env_logger = "0.4.0"
-strip-ansi-escapes = "0.1.0"
-rustyline = { version="9.0.0", optional=true }
-ctrlc = { version="3.1.7", optional=true }
-shadow-rs = { version = "0.8.1", default-features = false, optional = true }
-serde = { version="1.0.123", features=["derive"] }
-serde_yaml = "0.8.16"
-lazy_static = "1.4.0"
-
-[build-dependencies]
-shadow-rs = "0.8.1"
-
-[features]
-default = ["shadow-rs"]
-rustyline-support = ["rustyline", "nu-engine/rustyline-support"]
-stable = []
diff --git a/old_nushell/crates/nu-cli/README.md b/old_nushell/crates/nu-cli/README.md
deleted file mode 100644
index ae7eeaed7..000000000
--- a/old_nushell/crates/nu-cli/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# nu-cli
-
-This crate provides the fundamental needs when creating the Nushell interactive REPL. In it, you'll find features for interacting with the line editor (the piece which writes the prompt and takes input from the user), keybindings, handlers for the commandline arguments passed to the REPL as it starts up, and more.
-
diff --git a/old_nushell/crates/nu-cli/build.rs b/old_nushell/crates/nu-cli/build.rs
deleted file mode 100644
index 4a0dfc459..000000000
--- a/old_nushell/crates/nu-cli/build.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-fn main() -> shadow_rs::SdResult<()> {
- shadow_rs::new()
-}
diff --git a/old_nushell/crates/nu-cli/src/app.rs b/old_nushell/crates/nu-cli/src/app.rs
deleted file mode 100644
index 51cd6be0f..000000000
--- a/old_nushell/crates/nu-cli/src/app.rs
+++ /dev/null
@@ -1,638 +0,0 @@
-mod logger;
-mod options;
-mod options_parser;
-pub mod stopwatch;
-
-use self::stopwatch::Stopwatch;
-use lazy_static::lazy_static;
-use nu_command::{commands::NuSignature as Nu, utils::test_bins as binaries};
-use nu_engine::{get_full_help, EvaluationContext};
-use nu_errors::ShellError;
-use nu_protocol::hir::{Call, Expression, SpannedExpression, Synthetic};
-use nu_protocol::{Primitive, UntaggedValue};
-use nu_source::{Span, Tag};
-use nu_stream::InputStream;
-pub use options::{CliOptions, NuScript, Options};
-use options_parser::{NuParser, OptionsParser};
-use std::sync::Mutex;
-
-lazy_static! {
- pub static ref STOPWATCH: Mutex = {
- let mut sw = Stopwatch::default();
- sw.start();
- sw.stop();
- Mutex::new(sw)
- };
-}
-
-pub struct App {
- parser: Box,
- pub options: Options,
-}
-
-impl App {
- pub fn new(parser: Box, options: Options) -> Self {
- Self { parser, options }
- }
-
- pub fn run(args: &[String]) -> Result<(), ShellError> {
- let nu = Box::new(NuParser::new());
- let options = Options::default();
- let ui = App::new(nu, options);
-
- ui.main(args)
- }
-
- pub fn main(&self, argv: &[String]) -> Result<(), ShellError> {
- if self.perf() {
- // start the stopwatch running
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .start();
- }
-
- let argv = quote_positionals(argv).join(" ");
-
- if let Err(cause) = self.parse(&argv) {
- self.parser
- .context()
- .host()
- .lock()
- .print_err(cause, &nu_source::Text::from(argv));
- std::process::exit(1);
- }
-
- if self.help() {
- let context = self.parser.context();
- let stream = nu_stream::OutputStream::one(
- UntaggedValue::string(get_full_help(&Nu, &context.scope))
- .into_value(nu_source::Tag::unknown()),
- );
-
- consume(context, stream)?;
-
- if self.perf() {
- // stop the stopwatch since we're exiting
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .stop();
- eprintln!(
- "help {:?}",
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .elapsed()
- );
- }
-
- std::process::exit(0);
- }
-
- if self.version() {
- let context = self.parser.context();
-
- let stream = nu_command::commands::version(nu_engine::CommandArgs {
- context: context.clone(),
- call_info: nu_engine::UnevaluatedCallInfo {
- args: Call::new(
- Box::new(SpannedExpression::new(
- Expression::Synthetic(Synthetic::String("version".to_string())),
- Span::unknown(),
- )),
- Span::unknown(),
- ),
- name_tag: Tag::unknown(),
- },
- input: InputStream::empty(),
- })?;
-
- let stream = {
- let command = context
- .get_command("pivot")
- .expect("could not find version command");
-
- context.run_command(
- command,
- Tag::unknown(),
- Call::new(
- Box::new(SpannedExpression::new(
- Expression::Synthetic(Synthetic::String("pivot".to_string())),
- Span::unknown(),
- )),
- Span::unknown(),
- ),
- stream,
- )?
- };
-
- consume(context, stream)?;
-
- if self.perf() {
- // stop the stopwatch since we're exiting
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .stop();
- eprintln!(
- "version {:?}",
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .elapsed()
- );
- }
-
- std::process::exit(0);
- }
-
- if let Some(bin) = self.testbin() {
- match bin.as_deref() {
- Ok("echo_env") => binaries::echo_env(),
- Ok("cococo") => binaries::cococo(),
- Ok("meow") => binaries::meow(),
- Ok("iecho") => binaries::iecho(),
- Ok("fail") => binaries::fail(),
- Ok("nonu") => binaries::nonu(),
- Ok("chop") => binaries::chop(),
- Ok("repeater") => binaries::repeater(),
- _ => unreachable!(),
- }
-
- return Ok(());
- }
-
- let mut opts = CliOptions::new();
- opts.config = self.config().map(std::ffi::OsString::from);
- opts.stdin = self.takes_stdin();
- opts.save_history = self.save_history();
- opts.perf = self.perf();
-
- use logger::{configure, debug_filters, logger, trace_filters};
-
- logger(|builder| {
- configure(self, builder)?;
- trace_filters(self, builder)?;
- debug_filters(self, builder)?;
-
- Ok(())
- })?;
-
- if self.perf() {
- // start a new split
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .start()
- }
-
- if let Some(commands) = self.commands() {
- let commands = commands?;
- let script = NuScript::code(&commands)?;
- opts.scripts = vec![script];
- let context = crate::create_default_context(false)?;
- return crate::run_script_file(context, opts);
- }
-
- if self.perf() {
- // start a new spit
- eprintln!(
- "commands using -c at launch: {:?}",
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .elapsed_split()
- );
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .start();
- }
-
- if let Some(scripts) = self.scripts() {
- let mut source_files = vec![];
- for script in scripts {
- let script_name = script?;
- let path = std::ffi::OsString::from(&script_name);
-
- match NuScript::source_file(path.as_os_str()) {
- Ok(file) => source_files.push(file),
- Err(_) => {
- eprintln!("File not found: {}", script_name);
- return Ok(());
- }
- }
- }
-
- for file in source_files {
- let mut opts = opts.clone();
- opts.scripts = vec![file];
-
- let context = crate::create_default_context(false)?;
- crate::run_script_file(context, opts)?;
- }
-
- return Ok(());
- }
-
- if self.perf() {
- // start a new split
- eprintln!(
- "script file(s) passed in: {:?}",
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .elapsed_split()
- );
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .start();
- }
-
- let context = crate::create_default_context(true)?;
-
- if !self.skip_plugins() {
- let _ = crate::register_plugins(&context);
- }
-
- if self.perf() {
- // start a new split
- eprintln!(
- "plugins registered: {:?}",
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .elapsed_split()
- );
- }
-
- #[cfg(feature = "rustyline-support")]
- {
- crate::cli(context, opts)?;
- }
-
- #[cfg(not(feature = "rustyline-support"))]
- {
- println!("Nushell needs the 'rustyline-support' feature for CLI support");
- }
-
- Ok(())
- }
-
- pub fn commands(&self) -> Option> {
- self.options.get("commands").map(|v| match v.value {
- UntaggedValue::Error(err) => Err(err),
- UntaggedValue::Primitive(Primitive::String(name)) => Ok(name),
- _ => Err(ShellError::untagged_runtime_error("Unsupported option")),
- })
- }
-
- pub fn perf(&self) -> bool {
- self.options
- .get("perf")
- .map(|v| matches!(v.as_bool(), Ok(true)))
- .unwrap_or(false)
- }
-
- pub fn help(&self) -> bool {
- self.options
- .get("help")
- .map(|v| matches!(v.as_bool(), Ok(true)))
- .unwrap_or(false)
- }
-
- pub fn version(&self) -> bool {
- self.options
- .get("version")
- .map(|v| matches!(v.as_bool(), Ok(true)))
- .unwrap_or(false)
- }
-
- pub fn scripts(&self) -> Option>> {
- self.options.get("args").map(|v| {
- v.table_entries()
- .map(|v| match &v.value {
- UntaggedValue::Error(err) => Err(err.clone()),
- UntaggedValue::Primitive(Primitive::FilePath(path)) => {
- Ok(path.display().to_string())
- }
- UntaggedValue::Primitive(Primitive::String(name)) => Ok(name.clone()),
- _ => Err(ShellError::untagged_runtime_error("Unsupported option")),
- })
- .collect()
- })
- }
-
- pub fn takes_stdin(&self) -> bool {
- self.options
- .get("stdin")
- .map(|v| matches!(v.as_bool(), Ok(true)))
- .unwrap_or(false)
- }
-
- pub fn config(&self) -> Option {
- self.options
- .get("config-file")
- .map(|v| v.as_string().expect("not a string"))
- }
-
- pub fn develop(&self) -> Option>> {
- self.options.get("develop").map(|v| {
- let mut values = vec![];
-
- match v.value {
- UntaggedValue::Error(err) => values.push(Err(err)),
- UntaggedValue::Primitive(Primitive::String(filters)) => {
- values.extend(filters.split(',').map(|filter| Ok(filter.to_string())));
- }
- _ => values.push(Err(ShellError::untagged_runtime_error(
- "Unsupported option",
- ))),
- };
-
- values
- })
- }
-
- pub fn debug(&self) -> Option>> {
- self.options.get("debug").map(|v| {
- let mut values = vec![];
-
- match v.value {
- UntaggedValue::Error(err) => values.push(Err(err)),
- UntaggedValue::Primitive(Primitive::String(filters)) => {
- values.extend(filters.split(',').map(|filter| Ok(filter.to_string())));
- }
- _ => values.push(Err(ShellError::untagged_runtime_error(
- "Unsupported option",
- ))),
- };
-
- values
- })
- }
-
- pub fn loglevel(&self) -> Option> {
- self.options.get("loglevel").map(|v| match v.value {
- UntaggedValue::Error(err) => Err(err),
- UntaggedValue::Primitive(Primitive::String(name)) => Ok(name),
- _ => Err(ShellError::untagged_runtime_error("Unsupported option")),
- })
- }
-
- pub fn testbin(&self) -> Option> {
- self.options.get("testbin").map(|v| match v.value {
- UntaggedValue::Error(err) => Err(err),
- UntaggedValue::Primitive(Primitive::String(name)) => Ok(name),
- _ => Err(ShellError::untagged_runtime_error("Unsupported option")),
- })
- }
-
- pub fn skip_plugins(&self) -> bool {
- self.options
- .get("skip-plugins")
- .map(|v| matches!(v.as_bool(), Ok(true)))
- .unwrap_or(false)
- }
-
- pub fn save_history(&self) -> bool {
- self.options
- .get("no-history")
- .map(|v| !matches!(v.as_bool(), Ok(true)))
- .unwrap_or(true)
- }
-
- pub fn parse(&self, args: &str) -> Result<(), ShellError> {
- self.parser.parse(args).map(|options| {
- self.options.swap(&options);
- })
- }
-}
-
-fn quote_positionals(parameters: &[String]) -> Vec {
- parameters
- .iter()
- .cloned()
- .map(|arg| {
- if arg.contains(' ') {
- format!("\"{}\"", arg)
- } else {
- arg
- }
- })
- .collect::>()
-}
-
-fn consume(context: &EvaluationContext, stream: InputStream) -> Result<(), ShellError> {
- let autoview_cmd = context
- .get_command("autoview")
- .expect("could not find autoview command");
-
- let stream = context.run_command(
- autoview_cmd,
- Tag::unknown(),
- Call::new(
- Box::new(SpannedExpression::new(
- Expression::Synthetic(Synthetic::String("autoview".to_string())),
- Span::unknown(),
- )),
- Span::unknown(),
- ),
- stream,
- )?;
-
- for _ in stream {}
-
- Ok(())
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
-
- fn cli_app() -> App {
- let parser = Box::new(NuParser::new());
- let options = Options::default();
-
- App::new(parser, options)
- }
-
- #[test]
- fn default_options() -> Result<(), ShellError> {
- let ui = cli_app();
-
- ui.parse("nu")?;
- assert!(!ui.version());
- assert!(!ui.help());
- assert!(!ui.takes_stdin());
- assert!(ui.save_history());
- assert!(!ui.skip_plugins());
- assert_eq!(ui.config(), None);
- assert_eq!(ui.loglevel(), None);
- assert_eq!(ui.debug(), None);
- assert_eq!(ui.develop(), None);
- assert_eq!(ui.testbin(), None);
- assert_eq!(ui.commands(), None);
- assert_eq!(ui.scripts(), None);
- Ok(())
- }
-
- #[test]
- fn reports_errors_on_unsupported_flags() -> Result<(), ShellError> {
- let ui = cli_app();
-
- assert!(ui.parse("nu --coonfig-file /path/to/config.toml").is_err());
- assert!(ui.config().is_none());
- Ok(())
- }
-
- #[test]
- fn configures_debug_trace_level_with_filters() -> Result<(), ShellError> {
- let ui = cli_app();
- ui.parse("nu --develop=cli,parser")?;
- assert_eq!(ui.develop().unwrap()[0], Ok("cli".to_string()));
- assert_eq!(ui.develop().unwrap()[1], Ok("parser".to_string()));
- Ok(())
- }
-
- #[test]
- fn configures_debug_level_with_filters() -> Result<(), ShellError> {
- let ui = cli_app();
- ui.parse("nu --debug=cli,run")?;
- assert_eq!(ui.debug().unwrap()[0], Ok("cli".to_string()));
- assert_eq!(ui.debug().unwrap()[1], Ok("run".to_string()));
- Ok(())
- }
-
- #[test]
- fn can_use_loglevels() -> Result<(), ShellError> {
- for level in ["error", "warn", "info", "debug", "trace"] {
- let ui = cli_app();
- let args = format!("nu --loglevel={}", level);
- ui.parse(&args)?;
- assert_eq!(ui.loglevel().unwrap(), Ok(level.to_string()));
- }
-
- let ui = cli_app();
- ui.parse("nu --loglevel=nada")?;
- assert_eq!(
- ui.loglevel().unwrap(),
- Err(ShellError::untagged_runtime_error("nada is not supported."))
- );
-
- Ok(())
- }
-
- #[test]
- fn can_be_login() -> Result<(), ShellError> {
- let ui = cli_app();
- ui.parse("nu -l")?;
-
- let ui = cli_app();
- ui.parse("nu --login")?;
-
- Ok(())
- }
-
- #[test]
- fn can_be_passed_nu_scripts() -> Result<(), ShellError> {
- let ui = cli_app();
- ui.parse("nu code.nu bootstrap.nu")?;
- assert_eq!(ui.scripts().unwrap()[0], Ok("code.nu".into()));
- assert_eq!(ui.scripts().unwrap()[1], Ok("bootstrap.nu".into()));
- Ok(())
- }
-
- #[test]
- fn can_use_test_binaries() -> Result<(), ShellError> {
- for binarie_name in [
- "echo_env", "cococo", "iecho", "fail", "nonu", "chop", "repeater", "meow",
- ] {
- let ui = cli_app();
- let args = format!("nu --testbin={}", binarie_name);
- ui.parse(&args)?;
- assert_eq!(ui.testbin().unwrap(), Ok(binarie_name.to_string()));
- }
-
- let ui = cli_app();
- ui.parse("nu --testbin=andres")?;
- assert_eq!(
- ui.testbin().unwrap(),
- Err(ShellError::untagged_runtime_error(
- "andres is not supported."
- ))
- );
-
- Ok(())
- }
-
- #[test]
- fn has_version() -> Result<(), ShellError> {
- let ui = cli_app();
-
- ui.parse("nu --version")?;
- assert!(ui.version());
- Ok(())
- }
-
- #[test]
- fn has_help() -> Result<(), ShellError> {
- let ui = cli_app();
-
- ui.parse("nu --help")?;
- assert!(ui.help());
- Ok(())
- }
-
- #[test]
- fn can_take_stdin() -> Result<(), ShellError> {
- let ui = cli_app();
-
- ui.parse("nu --stdin")?;
- assert!(ui.takes_stdin());
- Ok(())
- }
-
- #[test]
- fn can_opt_to_avoid_saving_history() -> Result<(), ShellError> {
- let ui = cli_app();
-
- ui.parse("nu --no-history")?;
- assert!(!ui.save_history());
- Ok(())
- }
-
- #[test]
- fn can_opt_to_skip_plugins() -> Result<(), ShellError> {
- let ui = cli_app();
-
- ui.parse("nu --skip-plugins")?;
- assert!(ui.skip_plugins());
- Ok(())
- }
-
- #[test]
- fn understands_commands_need_to_be_run() -> Result<(), ShellError> {
- let ui = cli_app();
-
- ui.parse("nu -c \"ls | get name\"")?;
- assert_eq!(ui.commands().unwrap(), Ok(String::from("ls | get name")));
-
- let ui = cli_app();
-
- ui.parse("nu -c \"echo 'hola'\"")?;
- assert_eq!(ui.commands().unwrap(), Ok(String::from("echo 'hola'")));
- Ok(())
- }
-
- #[test]
- fn knows_custom_configurations() -> Result<(), ShellError> {
- let ui = cli_app();
-
- ui.parse("nu --config-file /path/to/config.toml")?;
- assert_eq!(ui.config().unwrap(), String::from("/path/to/config.toml"));
- Ok(())
- }
-}
diff --git a/old_nushell/crates/nu-cli/src/app/logger.rs b/old_nushell/crates/nu-cli/src/app/logger.rs
deleted file mode 100644
index 02644a856..000000000
--- a/old_nushell/crates/nu-cli/src/app/logger.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-use super::App;
-use log::LevelFilter;
-use nu_errors::ShellError;
-use pretty_env_logger::env_logger::Builder;
-
-pub fn logger(f: impl FnOnce(&mut Builder) -> Result<(), ShellError>) -> Result<(), ShellError> {
- let mut builder = pretty_env_logger::formatted_builder();
- f(&mut builder)?;
- let _ = builder.try_init();
- Ok(())
-}
-
-pub fn configure(app: &App, logger: &mut Builder) -> Result<(), ShellError> {
- if let Some(level) = app.loglevel() {
- let level = match level.as_deref() {
- Ok("error") => LevelFilter::Error,
- Ok("warn") => LevelFilter::Warn,
- Ok("info") => LevelFilter::Info,
- Ok("debug") => LevelFilter::Debug,
- Ok("trace") => LevelFilter::Trace,
- Ok(_) | Err(_) => LevelFilter::Warn,
- };
-
- logger.filter_module("nu", level);
- };
-
- if let Ok(s) = std::env::var("RUST_LOG") {
- logger.parse_filters(&s);
- }
-
- Ok(())
-}
-
-pub fn trace_filters(app: &App, logger: &mut Builder) -> Result<(), ShellError> {
- if let Some(filters) = app.develop() {
- filters.into_iter().filter_map(Result::ok).for_each(|name| {
- logger.filter_module(&name, LevelFilter::Trace);
- })
- }
-
- Ok(())
-}
-
-pub fn debug_filters(app: &App, logger: &mut Builder) -> Result<(), ShellError> {
- if let Some(filters) = app.debug() {
- filters.into_iter().filter_map(Result::ok).for_each(|name| {
- logger.filter_module(&name, LevelFilter::Debug);
- })
- }
-
- Ok(())
-}
diff --git a/old_nushell/crates/nu-cli/src/app/options.rs b/old_nushell/crates/nu-cli/src/app/options.rs
deleted file mode 100644
index 025316578..000000000
--- a/old_nushell/crates/nu-cli/src/app/options.rs
+++ /dev/null
@@ -1,102 +0,0 @@
-use indexmap::IndexMap;
-use nu_errors::ShellError;
-use nu_protocol::{UntaggedValue, Value};
-use std::cell::RefCell;
-use std::ffi::{OsStr, OsString};
-
-#[derive(Debug, Clone)]
-pub struct CliOptions {
- pub config: Option,
- pub stdin: bool,
- pub scripts: Vec,
- pub save_history: bool,
- pub perf: bool,
-}
-
-impl Default for CliOptions {
- fn default() -> Self {
- Self::new()
- }
-}
-
-impl CliOptions {
- pub fn new() -> Self {
- Self {
- config: None,
- stdin: false,
- scripts: vec![],
- save_history: true,
- perf: false,
- }
- }
-}
-
-#[derive(Debug)]
-pub struct Options {
- inner: RefCell>,
-}
-
-impl Options {
- pub fn default() -> Self {
- Self {
- inner: RefCell::new(IndexMap::default()),
- }
- }
-
- pub fn get(&self, key: &str) -> Option {
- self.inner.borrow().get(key).cloned()
- }
-
- pub fn put(&self, key: &str, value: Value) {
- self.inner.borrow_mut().insert(key.into(), value);
- }
-
- pub fn shift(&self) {
- if let Some(Value {
- value: UntaggedValue::Table(ref mut args),
- ..
- }) = self.inner.borrow_mut().get_mut("args")
- {
- args.remove(0);
- }
- }
-
- pub fn swap(&self, other: &Options) {
- self.inner.swap(&other.inner);
- }
-}
-
-#[derive(Debug, Clone)]
-pub struct NuScript {
- pub filepath: Option,
- pub contents: String,
-}
-
-impl NuScript {
- pub fn code(content: &str) -> Result {
- Ok(Self {
- filepath: None,
- contents: content.to_string(),
- })
- }
-
- pub fn get_code(&self) -> &str {
- &self.contents
- }
-
- pub fn source_file(path: &OsStr) -> Result {
- use std::fs::File;
- use std::io::Read;
-
- let path = path.to_os_string();
- let mut file = File::open(&path)?;
- let mut buffer = String::new();
-
- file.read_to_string(&mut buffer)?;
-
- Ok(Self {
- filepath: Some(path),
- contents: buffer,
- })
- }
-}
diff --git a/old_nushell/crates/nu-cli/src/app/options_parser.rs b/old_nushell/crates/nu-cli/src/app/options_parser.rs
deleted file mode 100644
index d6efb6b0b..000000000
--- a/old_nushell/crates/nu-cli/src/app/options_parser.rs
+++ /dev/null
@@ -1,132 +0,0 @@
-use super::Options;
-
-use nu_command::commands::{loglevels, testbins, NuSignature as Nu};
-use nu_command::commands::{Autoview, Pivot, Table, Version as NuVersion};
-use nu_engine::{whole_stream_command, EvaluationContext};
-use nu_errors::ShellError;
-use nu_protocol::hir::{ClassifiedCommand, InternalCommand, NamedValue};
-use nu_protocol::UntaggedValue;
-use nu_source::Tag;
-
-pub struct NuParser {
- context: EvaluationContext,
-}
-
-pub trait OptionsParser {
- fn parse(&self, input: &str) -> Result;
- fn context(&self) -> &EvaluationContext;
-}
-
-impl NuParser {
- pub fn new() -> Self {
- let context = EvaluationContext::basic();
- context.add_commands(vec![
- whole_stream_command(Nu {}),
- whole_stream_command(NuVersion {}),
- whole_stream_command(Autoview {}),
- whole_stream_command(Pivot {}),
- whole_stream_command(Table {}),
- ]);
-
- Self { context }
- }
-}
-
-impl OptionsParser for NuParser {
- fn context(&self) -> &EvaluationContext {
- &self.context
- }
-
- fn parse(&self, input: &str) -> Result {
- let options = Options::default();
- let (lite_result, _err) = nu_parser::lex(input, 0, nu_parser::NewlineMode::Normal);
- let (lite_result, _err) = nu_parser::parse_block(lite_result);
-
- let (parsed, err) = nu_parser::classify_block(&lite_result, &self.context.scope);
-
- if let Some(reason) = err {
- return Err(reason.into());
- }
-
- match parsed.block[0].pipelines[0].list[0] {
- ClassifiedCommand::Internal(InternalCommand { ref args, .. }) => {
- if let Some(ref params) = args.named {
- params.iter().for_each(|(k, v)| {
- let value = match v {
- NamedValue::AbsentSwitch => {
- Some(UntaggedValue::from(false).into_untagged_value())
- }
- NamedValue::PresentSwitch(span) => {
- Some(UntaggedValue::from(true).into_value(Tag::from(span)))
- }
- NamedValue::AbsentValue => None,
- NamedValue::Value(span, exprs) => {
- let value = nu_engine::evaluate_baseline_expr(exprs, &self.context)
- .expect("value");
- Some(value.value.into_value(Tag::from(span)))
- }
- };
-
- let value = value.map(|v| match k.as_ref() {
- "testbin" => {
- if let Ok(name) = v.as_string() {
- if testbins().iter().any(|n| name == *n) {
- v
- } else {
- UntaggedValue::Error(ShellError::untagged_runtime_error(
- format!("{} is not supported.", name),
- ))
- .into_value(v.tag)
- }
- } else {
- v
- }
- }
- "loglevel" => {
- if let Ok(name) = v.as_string() {
- if loglevels().iter().any(|n| name == *n) {
- v
- } else {
- UntaggedValue::Error(ShellError::untagged_runtime_error(
- format!("{} is not supported.", name),
- ))
- .into_value(v.tag)
- }
- } else {
- v
- }
- }
- _ => v,
- });
-
- if let Some(value) = value {
- options.put(k, value);
- }
- });
- }
-
- let mut positional_args = vec![];
-
- if let Some(positional) = &args.positional {
- for pos in positional {
- let result = nu_engine::evaluate_baseline_expr(pos, &self.context)?;
- positional_args.push(result);
- }
- }
-
- if !positional_args.is_empty() {
- options.put(
- "args",
- UntaggedValue::Table(positional_args).into_untagged_value(),
- );
- }
- }
- ClassifiedCommand::Error(ref reason) => {
- return Err(reason.clone().into());
- }
- _ => return Err(ShellError::untagged_runtime_error("unrecognized command")),
- }
-
- Ok(options)
- }
-}
diff --git a/old_nushell/crates/nu-cli/src/app/stopwatch.rs b/old_nushell/crates/nu-cli/src/app/stopwatch.rs
deleted file mode 100644
index e433782af..000000000
--- a/old_nushell/crates/nu-cli/src/app/stopwatch.rs
+++ /dev/null
@@ -1,118 +0,0 @@
-#![allow(dead_code)]
-use std::default::Default;
-use std::fmt;
-use std::time::{Duration, Instant};
-
-#[derive(Clone, Copy)]
-pub struct Stopwatch {
- /// The time the stopwatch was started last, if ever.
- start_time: Option,
- /// The time the stopwatch was split last, if ever.
- split_time: Option,
- /// The time elapsed while the stopwatch was running (between start() and stop()).
- elapsed: Duration,
-}
-
-impl Default for Stopwatch {
- fn default() -> Stopwatch {
- Stopwatch {
- start_time: None,
- split_time: None,
- elapsed: Duration::from_secs(0),
- }
- }
-}
-
-impl fmt::Display for Stopwatch {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- return write!(f, "{}ms", self.elapsed_ms());
- }
-}
-
-impl Stopwatch {
- /// Returns a new stopwatch.
- pub fn new() -> Stopwatch {
- let sw: Stopwatch = Default::default();
- sw
- }
-
- /// Returns a new stopwatch which will immediately be started.
- pub fn start_new() -> Stopwatch {
- let mut sw = Stopwatch::new();
- sw.start();
- sw
- }
-
- /// Starts the stopwatch.
- pub fn start(&mut self) {
- self.start_time = Some(Instant::now());
- }
-
- /// Stops the stopwatch.
- pub fn stop(&mut self) {
- self.elapsed = self.elapsed();
- self.start_time = None;
- self.split_time = None;
- }
-
- /// Resets all counters and stops the stopwatch.
- pub fn reset(&mut self) {
- self.elapsed = Duration::from_secs(0);
- self.start_time = None;
- self.split_time = None;
- }
-
- /// Resets and starts the stopwatch again.
- pub fn restart(&mut self) {
- self.reset();
- self.start();
- }
-
- /// Returns whether the stopwatch is running.
- pub fn is_running(&self) -> bool {
- self.start_time.is_some()
- }
-
- /// Returns the elapsed time since the start of the stopwatch.
- pub fn elapsed(&self) -> Duration {
- match self.start_time {
- // stopwatch is running
- Some(t1) => t1.elapsed() + self.elapsed,
- // stopwatch is not running
- None => self.elapsed,
- }
- }
-
- /// Returns the elapsed time since the start of the stopwatch in milliseconds.
- pub fn elapsed_ms(&self) -> i64 {
- let dur = self.elapsed();
- (dur.as_secs() * 1000 + dur.subsec_millis() as u64) as i64
- }
-
- /// Returns the elapsed time since last split or start/restart.
- ///
- /// If the stopwatch is in stopped state this will always return a zero Duration.
- pub fn elapsed_split(&mut self) -> Duration {
- match self.start_time {
- // stopwatch is running
- Some(start) => {
- let res = match self.split_time {
- Some(split) => split.elapsed(),
- None => start.elapsed(),
- };
- self.split_time = Some(Instant::now());
- res
- }
- // stopwatch is not running
- None => Duration::from_secs(0),
- }
- }
-
- /// Returns the elapsed time since last split or start/restart in milliseconds.
- ///
- /// If the stopwatch is in stopped state this will always return zero.
- pub fn elapsed_split_ms(&mut self) -> i64 {
- let dur = self.elapsed_split();
- (dur.as_secs() * 1000 + dur.subsec_millis() as u64) as i64
- }
-}
diff --git a/old_nushell/crates/nu-cli/src/cli.rs b/old_nushell/crates/nu-cli/src/cli.rs
deleted file mode 100644
index 72f2f4c97..000000000
--- a/old_nushell/crates/nu-cli/src/cli.rs
+++ /dev/null
@@ -1,538 +0,0 @@
-use crate::app::STOPWATCH;
-use crate::line_editor::configure_ctrl_c;
-use nu_ansi_term::Color;
-use nu_engine::{maybe_print_errors, run_block, script::run_script_standalone, EvaluationContext};
-
-#[allow(unused_imports)]
-pub(crate) use nu_engine::script::{process_script, LineResult};
-
-#[cfg(feature = "rustyline-support")]
-use crate::line_editor::{
- configure_rustyline_editor, convert_rustyline_result_to_string,
- default_rustyline_editor_configuration, nu_line_editor_helper,
-};
-
-#[allow(unused_imports)]
-use nu_data::config;
-use nu_source::{Tag, Text};
-use nu_stream::InputStream;
-#[allow(unused_imports)]
-use std::sync::atomic::Ordering;
-
-#[cfg(feature = "rustyline-support")]
-use rustyline::{self, error::ReadlineError};
-
-use nu_errors::ShellError;
-use nu_parser::ParserScope;
-use nu_path::expand_tilde;
-use nu_protocol::{hir::ExternalRedirection, ConfigPath, UntaggedValue, Value};
-
-use log::trace;
-use std::error::Error;
-use std::iter::Iterator;
-use std::path::PathBuf;
-
-// Name of environment variable where the prompt could be stored
-#[cfg(feature = "rustyline-support")]
-const PROMPT_COMMAND: &str = "PROMPT_COMMAND";
-
-pub fn search_paths() -> Vec {
- use std::env;
- let mut search_paths = Vec::new();
-
- // Automatically add path `nu` is in as a search path
- if let Ok(exe_path) = env::current_exe() {
- if let Some(exe_dir) = exe_path.parent() {
- search_paths.push(exe_dir.to_path_buf());
- }
- }
-
- if let Ok(config) = nu_data::config::config(Tag::unknown()) {
- if let Some(Value {
- value: UntaggedValue::Table(pipelines),
- ..
- }) = config.get("plugin_dirs")
- {
- for pipeline in pipelines {
- if let Ok(plugin_dir) = pipeline.as_string() {
- search_paths.push(expand_tilde(plugin_dir));
- }
- }
- }
- }
-
- search_paths
-}
-
-pub fn run_script_file(
- context: EvaluationContext,
- options: super::app::CliOptions,
-) -> Result<(), ShellError> {
- if let Some(cfg) = options.config {
- load_cfg_as_global_cfg(&context, PathBuf::from(cfg));
- } else {
- load_global_cfg(&context);
- }
-
- let _ = register_plugins(&context);
- let _ = configure_ctrl_c(&context);
-
- let script = options
- .scripts
- .get(0)
- .ok_or_else(|| ShellError::unexpected("Nu source code not available"))?;
-
- run_script_standalone(script.get_code().to_string(), options.stdin, &context, true)?;
-
- Ok(())
-}
-
-#[cfg(feature = "rustyline-support")]
-fn default_prompt_string(cwd: &str) -> String {
- format!(
- "{}{}{}{}{}{}> ",
- Color::Green.bold().prefix(),
- cwd,
- nu_ansi_term::ansi::RESET,
- Color::Cyan.bold().prefix(),
- current_branch(),
- nu_ansi_term::ansi::RESET
- )
-}
-
-#[cfg(feature = "rustyline-support")]
-fn evaluate_prompt_string(prompt_line: &str, context: &EvaluationContext, cwd: &str) -> String {
- context.scope.enter_scope();
- let (prompt_block, err) = nu_parser::parse(prompt_line, 0, &context.scope);
-
- if err.is_some() {
- context.scope.exit_scope();
- default_prompt_string(cwd)
- } else {
- let run_result = run_block(
- &prompt_block,
- context,
- InputStream::empty(),
- ExternalRedirection::Stdout,
- );
- context.scope.exit_scope();
-
- match run_result {
- Ok(result) => match result.collect_string(Tag::unknown()) {
- Ok(string_result) => {
- let errors = context.get_errors();
- maybe_print_errors(context, Text::from(prompt_line));
- context.clear_errors();
-
- if !errors.is_empty() {
- "> ".into()
- } else {
- string_result.item
- }
- }
- Err(e) => {
- context.host().lock().print_err(e, &Text::from(prompt_line));
- context.clear_errors();
-
- "> ".into()
- }
- },
- Err(e) => {
- context.host().lock().print_err(e, &Text::from(prompt_line));
- context.clear_errors();
-
- "> ".into()
- }
- }
- }
-}
-
-#[cfg(feature = "rustyline-support")]
-pub fn cli(
- context: EvaluationContext,
- options: super::app::CliOptions,
-) -> Result<(), Box> {
- let _ = configure_ctrl_c(&context);
-
- // start time for running startup scripts (this metric includes loading of the cfg, but w/e)
- let startup_commands_start_time = std::time::Instant::now();
-
- if let Some(cfg) = options.config {
- load_cfg_as_global_cfg(&context, PathBuf::from(cfg));
- } else {
- load_global_cfg(&context);
- }
-
- // Store cmd duration in an env var
- context.scope.add_env_var(
- "CMD_DURATION_MS",
- startup_commands_start_time
- .elapsed()
- .as_millis()
- .to_string(),
- );
-
- if options.perf {
- eprintln!(
- "config loaded: {:?}",
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .elapsed_split()
- );
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .start();
- }
-
- //Configure rustyline
- let mut rl = default_rustyline_editor_configuration();
- let history_path = if let Some(cfg) = &context.configs().lock().global_config {
- let _ = configure_rustyline_editor(&mut rl, cfg);
- let helper = Some(nu_line_editor_helper(&context, cfg));
- rl.set_helper(helper);
- nu_data::config::path::history_path_or_default(cfg)
- } else {
- nu_data::config::path::default_history_path()
- };
-
- if options.perf {
- eprintln!(
- "rustyline configuration: {:?}",
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .elapsed_split()
- );
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .start();
- }
-
- // Don't load history if it's not necessary
- if options.save_history {
- let _ = rl.load_history(&history_path);
- }
-
- if options.perf {
- eprintln!(
- "history load: {:?}",
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .elapsed_split()
- );
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .start();
- }
-
- //set vars from cfg if present
- let (skip_welcome_message, prompt) = if let Some(cfg) = &context.configs().lock().global_config
- {
- (
- cfg.var("skip_welcome_message")
- .map(|x| x.is_true())
- .unwrap_or(false),
- cfg.var("prompt"),
- )
- } else {
- (false, None)
- };
-
- if options.perf {
- eprintln!(
- "load custom prompt: {:?}",
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .elapsed_split()
- );
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .start();
- }
-
- //Check whether dir we start in contains local cfg file and if so load it.
- load_local_cfg_if_present(&context);
-
- // Give ourselves a scope to work in
- context.scope.enter_scope();
-
- let mut session_text = String::new();
- let mut line_start: usize = 0;
-
- if !skip_welcome_message {
- println!(
- "Welcome to Nushell {} (type 'help' for more info)",
- nu_command::commands::core_version()
- );
- }
-
- #[cfg(windows)]
- {
- let _ = nu_ansi_term::enable_ansi_support();
- }
-
- let mut ctrlcbreak = false;
-
- if options.perf {
- eprintln!(
- "timing stopped. starting run loop: {:?}",
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .elapsed_split()
- );
- STOPWATCH
- .lock()
- .expect("unable to lock the stopwatch")
- .stop();
- }
-
- loop {
- if context.ctrl_c().load(Ordering::SeqCst) {
- context.ctrl_c().store(false, Ordering::SeqCst);
- continue;
- }
-
- let cwd = context.shell_manager().path();
-
- // Check if the PROMPT_COMMAND env variable is set. This env variable
- // contains nu code that is used to overwrite the prompt
- let colored_prompt = match context.scope.get_env(PROMPT_COMMAND) {
- Some(env_prompt) => evaluate_prompt_string(&env_prompt, &context, &cwd),
- None => {
- if let Some(prompt) = &prompt {
- let prompt_line = prompt.as_string()?;
- evaluate_prompt_string(&prompt_line, &context, &cwd)
- } else {
- default_prompt_string(&cwd)
- }
- }
- };
-
- let prompt = {
- if let Ok(bytes) = strip_ansi_escapes::strip(&colored_prompt) {
- String::from_utf8_lossy(&bytes).to_string()
- } else {
- "> ".to_string()
- }
- };
-
- if let Some(helper) = rl.helper_mut() {
- helper.colored_prompt = colored_prompt;
- }
- let mut initial_command = Some(String::new());
- let mut readline = Err(ReadlineError::Eof);
- while let Some(ref cmd) = initial_command {
- readline = rl.readline_with_initial(&prompt, (cmd, ""));
- initial_command = None;
- }
-
- if let Ok(line) = &readline {
- line_start = session_text.len();
- session_text.push_str(line);
- session_text.push('\n');
- }
-
- // start time for command duration
- let cmd_start_time = std::time::Instant::now();
-
- let line = match convert_rustyline_result_to_string(readline) {
- LineResult::Success(_) => process_script(
- &session_text[line_start..],
- &context,
- false,
- line_start,
- true,
- ),
- x => x,
- };
-
- // Store cmd duration in an env var
- context.scope.add_env_var(
- "CMD_DURATION_MS",
- cmd_start_time.elapsed().as_millis().to_string(),
- );
-
- match line {
- LineResult::Success(line) => {
- if options.save_history && !line.trim().is_empty() {
- rl.add_history_entry(&line);
- let _ = rl.append_history(&history_path);
- }
- maybe_print_errors(&context, Text::from(session_text.clone()));
- }
-
- LineResult::ClearHistory => {
- if options.save_history {
- rl.clear_history();
- std::fs::remove_file(&history_path)?;
- }
- }
-
- LineResult::Error(line, err) => {
- if options.save_history && !line.trim().is_empty() {
- rl.add_history_entry(&line);
- let _ = rl.append_history(&history_path);
- }
-
- context
- .host()
- .lock()
- .print_err(err, &Text::from(session_text.clone()));
-
- // I am not so sure, we don't need maybe_print_errors here (as we printed an err
- // above), because maybe_print_errors also clears the errors.
- // TODO Analyze where above err comes from, and whether we need to clear
- // context.errors here
- // Or just be consistent and return errors always in context.errors...
- maybe_print_errors(&context, Text::from(session_text.clone()));
- }
-
- LineResult::CtrlC => {
- let config_ctrlc_exit = context
- .configs()
- .lock()
- .global_config
- .as_ref()
- .and_then(|cfg| cfg.var("ctrlc_exit"))
- .map(|ctrl_c| ctrl_c.is_true())
- .unwrap_or(false); // default behavior is to allow CTRL-C spamming similar to other shells
-
- if !config_ctrlc_exit {
- continue;
- }
-
- if ctrlcbreak {
- if options.save_history {
- let _ = rl.append_history(&history_path);
- }
- std::process::exit(0);
- } else {
- context.with_host(|host| host.stdout("CTRL-C pressed (again to quit)"));
- ctrlcbreak = true;
- continue;
- }
- }
-
- LineResult::CtrlD => {
- context.shell_manager().remove_at_current();
- if context.shell_manager().is_empty() {
- break;
- }
- }
-
- LineResult::Break => {
- break;
- }
- }
- ctrlcbreak = false;
- }
-
- // we are ok if we can not save history
- if options.save_history {
- let _ = rl.append_history(&history_path);
- }
-
- Ok(())
-}
-
-#[cfg(feature = "rustyline-support")]
-pub fn load_local_cfg_if_present(context: &EvaluationContext) {
- trace!("Loading local cfg if present");
- match config::loadable_cfg_exists_in_dir(PathBuf::from(context.shell_manager().path())) {
- Ok(Some(cfg_path)) => {
- if let Err(err) = context.load_config(&ConfigPath::Local(cfg_path)) {
- context.host().lock().print_err(err, &Text::from(""))
- }
- }
- Err(e) => {
- //Report error while checking for local cfg file
- context.host().lock().print_err(e, &Text::from(""))
- }
- Ok(None) => {
- //No local cfg file present in start dir
- }
- }
-}
-
-fn load_cfg_as_global_cfg(context: &EvaluationContext, path: PathBuf) {
- if let Err(err) = context.load_config(&ConfigPath::Global(path)) {
- context.host().lock().print_err(err, &Text::from(""));
- }
-}
-
-pub fn load_global_cfg(context: &EvaluationContext) {
- match config::default_path() {
- Ok(path) => {
- load_cfg_as_global_cfg(context, path);
- }
- Err(e) => {
- context.host().lock().print_err(e, &Text::from(""));
- }
- }
-}
-
-pub fn register_plugins(context: &EvaluationContext) -> Result<(), ShellError> {
- if let Ok(plugins) = nu_engine::plugin::build_plugin::scan(search_paths()) {
- context.add_commands(
- plugins
- .into_iter()
- .filter(|p| !context.is_command_registered(p.name()))
- .collect(),
- );
- }
-
- Ok(())
-}
-
-pub fn parse_and_eval(line: &str, ctx: &EvaluationContext) -> Result {
- // FIXME: do we still need this?
- let line = if let Some(s) = line.strip_suffix('\n') {
- s
- } else {
- line
- };
-
- // TODO ensure the command whose examples we're testing is actually in the pipeline
- ctx.scope.enter_scope();
- let (classified_block, err) = nu_parser::parse(line, 0, &ctx.scope);
- if let Some(err) = err {
- ctx.scope.exit_scope();
- return Err(err.into());
- }
-
- let input_stream = InputStream::empty();
-
- let result = run_block(
- &classified_block,
- ctx,
- input_stream,
- ExternalRedirection::Stdout,
- );
- ctx.scope.exit_scope();
-
- result?.collect_string(Tag::unknown()).map(|x| x.item)
-}
-
-#[allow(dead_code)]
-fn current_branch() -> String {
- #[cfg(feature = "shadow-rs")]
- {
- Some(shadow_rs::branch())
- .map(|x| x.trim().to_string())
- .filter(|x| !x.is_empty())
- .map(|x| format!("({})", x))
- .unwrap_or_default()
- }
- #[cfg(not(feature = "shadow-rs"))]
- {
- "".to_string()
- }
-}
diff --git a/old_nushell/crates/nu-cli/src/keybinding.rs b/old_nushell/crates/nu-cli/src/keybinding.rs
deleted file mode 100644
index 0b90255ed..000000000
--- a/old_nushell/crates/nu-cli/src/keybinding.rs
+++ /dev/null
@@ -1,473 +0,0 @@
-use rustyline::{KeyCode as RustyKeyCode, Modifiers};
-use serde::{Deserialize, Serialize};
-
-pub fn convert_keyevent(key_event: KeyCode, modifiers: Option) -> rustyline::KeyEvent {
- match key_event {
- KeyCode::UnknownEscSeq => convert_to_rl_keyevent(RustyKeyCode::UnknownEscSeq, modifiers),
- KeyCode::Backspace => convert_to_rl_keyevent(RustyKeyCode::Backspace, modifiers),
- KeyCode::BackTab => convert_to_rl_keyevent(RustyKeyCode::BackTab, modifiers),
- KeyCode::BracketedPasteStart => {
- convert_to_rl_keyevent(RustyKeyCode::BracketedPasteStart, modifiers)
- }
- KeyCode::BracketedPasteEnd => {
- convert_to_rl_keyevent(RustyKeyCode::BracketedPasteEnd, modifiers)
- }
- KeyCode::Char(c) => convert_to_rl_keyevent(RustyKeyCode::Char(c), modifiers),
- KeyCode::Delete => convert_to_rl_keyevent(RustyKeyCode::Delete, modifiers),
- KeyCode::Down => convert_to_rl_keyevent(RustyKeyCode::Down, modifiers),
- KeyCode::End => convert_to_rl_keyevent(RustyKeyCode::End, modifiers),
- KeyCode::Enter => convert_to_rl_keyevent(RustyKeyCode::Enter, modifiers),
- KeyCode::Esc => convert_to_rl_keyevent(RustyKeyCode::Esc, modifiers),
- KeyCode::F(u) => convert_to_rl_keyevent(RustyKeyCode::F(u), modifiers),
- KeyCode::Home => convert_to_rl_keyevent(RustyKeyCode::Home, modifiers),
- KeyCode::Insert => convert_to_rl_keyevent(RustyKeyCode::Insert, modifiers),
- KeyCode::Left => convert_to_rl_keyevent(RustyKeyCode::Left, modifiers),
- KeyCode::Null => convert_to_rl_keyevent(RustyKeyCode::Null, modifiers),
- KeyCode::PageDown => convert_to_rl_keyevent(RustyKeyCode::PageDown, modifiers),
- KeyCode::PageUp => convert_to_rl_keyevent(RustyKeyCode::PageUp, modifiers),
- KeyCode::Right => convert_to_rl_keyevent(RustyKeyCode::Right, modifiers),
- KeyCode::Tab => convert_to_rl_keyevent(RustyKeyCode::Tab, modifiers),
- KeyCode::Up => convert_to_rl_keyevent(RustyKeyCode::Up, modifiers),
- }
-}
-
-fn convert_to_rl_keyevent(
- key_code: RustyKeyCode,
- modifier: Option,
-) -> rustyline::KeyEvent {
- rustyline::KeyEvent {
- 0: key_code,
- 1: modifier.unwrap_or(Modifiers::NONE),
- }
-}
-
-fn convert_word(word: Word) -> rustyline::Word {
- match word {
- Word::Big => rustyline::Word::Big,
- Word::Emacs => rustyline::Word::Emacs,
- Word::Vi => rustyline::Word::Vi,
- }
-}
-
-fn convert_at(at: At) -> rustyline::At {
- match at {
- At::AfterEnd => rustyline::At::AfterEnd,
- At::BeforeEnd => rustyline::At::BeforeEnd,
- At::Start => rustyline::At::Start,
- }
-}
-
-fn convert_char_search(search: CharSearch) -> rustyline::CharSearch {
- match search {
- CharSearch::Backward(c) => rustyline::CharSearch::Backward(c),
- CharSearch::BackwardAfter(c) => rustyline::CharSearch::BackwardAfter(c),
- CharSearch::Forward(c) => rustyline::CharSearch::Forward(c),
- CharSearch::ForwardBefore(c) => rustyline::CharSearch::ForwardBefore(c),
- }
-}
-
-fn convert_movement(movement: Movement) -> rustyline::Movement {
- match movement {
- Movement::BackwardChar(u) => rustyline::Movement::BackwardChar(u),
- Movement::BackwardWord { repeat, word } => {
- rustyline::Movement::BackwardWord(repeat, convert_word(word))
- }
- Movement::BeginningOfBuffer => rustyline::Movement::BeginningOfBuffer,
- Movement::BeginningOfLine => rustyline::Movement::BeginningOfLine,
- Movement::EndOfBuffer => rustyline::Movement::EndOfBuffer,
- Movement::EndOfLine => rustyline::Movement::EndOfLine,
- Movement::ForwardChar(u) => rustyline::Movement::ForwardChar(u),
- Movement::ForwardWord { repeat, at, word } => {
- rustyline::Movement::ForwardWord(repeat, convert_at(at), convert_word(word))
- }
- Movement::LineDown(u) => rustyline::Movement::LineDown(u),
- Movement::LineUp(u) => rustyline::Movement::LineUp(u),
- Movement::ViCharSearch { repeat, search } => {
- rustyline::Movement::ViCharSearch(repeat, convert_char_search(search))
- }
- Movement::ViFirstPrint => rustyline::Movement::ViFirstPrint,
- Movement::WholeBuffer => rustyline::Movement::WholeBuffer,
- Movement::WholeLine => rustyline::Movement::WholeLine,
- }
-}
-
-fn convert_anchor(anchor: Anchor) -> rustyline::Anchor {
- match anchor {
- Anchor::After => rustyline::Anchor::After,
- Anchor::Before => rustyline::Anchor::Before,
- }
-}
-
-fn convert_cmd(cmd: Cmd) -> rustyline::Cmd {
- match cmd {
- Cmd::Abort => rustyline::Cmd::Abort,
- Cmd::AcceptLine => rustyline::Cmd::AcceptLine,
- Cmd::AcceptOrInsertLine => rustyline::Cmd::AcceptOrInsertLine {
- accept_in_the_middle: false,
- },
- Cmd::BeginningOfHistory => rustyline::Cmd::BeginningOfHistory,
- Cmd::CapitalizeWord => rustyline::Cmd::CapitalizeWord,
- Cmd::ClearScreen => rustyline::Cmd::ClearScreen,
- Cmd::Complete => rustyline::Cmd::Complete,
- Cmd::CompleteBackward => rustyline::Cmd::CompleteBackward,
- Cmd::CompleteHint => rustyline::Cmd::CompleteHint,
- Cmd::Dedent(movement) => rustyline::Cmd::Dedent(convert_movement(movement)),
- Cmd::DowncaseWord => rustyline::Cmd::DowncaseWord,
- Cmd::EndOfFile => rustyline::Cmd::EndOfFile,
- Cmd::EndOfHistory => rustyline::Cmd::EndOfHistory,
- Cmd::ForwardSearchHistory => rustyline::Cmd::ForwardSearchHistory,
- Cmd::HistorySearchBackward => rustyline::Cmd::HistorySearchBackward,
- Cmd::HistorySearchForward => rustyline::Cmd::HistorySearchForward,
- Cmd::Indent(movement) => rustyline::Cmd::Indent(convert_movement(movement)),
- Cmd::Insert { repeat, string } => rustyline::Cmd::Insert(repeat, string),
- Cmd::Interrupt => rustyline::Cmd::Interrupt,
- Cmd::Kill(movement) => rustyline::Cmd::Kill(convert_movement(movement)),
- Cmd::LineDownOrNextHistory(u) => rustyline::Cmd::LineDownOrNextHistory(u),
- Cmd::LineUpOrPreviousHistory(u) => rustyline::Cmd::LineUpOrPreviousHistory(u),
- Cmd::Move(movement) => rustyline::Cmd::Move(convert_movement(movement)),
- Cmd::NextHistory => rustyline::Cmd::NextHistory,
- Cmd::Newline => rustyline::Cmd::Newline,
- Cmd::Noop => rustyline::Cmd::Noop,
- Cmd::Overwrite(c) => rustyline::Cmd::Overwrite(c),
- #[cfg(windows)]
- Cmd::PasteFromClipboard => rustyline::Cmd::PasteFromClipboard,
- Cmd::PreviousHistory => rustyline::Cmd::PreviousHistory,
- Cmd::QuotedInsert => rustyline::Cmd::QuotedInsert,
- Cmd::Replace {
- movement,
- replacement,
- } => rustyline::Cmd::Replace(convert_movement(movement), replacement),
- Cmd::ReplaceChar { repeat, ch } => rustyline::Cmd::ReplaceChar(repeat, ch),
- Cmd::ReverseSearchHistory => rustyline::Cmd::ReverseSearchHistory,
- Cmd::SelfInsert { repeat, ch } => rustyline::Cmd::SelfInsert(repeat, ch),
- Cmd::Suspend => rustyline::Cmd::Suspend,
- Cmd::TransposeChars => rustyline::Cmd::TransposeChars,
- Cmd::TransposeWords(u) => rustyline::Cmd::TransposeWords(u),
- Cmd::Undo(u) => rustyline::Cmd::Undo(u),
- Cmd::Unknown => rustyline::Cmd::Unknown,
- Cmd::UpcaseWord => rustyline::Cmd::UpcaseWord,
- Cmd::ViYankTo(movement) => rustyline::Cmd::ViYankTo(convert_movement(movement)),
- Cmd::Yank { repeat, anchor } => rustyline::Cmd::Yank(repeat, convert_anchor(anchor)),
- Cmd::YankPop => rustyline::Cmd::YankPop,
- }
-}
-
-fn convert_keybinding(keybinding: Keybinding) -> (rustyline::KeyEvent, rustyline::Cmd) {
- let rusty_modifiers = match keybinding.modifiers {
- Some(mods) => match mods {
- NuModifiers::Ctrl => Some(Modifiers::CTRL),
- NuModifiers::Alt => Some(Modifiers::ALT),
- NuModifiers::Shift => Some(Modifiers::SHIFT),
- NuModifiers::None => Some(Modifiers::NONE),
- NuModifiers::CtrlShift => Some(Modifiers::CTRL_SHIFT),
- NuModifiers::AltShift => Some(Modifiers::ALT_SHIFT),
- NuModifiers::CtrlAlt => Some(Modifiers::CTRL_ALT),
- NuModifiers::CtrlAltShift => Some(Modifiers::CTRL_ALT_SHIFT),
- // _ => None,
- },
- None => None,
- };
- (
- convert_keyevent(keybinding.key, rusty_modifiers),
- convert_cmd(keybinding.binding),
- )
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-pub enum KeyCode {
- /// Unsupported escape sequence (on unix platform)
- UnknownEscSeq,
- /// ⌫ or `KeyEvent::Ctrl('H')`
- Backspace,
- /// ⇤ (usually Shift-Tab)
- BackTab,
- /// Paste (on unix platform)
- BracketedPasteStart,
- /// Paste (on unix platform)
- BracketedPasteEnd,
- /// Single char
- Char(char),
- /// ⌦
- Delete,
- /// ↓ arrow key
- Down,
- /// ⇲
- End,
- /// ↵ or `KeyEvent::Ctrl('M')`
- Enter,
- /// Escape or `KeyEvent::Ctrl('[')`
- Esc,
- /// Function key
- F(u8),
- /// ⇱
- Home,
- /// Insert key
- Insert,
- /// ← arrow key
- Left,
- // /// `KeyEvent::Char('\0')`
- Null,
- /// ⇟
- PageDown,
- /// ⇞
- PageUp,
- /// → arrow key
- Right,
- /// ⇥ or `KeyEvent::Ctrl('I')`
- Tab,
- /// ↑ arrow key
- Up,
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-pub enum Cmd {
- /// abort
- Abort, // Miscellaneous Command
- /// accept-line
- AcceptLine,
- /// beginning-of-history
- BeginningOfHistory,
- /// capitalize-word
- CapitalizeWord,
- /// clear-screen
- ClearScreen,
- /// complete
- Complete,
- /// complete-backward
- CompleteBackward,
- /// complete-hint
- CompleteHint,
- /// Dedent current line
- Dedent(Movement),
- /// downcase-word
- DowncaseWord,
- /// vi-eof-maybe
- EndOfFile,
- /// end-of-history
- EndOfHistory,
- /// forward-search-history
- ForwardSearchHistory,
- /// history-search-backward
- HistorySearchBackward,
- /// history-search-forward
- HistorySearchForward,
- /// Indent current line
- Indent(Movement),
- /// Insert text
- Insert { repeat: RepeatCount, string: String },
- /// Interrupt signal (Ctrl-C)
- Interrupt,
- /// backward-delete-char, backward-kill-line, backward-kill-word
- /// delete-char, kill-line, kill-word, unix-line-discard, unix-word-rubout,
- /// vi-delete, vi-delete-to, vi-rubout
- Kill(Movement),
- /// backward-char, backward-word, beginning-of-line, end-of-line,
- /// forward-char, forward-word, vi-char-search, vi-end-word, vi-next-word,
- /// vi-prev-word
- Move(Movement),
- /// Inserts a newline
- Newline,
- /// next-history
- NextHistory,
- /// No action
- Noop,
- /// vi-replace
- Overwrite(char),
- /// Paste from the clipboard
- #[cfg(windows)]
- PasteFromClipboard,
- /// previous-history
- PreviousHistory,
- /// quoted-insert
- QuotedInsert,
- /// vi-change-char
- ReplaceChar { repeat: RepeatCount, ch: char },
- /// vi-change-to, vi-substitute
- Replace {
- movement: Movement,
- replacement: Option,
- },
- /// reverse-search-history
- ReverseSearchHistory,
- /// self-insert
- SelfInsert { repeat: RepeatCount, ch: char },
- /// Suspend signal (Ctrl-Z on unix platform)
- Suspend,
- /// transpose-chars
- TransposeChars,
- /// transpose-words
- TransposeWords(RepeatCount),
- /// undo
- Undo(RepeatCount),
- /// Unsupported / unexpected
- Unknown,
- /// upcase-word
- UpcaseWord,
- /// vi-yank-to
- ViYankTo(Movement),
- /// yank, vi-put
- Yank { repeat: RepeatCount, anchor: Anchor },
- /// yank-pop
- YankPop,
- /// moves cursor to the line above or switches to prev history entry if
- /// the cursor is already on the first line
- LineUpOrPreviousHistory(RepeatCount),
- /// moves cursor to the line below or switches to next history entry if
- /// the cursor is already on the last line
- LineDownOrNextHistory(RepeatCount),
- /// accepts the line when cursor is at the end of the text (non including
- /// trailing whitespace), inserts newline character otherwise
- AcceptOrInsertLine,
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-pub enum Movement {
- /// Whole current line (not really a movement but a range)
- WholeLine,
- /// beginning-of-line
- BeginningOfLine,
- /// end-of-line
- EndOfLine,
- /// backward-word, vi-prev-word
- BackwardWord { repeat: RepeatCount, word: Word }, // Backward until start of word
- /// forward-word, vi-end-word, vi-next-word
- ForwardWord {
- repeat: RepeatCount,
- at: At,
- word: Word,
- }, // Forward until start/end of word
- /// vi-char-search
- ViCharSearch {
- repeat: RepeatCount,
- search: CharSearch,
- },
- /// vi-first-print
- ViFirstPrint,
- /// backward-char
- BackwardChar(RepeatCount),
- /// forward-char
- ForwardChar(RepeatCount),
- /// move to the same column on the previous line
- LineUp(RepeatCount),
- /// move to the same column on the next line
- LineDown(RepeatCount),
- /// Whole user input (not really a movement but a range)
- WholeBuffer,
- /// beginning-of-buffer
- BeginningOfBuffer,
- /// end-of-buffer
- EndOfBuffer,
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-enum InputMode {
- /// Vi Command/Alternate
- Command,
- /// Insert/Input mode
- Insert,
- /// Overwrite mode
- Replace,
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-pub enum Word {
- /// non-blanks characters
- Big,
- /// alphanumeric characters
- Emacs,
- /// alphanumeric (and '_') characters
- Vi,
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-pub enum At {
- /// Start of word.
- Start,
- /// Before end of word.
- BeforeEnd,
- /// After end of word.
- AfterEnd,
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-pub enum Anchor {
- /// After cursor
- After,
- /// Before cursor
- Before,
-}
-
-#[derive(Serialize, Deserialize, Debug, Clone)]
-pub enum CharSearch {
- /// Forward search
- Forward(char),
- /// Forward search until
- ForwardBefore(char),
- /// Backward search
- Backward(char),
- /// Backward search until
- BackwardAfter(char),
-}
-
-/// The set of modifier keys that were triggered along with a key press.
-#[derive(Debug, Serialize, Deserialize)]
-#[allow(non_camel_case_types)]
-pub enum NuModifiers {
- /// Control modifier
- #[serde(alias = "CTRL")]
- Ctrl = 8,
- /// Escape or Alt modifier
- #[serde(alias = "ALT")]
- Alt = 4,
- /// Shift modifier
- #[serde(alias = "SHIFT")]
- Shift = 2,
- /// No modifier
- #[serde(alias = "NONE")]
- None = 0,
- /// Ctrl + Shift
- #[serde(alias = "CTRL_SHIFT")]
- CtrlShift = 10,
- /// Alt + Shift
- #[serde(alias = "ALT_SHIFT")]
- AltShift = 6,
- /// Ctrl + Alt
- #[serde(alias = "CTRL_ALT")]
- CtrlAlt = 12,
- /// Ctrl + Alt + Shift
- #[serde(alias = "CTRL_ALT_SHIFT")]
- CtrlAltShift = 14,
-}
-
-/// The number of times one command should be repeated.
-pub type RepeatCount = usize;
-
-#[derive(Debug, Serialize, Deserialize)]
-pub struct Keybinding {
- key: KeyCode,
- modifiers: Option,
- binding: Cmd,
-}
-
-type Keybindings = Vec;
-
-pub(crate) fn load_keybindings(
- rl: &mut rustyline::Editor,
-) -> Result<(), nu_errors::ShellError> {
- let filename = nu_data::keybinding::keybinding_path()?;
- let contents = std::fs::read_to_string(filename);
-
- // Silently fail if there is no file there
- if let Ok(contents) = contents {
- let keybindings: Keybindings = serde_yaml::from_str(&contents)?;
- // eprintln!("{:#?}", keybindings);
- for keybinding in keybindings {
- let (k, b) = convert_keybinding(keybinding);
- // eprintln!("{:?} {:?}", k, b);
-
- rl.bind_sequence(k, b);
- }
- }
-
- Ok(())
-}
diff --git a/old_nushell/crates/nu-cli/src/lib.rs b/old_nushell/crates/nu-cli/src/lib.rs
deleted file mode 100644
index 4b3e2fb93..000000000
--- a/old_nushell/crates/nu-cli/src/lib.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-pub mod app;
-mod cli;
-#[cfg(feature = "rustyline-support")]
-mod keybinding;
-mod line_editor;
-#[cfg(feature = "rustyline-support")]
-mod shell;
-
-#[cfg(feature = "rustyline-support")]
-pub use crate::cli::cli;
-
-pub use crate::app::App;
-pub use crate::cli::{parse_and_eval, register_plugins, run_script_file};
-
-pub use nu_command::create_default_context;
diff --git a/old_nushell/crates/nu-cli/src/line_editor.rs b/old_nushell/crates/nu-cli/src/line_editor.rs
deleted file mode 100644
index 7c36021b8..000000000
--- a/old_nushell/crates/nu-cli/src/line_editor.rs
+++ /dev/null
@@ -1,276 +0,0 @@
-use nu_engine::EvaluationContext;
-use nu_errors::ShellError;
-use std::error::Error;
-
-#[allow(unused_imports)]
-use std::sync::atomic::Ordering;
-
-#[allow(unused_imports)]
-use nu_engine::script::LineResult;
-
-#[cfg(feature = "rustyline-support")]
-use crate::keybinding::{convert_keyevent, KeyCode};
-
-#[cfg(feature = "rustyline-support")]
-use crate::shell::Helper;
-
-#[cfg(feature = "rustyline-support")]
-use rustyline::{
- self,
- config::Configurer,
- config::{ColorMode, CompletionType, Config},
- error::ReadlineError,
- line_buffer::LineBuffer,
- At, Cmd, ConditionalEventHandler, Editor, EventHandler, Modifiers, Movement, Word,
-};
-
-#[cfg(feature = "rustyline-support")]
-pub fn convert_rustyline_result_to_string(input: Result) -> LineResult {
- match input {
- Ok(s) if s == "history -c" || s == "history --clear" => LineResult::ClearHistory,
- Ok(s) => LineResult::Success(s),
- Err(ReadlineError::Interrupted) => LineResult::CtrlC,
- Err(ReadlineError::Eof) => LineResult::CtrlD,
- Err(err) => {
- eprintln!("Error: {:?}", err);
- LineResult::Break
- }
- }
-}
-
-#[derive(Clone)]
-#[cfg(feature = "rustyline-support")]
-struct PartialCompleteHintHandler;
-
-#[cfg(feature = "rustyline-support")]
-impl ConditionalEventHandler for PartialCompleteHintHandler {
- fn handle(
- &self,
- _evt: &rustyline::Event,
- _n: rustyline::RepeatCount,
- _positive: bool,
- ctx: &rustyline::EventContext,
- ) -> Option {
- Some(match ctx.hint_text() {
- Some(hint_text) if ctx.pos() == ctx.line().len() => {
- let mut line_buffer = LineBuffer::with_capacity(hint_text.len());
- line_buffer.update(hint_text, 0);
- line_buffer.move_to_next_word(At::AfterEnd, Word::Vi, 1);
-
- let text = hint_text[0..line_buffer.pos()].to_string();
-
- Cmd::Insert(1, text)
- }
- _ => Cmd::Move(Movement::ForwardWord(1, At::AfterEnd, Word::Vi)),
- })
- }
-}
-
-#[cfg(feature = "rustyline-support")]
-pub fn default_rustyline_editor_configuration() -> Editor {
- #[cfg(windows)]
- const DEFAULT_COMPLETION_MODE: CompletionType = CompletionType::Circular;
- #[cfg(not(windows))]
- const DEFAULT_COMPLETION_MODE: CompletionType = CompletionType::List;
-
- let config = Config::builder()
- .check_cursor_position(true)
- .color_mode(ColorMode::Forced)
- .history_ignore_dups(false)
- .max_history_size(10_000)
- .build();
- let mut rl: Editor<_> = Editor::with_config(config);
-
- // add key bindings to move over a whole word with Ctrl+ArrowLeft and Ctrl+ArrowRight
- //M modifier, E KeyEvent, K KeyCode
- rl.bind_sequence(
- convert_keyevent(KeyCode::Left, Some(Modifiers::CTRL)),
- Cmd::Move(Movement::BackwardWord(1, Word::Vi)),
- );
-
- rl.bind_sequence(
- convert_keyevent(KeyCode::Right, Some(Modifiers::CTRL)),
- EventHandler::Conditional(Box::new(PartialCompleteHintHandler)),
- );
-
- // workaround for multiline-paste hang in rustyline (see https://github.com/kkawakam/rustyline/issues/202)
- rl.bind_sequence(
- convert_keyevent(KeyCode::BracketedPasteStart, None),
- rustyline::Cmd::Noop,
- );
- // Let's set the defaults up front and then override them later if the user indicates
- // defaults taken from here https://github.com/kkawakam/rustyline/blob/2fe886c9576c1ea13ca0e5808053ad491a6fe049/src/config.rs#L150-L167
- rl.set_max_history_size(100);
- rl.set_history_ignore_dups(true);
- rl.set_history_ignore_space(false);
- rl.set_completion_type(DEFAULT_COMPLETION_MODE);
- rl.set_completion_prompt_limit(100);
- rl.set_keyseq_timeout(-1);
- rl.set_edit_mode(rustyline::config::EditMode::Emacs);
- rl.set_auto_add_history(false);
- rl.set_bell_style(rustyline::config::BellStyle::default());
- rl.set_color_mode(rustyline::ColorMode::Enabled);
- rl.set_tab_stop(8);
-
- if let Err(e) = crate::keybinding::load_keybindings(&mut rl) {
- println!("Error loading keybindings: {:?}", e);
- }
-
- rl
-}
-
-#[cfg(feature = "rustyline-support")]
-pub fn configure_rustyline_editor(
- rl: &mut Editor,
- config: &dyn nu_data::config::Conf,
-) -> Result<(), ShellError> {
- #[cfg(windows)]
- const DEFAULT_COMPLETION_MODE: CompletionType = CompletionType::Circular;
- #[cfg(not(windows))]
- const DEFAULT_COMPLETION_MODE: CompletionType = CompletionType::List;
-
- if let Some(line_editor_vars) = config.var("line_editor") {
- for (idx, value) in line_editor_vars.row_entries() {
- match idx.as_ref() {
- "max_history_size" => {
- if let Ok(max_history_size) = value.as_u64() {
- rl.set_max_history_size(max_history_size as usize);
- }
- }
- "history_duplicates" => {
- // history_duplicates = match value.as_string() {
- // Ok(s) if s.to_lowercase() == "alwaysadd" => {
- // rustyline::config::HistoryDuplicates::AlwaysAdd
- // }
- // Ok(s) if s.to_lowercase() == "ignoreconsecutive" => {
- // rustyline::config::HistoryDuplicates::IgnoreConsecutive
- // }
- // _ => rustyline::config::HistoryDuplicates::AlwaysAdd,
- // };
- if let Ok(history_duplicates) = value.as_bool() {
- rl.set_history_ignore_dups(history_duplicates);
- }
- }
- "history_ignore_space" => {
- if let Ok(history_ignore_space) = value.as_bool() {
- rl.set_history_ignore_space(history_ignore_space);
- }
- }
- "completion_type" => {
- let completion_type = match value.as_string() {
- Ok(s) if s.to_lowercase() == "circular" => {
- rustyline::config::CompletionType::Circular
- }
- Ok(s) if s.to_lowercase() == "list" => {
- rustyline::config::CompletionType::List
- }
- #[cfg(all(unix, feature = "with-fuzzy"))]
- Ok(s) if s.to_lowercase() == "fuzzy" => {
- rustyline::config::CompletionType::Fuzzy
- }
- _ => DEFAULT_COMPLETION_MODE,
- };
- rl.set_completion_type(completion_type);
- }
- "completion_prompt_limit" => {
- if let Ok(completion_prompt_limit) = value.as_u64() {
- rl.set_completion_prompt_limit(completion_prompt_limit as usize);
- }
- }
- "keyseq_timeout_ms" => {
- if let Ok(keyseq_timeout_ms) = value.as_u64() {
- rl.set_keyseq_timeout(keyseq_timeout_ms as i32);
- }
- }
- "edit_mode" => {
- let edit_mode = match value.as_string() {
- Ok(s) if s.to_lowercase() == "vi" => rustyline::config::EditMode::Vi,
- Ok(s) if s.to_lowercase() == "emacs" => rustyline::config::EditMode::Emacs,
- _ => rustyline::config::EditMode::Emacs,
- };
- rl.set_edit_mode(edit_mode);
- // Note: When edit_mode is Emacs, the keyseq_timeout_ms is set to -1
- // no matter what you may have configured. This is so that key chords
- // can be applied without having to do them in a given timeout. So,
- // it essentially turns off the keyseq timeout.
- }
- "auto_add_history" => {
- if let Ok(auto_add_history) = value.as_bool() {
- rl.set_auto_add_history(auto_add_history);
- }
- }
- "bell_style" => {
- let bell_style = match value.as_string() {
- Ok(s) if s.to_lowercase() == "audible" => {
- rustyline::config::BellStyle::Audible
- }
- Ok(s) if s.to_lowercase() == "none" => rustyline::config::BellStyle::None,
- Ok(s) if s.to_lowercase() == "visible" => {
- rustyline::config::BellStyle::Visible
- }
- _ => rustyline::config::BellStyle::default(),
- };
- rl.set_bell_style(bell_style);
- }
- "color_mode" => {
- let color_mode = match value.as_string() {
- Ok(s) if s.to_lowercase() == "enabled" => rustyline::ColorMode::Enabled,
- Ok(s) if s.to_lowercase() == "forced" => rustyline::ColorMode::Forced,
- Ok(s) if s.to_lowercase() == "disabled" => rustyline::ColorMode::Disabled,
- _ => rustyline::ColorMode::Enabled,
- };
- rl.set_color_mode(color_mode);
- }
- "tab_stop" => {
- if let Ok(tab_stop) = value.as_u64() {
- rl.set_tab_stop(tab_stop as usize);
- }
- }
- _ => (),
- }
- }
- }
-
- Ok(())
-}
-
-#[cfg(feature = "rustyline-support")]
-pub fn nu_line_editor_helper(
- context: &EvaluationContext,
- config: &dyn nu_data::config::Conf,
-) -> crate::shell::Helper {
- let hinter = rustyline_hinter(config);
- crate::shell::Helper::new(context.clone(), hinter)
-}
-
-#[cfg(feature = "rustyline-support")]
-pub fn rustyline_hinter(
- config: &dyn nu_data::config::Conf,
-) -> Option {
- if let Some(line_editor_vars) = config.var("line_editor") {
- for (idx, value) in line_editor_vars.row_entries() {
- if idx == "show_hints" && value.as_bool() == Ok(false) {
- return None;
- }
- }
- }
-
- Some(rustyline::hint::HistoryHinter {})
-}
-
-pub fn configure_ctrl_c(_context: &EvaluationContext) -> Result<(), Box> {
- #[cfg(feature = "ctrlc")]
- {
- let cc = _context.ctrl_c().clone();
-
- ctrlc::set_handler(move || {
- cc.store(true, Ordering::SeqCst);
- })?;
-
- if _context.ctrl_c().load(Ordering::SeqCst) {
- _context.ctrl_c().store(false, Ordering::SeqCst);
- }
- }
-
- Ok(())
-}
diff --git a/old_nushell/crates/nu-cli/src/shell.rs b/old_nushell/crates/nu-cli/src/shell.rs
deleted file mode 100644
index ce7ef7a3a..000000000
--- a/old_nushell/crates/nu-cli/src/shell.rs
+++ /dev/null
@@ -1,234 +0,0 @@
-use nu_ansi_term::Color;
-use nu_completion::NuCompleter;
-use nu_engine::{DefaultPalette, EvaluationContext, Painter};
-use nu_source::{Tag, Tagged};
-use std::borrow::Cow::{self, Owned};
-
-pub struct Helper {
- completer: NuCompleter,
- hinter: Option,
- context: EvaluationContext,
- pub colored_prompt: String,
- validator: NuValidator,
-}
-
-impl Helper {
- pub(crate) fn new(
- context: EvaluationContext,
- hinter: Option,
- ) -> Helper {
- Helper {
- completer: NuCompleter {},
- hinter,
- context,
- colored_prompt: String::new(),
- validator: NuValidator {},
- }
- }
-}
-
-use nu_protocol::{SignatureRegistry, VariableRegistry};
-struct CompletionContext<'a>(&'a EvaluationContext);
-
-impl<'a> nu_completion::CompletionContext for CompletionContext<'a> {
- fn signature_registry(&self) -> &dyn SignatureRegistry {
- &self.0.scope
- }
-
- fn scope(&self) -> &dyn nu_parser::ParserScope {
- &self.0.scope
- }
-
- fn source(&self) -> &EvaluationContext {
- self.as_ref()
- }
-
- fn variable_registry(&self) -> &dyn VariableRegistry {
- self.0
- }
-}
-
-impl<'a> AsRef for CompletionContext<'a> {
- fn as_ref(&self) -> &EvaluationContext {
- self.0
- }
-}
-
-pub struct CompletionSuggestion(nu_completion::Suggestion);
-
-impl rustyline::completion::Candidate for CompletionSuggestion {
- fn display(&self) -> &str {
- &self.0.display
- }
-
- fn replacement(&self) -> &str {
- &self.0.replacement
- }
-}
-
-impl rustyline::completion::Completer for Helper {
- type Candidate = CompletionSuggestion;
-
- fn complete(
- &self,
- line: &str,
- pos: usize,
- _ctx: &rustyline::Context<'_>,
- ) -> Result<(usize, Vec), rustyline::error::ReadlineError> {
- let ctx = CompletionContext(&self.context);
- let (position, suggestions) = self.completer.complete(line, pos, &ctx);
- let suggestions = suggestions.into_iter().map(CompletionSuggestion).collect();
- Ok((position, suggestions))
- }
-
- fn update(&self, line: &mut rustyline::line_buffer::LineBuffer, start: usize, elected: &str) {
- let end = line.pos();
- line.replace(start..end, elected)
- }
-}
-
-impl rustyline::hint::Hinter for Helper {
- type Hint = String;
- fn hint(&self, line: &str, pos: usize, ctx: &rustyline::Context<'_>) -> Option {
- match &self.hinter {
- Some(the_hinter) => the_hinter.hint(line, pos, ctx),
- None => Some("".to_string()),
- }
- }
-}
-
-impl rustyline::highlight::Highlighter for Helper {
- fn highlight_prompt<'b, 's: 'b, 'p: 'b>(
- &'s self,
- prompt: &'p str,
- default: bool,
- ) -> Cow<'b, str> {
- use std::borrow::Cow::Borrowed;
-
- if default {
- Borrowed(&self.colored_prompt)
- } else {
- Borrowed(prompt)
- }
- }
-
- fn highlight_hint<'h>(&self, hint: &'h str) -> Cow<'h, str> {
- Owned(Color::DarkGray.prefix().to_string() + hint + nu_ansi_term::ansi::RESET)
- }
-
- fn highlight<'l>(&self, line: &'l str, _pos: usize) -> Cow<'l, str> {
- let cfg = &self.context.configs().lock();
- if let Some(palette) = &cfg.syntax_config {
- Painter::paint_string(line, &self.context.scope, palette)
- } else {
- Painter::paint_string(line, &self.context.scope, &DefaultPalette {})
- }
- }
-
- fn highlight_char(&self, _line: &str, _pos: usize) -> bool {
- true
- }
-}
-
-impl rustyline::validate::Validator for Helper {
- fn validate(
- &self,
- ctx: &mut rustyline::validate::ValidationContext,
- ) -> rustyline::Result {
- self.validator.validate(ctx)
- }
-
- fn validate_while_typing(&self) -> bool {
- self.validator.validate_while_typing()
- }
-}
-
-struct NuValidator {}
-
-impl rustyline::validate::Validator for NuValidator {
- fn validate(
- &self,
- ctx: &mut rustyline::validate::ValidationContext,
- ) -> rustyline::Result {
- let src = ctx.input();
-
- let (tokens, err) = nu_parser::lex(src, 0, nu_parser::NewlineMode::Normal);
- if let Some(err) = err {
- if let nu_errors::ParseErrorReason::Eof { .. } = err.reason() {
- return Ok(rustyline::validate::ValidationResult::Incomplete);
- }
- }
-
- let (_, err) = nu_parser::parse_block(tokens);
-
- if let Some(err) = err {
- if let nu_errors::ParseErrorReason::Eof { .. } = err.reason() {
- return Ok(rustyline::validate::ValidationResult::Incomplete);
- }
- }
-
- Ok(rustyline::validate::ValidationResult::Valid(None))
- }
-}
-
-#[allow(unused)]
-fn vec_tag(input: Vec>) -> Option {
- let mut iter = input.iter();
- let first = iter.next()?.tag.clone();
- let last = iter.last();
-
- Some(match last {
- None => first,
- Some(last) => first.until(&last.tag),
- })
-}
-
-impl rustyline::Helper for Helper {}
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use nu_engine::EvaluationContext;
- use rustyline::completion::Completer;
- use rustyline::line_buffer::LineBuffer;
-
- #[ignore]
- #[test]
- fn closing_quote_should_replaced() {
- let text = "cd \"folder with spaces\\subdirectory\\\"";
- let replacement = "\"folder with spaces\\subdirectory\\subsubdirectory\\\"";
-
- let mut buffer = LineBuffer::with_capacity(256);
- buffer.insert_str(0, text);
- buffer.set_pos(text.len() - 1);
-
- let helper = Helper::new(EvaluationContext::basic(), None);
-
- helper.update(&mut buffer, "cd ".len(), replacement);
-
- assert_eq!(
- buffer.as_str(),
- "cd \"folder with spaces\\subdirectory\\subsubdirectory\\\""
- );
- }
-
- #[ignore]
- #[test]
- fn replacement_with_cursor_in_text() {
- let text = "cd \"folder with spaces\\subdirectory\\\"";
- let replacement = "\"folder with spaces\\subdirectory\\subsubdirectory\\\"";
-
- let mut buffer = LineBuffer::with_capacity(256);
- buffer.insert_str(0, text);
- buffer.set_pos(text.len() - 30);
-
- let helper = Helper::new(EvaluationContext::basic(), None);
-
- helper.update(&mut buffer, "cd ".len(), replacement);
-
- assert_eq!(
- buffer.as_str(),
- "cd \"folder with spaces\\subdirectory\\subsubdirectory\\\""
- );
- }
-}
diff --git a/old_nushell/crates/nu-command/Cargo.toml b/old_nushell/crates/nu-command/Cargo.toml
deleted file mode 100644
index 943bc4480..000000000
--- a/old_nushell/crates/nu-command/Cargo.toml
+++ /dev/null
@@ -1,122 +0,0 @@
-[package]
-authors = ["The Nu Project Contributors"]
-build = "build.rs"
-description = "Commands for Nushell"
-edition = "2018"
-license = "MIT"
-name = "nu-command"
-version = "0.43.0"
-
-[lib]
-doctest = false
-
-[dependencies]
-nu-data = { version = "0.43.0", path="../nu-data" }
-nu-engine = { version = "0.43.0", path="../nu-engine" }
-nu-errors = { version = "0.43.0", path="../nu-errors" }
-nu-json = { version = "0.43.0", path="../nu-json" }
-nu-path = { version = "0.43.0", path="../nu-path" }
-nu-parser = { version = "0.43.0", path="../nu-parser" }
-nu-plugin = { version = "0.43.0", path="../nu-plugin" }
-nu-protocol = { version = "0.43.0", path="../nu-protocol" }
-nu-serde = { version = "0.43.0", path="../nu-serde" }
-nu-source = { version = "0.43.0", path="../nu-source" }
-nu-stream = { version = "0.43.0", path="../nu-stream" }
-nu-table = { version = "0.43.0", path="../nu-table" }
-nu-test-support = { version = "0.43.0", path="../nu-test-support" }
-nu-value-ext = { version = "0.43.0", path="../nu-value-ext" }
-nu-ansi-term = { version = "0.43.0", path="../nu-ansi-term" }
-nu-pretty-hex = { version = "0.43.0", path="../nu-pretty-hex" }
-
-url = "2.2.1"
-mime = "0.3.16"
-heck = "0.4.0"
-base64 = "0.13.0"
-bigdecimal = { version = "0.3.0", features = ["serde"] }
-calamine = "0.18.0"
-chrono = { version="0.4.19", features=["serde"] }
-chrono-tz = "0.5.3"
-crossterm = { version="0.19.0", optional=true }
-csv = "1.1.3"
-ctrlc = { version="3.1.7", optional=true }
-derive-new = "0.5.8"
-dirs-next = "2.0.0"
-dtparse = "1.2.0"
-eml-parser = "0.1.0"
-encoding_rs = "0.8.28"
-filesize = "0.2.0"
-futures = { version="0.3.12", features=["compat", "io-compat"] }
-glob = "0.3.0"
-htmlescape = "0.3.1"
-ical = "0.7.0"
-indexmap = { version="1.7", features=["serde-1"] }
-itertools = "0.10.0"
-lazy_static = "1.*"
-log = "0.4.14"
-md-5 = "0.9.1"
-meval = "0.2.0"
-num-bigint = { version="0.4.3", features=["serde"] }
-num-format = { version="0.4.0", features=["with-num-bigint"] }
-num-traits = "0.2.14"
-parking_lot = "0.11.1"
-quick-xml = "0.22"
-rand = "0.8"
-regex = "1.4.3"
-reqwest = {version = "0.11", optional = true }
-roxmltree = "0.14.0"
-rust-embed = "5.9.0"
-rustyline = { version="9.0.0", optional=true }
-serde = { version="1.0.123", features=["derive"] }
-serde_ini = "0.2.0"
-serde_json = "1.0.61"
-serde_urlencoded = "0.7.0"
-serde_yaml = "0.8.16"
-sha2 = "0.9.3"
-strip-ansi-escapes = "0.1.0"
-sysinfo = { version = "0.23.0", optional = true }
-thiserror = "1.0.26"
-term = { version="0.7.0", optional=true }
-term_size = "0.3.2"
-titlecase = "1.1.0"
-tokio = { version = "1", features = ["rt-multi-thread"], optional = true }
-toml = "0.5.8"
-trash = { version = "2.0.2", optional = true }
-unicode-segmentation = "1.8"
-uuid_crate = { package="uuid", version="0.8.2", features=["v4"], optional=true }
-which = { version="4.1.0", optional=true }
-zip = { version="0.5.9", optional=true }
-digest = "0.9.0"
-
-[dependencies.polars]
-version = "0.17.0"
-optional = true
-default-features = false
-features = ["docs", "zip_with", "csv-file", "temporal", "performant", "pretty_fmt", "dtype-slim", "parquet", "json", "random", "pivot", "strings", "is_in", "cum_agg", "rolling_window"]
-
-[target.'cfg(unix)'.dependencies]
-umask = "1.0.0"
-users = "0.11.0"
-
-# TODO this will be possible with new dependency resolver
-# (currently on nightly behind -Zfeatures=itarget):
-# https://github.com/rust-lang/cargo/issues/7914
-# [target.'cfg(not(windows))'.dependencies]
-# num-format = { version = "0.4", features = ["with-system-locale"] }
-
-[build-dependencies]
-shadow-rs = "0.8.1"
-
-[dev-dependencies]
-quickcheck = "1.0.3"
-quickcheck_macros = "1.0.0"
-hamcrest2 = "0.3.0"
-
-[features]
-rustyline-support = ["rustyline"]
-stable = []
-trash-support = ["trash"]
-dataframe = ["nu-protocol/dataframe", "polars"]
-fetch = ["reqwest", "tokio"]
-post = ["reqwest", "tokio"]
-sys = ["sysinfo"]
-ps = ["sysinfo"]
diff --git a/old_nushell/crates/nu-command/README.md b/old_nushell/crates/nu-command/README.md
deleted file mode 100644
index b9f0857cb..000000000
--- a/old_nushell/crates/nu-command/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# nu-command
-
-The Nu command crate contains the full set of internal commands, that is, the commands that can be form the set of built-in commands in a Nushell engine.
-
-The default set of commands that Nushell ships with can be found in the [default context](src/default_context.rs).
-
-The commands themselves live in the [commands module](src/commands/).
diff --git a/old_nushell/crates/nu-command/assets/228_themes.zip b/old_nushell/crates/nu-command/assets/228_themes.zip
deleted file mode 100644
index eca629d50..000000000
Binary files a/old_nushell/crates/nu-command/assets/228_themes.zip and /dev/null differ
diff --git a/old_nushell/crates/nu-command/build.rs b/old_nushell/crates/nu-command/build.rs
deleted file mode 100644
index 4a0dfc459..000000000
--- a/old_nushell/crates/nu-command/build.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-fn main() -> shadow_rs::SdResult<()> {
- shadow_rs::new()
-}
diff --git a/old_nushell/crates/nu-command/src/args.rs b/old_nushell/crates/nu-command/src/args.rs
deleted file mode 100644
index 2e6961888..000000000
--- a/old_nushell/crates/nu-command/src/args.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-use nu_protocol::Value;
-
-#[derive(Debug)]
-pub enum LogLevel {}
-
-#[derive(Debug)]
-pub struct LogItem {
- level: LogLevel,
- value: Value,
-}
diff --git a/old_nushell/crates/nu-command/src/classified/external.rs b/old_nushell/crates/nu-command/src/classified/external.rs
deleted file mode 100644
index 716d830a2..000000000
--- a/old_nushell/crates/nu-command/src/classified/external.rs
+++ /dev/null
@@ -1,725 +0,0 @@
-use crate::prelude::*;
-use lazy_static::lazy_static;
-use nu_engine::{evaluate_baseline_expr, BufCodecReader};
-use nu_engine::{MaybeTextCodec, StringOrBinary};
-use nu_test_support::NATIVE_PATH_ENV_VAR;
-use parking_lot::Mutex;
-use regex::Regex;
-
-#[allow(unused)]
-use std::env;
-use std::io::Write;
-use std::path::PathBuf;
-use std::process::{Command, Stdio};
-use std::sync::mpsc;
-use std::{borrow::Cow, io::BufReader};
-
-use log::trace;
-
-use nu_errors::ShellError;
-use nu_protocol::hir::Expression;
-use nu_protocol::hir::{ExternalCommand, ExternalRedirection};
-use nu_protocol::{Primitive, ShellTypeName, UntaggedValue, Value};
-use nu_source::Tag;
-
-#[cfg(feature = "which")]
-use which::which_in;
-
-pub(crate) fn run_external_command(
- command: ExternalCommand,
- context: &mut EvaluationContext,
- input: InputStream,
- external_redirection: ExternalRedirection,
-) -> Result {
- trace!(target: "nu::run::external", "-> {}", command.name);
-
- context.sync_path_to_env();
- if !context.host().lock().is_external_cmd(&command.name) {
- return Err(ShellError::labeled_error(
- "Command not found",
- format!("command {} not found", &command.name),
- &command.name_tag,
- ));
- }
-
- run_with_stdin(command, context, input, external_redirection)
-}
-
-#[allow(unused)]
-fn trim_enclosing_quotes(input: &str) -> String {
- let mut chars = input.chars();
-
- match (chars.next(), chars.next_back()) {
- (Some('"'), Some('"')) => chars.collect(),
- (Some('\''), Some('\'')) => chars.collect(),
- _ => input.to_string(),
- }
-}
-
-fn run_with_stdin(
- command: ExternalCommand,
- context: &mut EvaluationContext,
- input: InputStream,
- external_redirection: ExternalRedirection,
-) -> Result {
- let path = context.shell_manager().path();
-
- let mut command_args = vec![];
- for arg in command.args.iter() {
- let is_literal = matches!(arg.expr, Expression::Literal(_));
- let value = evaluate_baseline_expr(arg, context)?;
-
- // Skip any arguments that don't really exist, treating them as optional
- // FIXME: we may want to preserve the gap in the future, though it's hard to say
- // what value we would put in its place.
- if value.value.is_none() {
- continue;
- }
-
- // Do the cleanup that we need to do on any argument going out:
- match &value.value {
- UntaggedValue::Table(table) => {
- for t in table {
- match &t.value {
- UntaggedValue::Primitive(_) => {
- command_args.push((
- t.convert_to_string().trim_end_matches('\n').to_string(),
- is_literal,
- ));
- }
- _ => {
- return Err(ShellError::labeled_error(
- "Could not convert to positional arguments",
- "could not convert to positional arguments",
- value.tag(),
- ));
- }
- }
- }
- }
- _ => {
- let trimmed_value_string = value.as_string()?.trim_end_matches('\n').to_string();
- //let trimmed_value_string = trim_quotes(&trimmed_value_string);
- command_args.push((trimmed_value_string, is_literal));
- }
- }
- }
-
- let process_args = command_args
- .iter()
- .map(|(arg, _is_literal)| {
- let arg = nu_path::expand_tilde(arg).to_string_lossy().to_string();
-
- #[cfg(not(windows))]
- {
- if !_is_literal {
- arg
- } else {
- trim_enclosing_quotes(&arg)
- }
- }
- #[cfg(windows)]
- {
- if let Some(unquoted) = remove_quotes(&arg) {
- unquoted.to_string()
- } else {
- arg
- }
- }
- })
- .collect::>();
-
- spawn(
- &command,
- &path,
- &process_args[..],
- input,
- external_redirection,
- &context.scope,
- )
-}
-
-/// Spawn a direct exe
-#[allow(unused)]
-fn spawn_exe(full_path: PathBuf, args: &[String]) -> Command {
- let mut process = Command::new(full_path);
- for arg in args {
- process.arg(&arg);
- }
- process
-}
-
-/// Spawn a cmd command with `cmd /c args...`
-fn spawn_cmd_command(command: &ExternalCommand, args: &[String]) -> Command {
- let mut process = Command::new("cmd");
- process.arg("/c");
- process.arg(&command.name);
- for arg in args {
- // Clean the args before we use them:
- // https://stackoverflow.com/questions/1200235/how-to-pass-a-quoted-pipe-character-to-cmd-exe
- // cmd.exe needs to have a caret to escape a pipe
- let arg = arg.replace("|", "^|");
- process.arg(&arg);
- }
- process
-}
-
-fn has_unsafe_shell_characters(arg: &str) -> bool {
- lazy_static! {
- static ref RE: Regex = Regex::new(r"[^\w@%+=:,./-]").expect("regex to be valid");
- }
-
- RE.is_match(arg)
-}
-
-fn shell_arg_escape(arg: &str) -> String {
- match arg {
- "" => String::from("''"),
- s if !has_unsafe_shell_characters(s) => String::from(s),
- _ => {
- let single_quotes_escaped = arg.split('\'').join("'\"'\"'");
- format!("'{}'", single_quotes_escaped)
- }
- }
-}
-
-/// Spawn a sh command with `sh -c args...`
-fn spawn_sh_command(command: &ExternalCommand, args: &[String]) -> Command {
- let joined_and_escaped_arguments = args.iter().map(|arg| shell_arg_escape(arg)).join(" ");
- let cmd_with_args = vec![command.name.clone(), joined_and_escaped_arguments].join(" ");
- let mut process = Command::new("sh");
- process.arg("-c").arg(cmd_with_args);
- process
-}
-
-/// a function to spawn any external command
-#[allow(unused)] // for minimal builds cwd is unused
-fn spawn_any(command: &ExternalCommand, args: &[String], cwd: &str) -> Command {
- // resolve the executable name if it is spawnable directly
- #[cfg(feature = "which")]
- // TODO add more available paths to `env::var_os("PATH")`?
- if let Result::Ok(full_path) = which_in(&command.name, env::var_os("PATH"), cwd) {
- if let Some(extension) = full_path.extension() {
- #[cfg(windows)]
- if extension.eq_ignore_ascii_case("exe") {
- // if exe spawn it directly
- return spawn_exe(full_path, args);
- } else {
- // TODO implement special care for various executable types such as .bat, .ps1, .cmd, etc
- // https://github.com/mklement0/Native/blob/e0e0b8785cad39a73053e35084d1f60d87fbac58/Native.psm1#L749
- // otherwise shell out to cmd
- return spawn_cmd_command(command, args);
- }
- #[cfg(not(windows))]
- if !["sh", "bash"]
- .iter()
- .any(|ext| extension.eq_ignore_ascii_case(ext))
- {
- // if exe spawn it directly
- return spawn_exe(full_path, args);
- } else {
- // otherwise shell out to sh
- return spawn_sh_command(command, args);
- }
- }
- }
- // in all the other cases shell out
- if cfg!(windows) {
- spawn_cmd_command(command, args)
- } else {
- // TODO what happens if that os doesn't support spawning sh?
- spawn_sh_command(command, args)
- }
-}
-
-fn spawn(
- command: &ExternalCommand,
- path: &str,
- args: &[String],
- input: InputStream,
- external_redirection: ExternalRedirection,
- scope: &Scope,
-) -> Result {
- let command = command.clone();
-
- let mut process = spawn_any(&command, args, path);
- process.current_dir(path);
- trace!(target: "nu::run::external", "cwd = {:?}", &path);
-
- process.env_clear();
- process.envs(scope.get_env_vars());
-
- // We want stdout regardless of what
- // we are doing ($it case or pipe stdin)
- match external_redirection {
- ExternalRedirection::Stdout => {
- process.stdout(Stdio::piped());
- trace!(target: "nu::run::external", "set up stdout pipe");
- }
- ExternalRedirection::Stderr => {
- process.stderr(Stdio::piped());
- trace!(target: "nu::run::external", "set up stderr pipe");
- }
- ExternalRedirection::StdoutAndStderr => {
- process.stdout(Stdio::piped());
- trace!(target: "nu::run::external", "set up stdout pipe");
- process.stderr(Stdio::piped());
- trace!(target: "nu::run::external", "set up stderr pipe");
- }
- _ => {}
- }
-
- // open since we have some contents for stdin
- if !input.is_empty() {
- process.stdin(Stdio::piped());
- trace!(target: "nu::run::external", "set up stdin pipe");
- }
-
- trace!(target: "nu::run::external", "built command {:?}", process);
-
- // TODO Switch to async_std::process once it's stabilized
- match process.spawn() {
- Ok(mut child) => {
- let (tx, rx) = mpsc::sync_channel(0);
-
- let mut stdin = child.stdin.take();
-
- let stdin_write_tx = tx.clone();
- let stdout_read_tx = tx;
- let stdin_name_tag = command.name_tag.clone();
- let stdout_name_tag = command.name_tag;
-
- std::thread::spawn(move || {
- if !input.is_empty() {
- let mut stdin_write = stdin
- .take()
- .expect("Internal error: could not get stdin pipe for external command");
-
- for value in input {
- match &value.value {
- UntaggedValue::Primitive(Primitive::Nothing) => continue,
- UntaggedValue::Primitive(Primitive::String(s)) => {
- if stdin_write.write(s.as_bytes()).is_err() {
- // Other side has closed, so exit
- return Ok(());
- }
- }
- UntaggedValue::Primitive(Primitive::Binary(b)) => {
- if stdin_write.write(b).is_err() {
- // Other side has closed, so exit
- return Ok(());
- }
- }
- unsupported => {
- println!("Unsupported: {:?}", unsupported);
- let _ = stdin_write_tx.send(Ok(Value {
- value: UntaggedValue::Error(ShellError::labeled_error(
- format!(
- "Received unexpected type from pipeline ({})",
- unsupported.type_name()
- ),
- format!(
- "expected a string, got {} as input",
- unsupported.type_name()
- ),
- stdin_name_tag.clone(),
- )),
- tag: stdin_name_tag,
- }));
- return Err(());
- }
- };
- }
- }
-
- Ok(())
- });
-
- std::thread::spawn(move || {
- if external_redirection == ExternalRedirection::Stdout
- || external_redirection == ExternalRedirection::StdoutAndStderr
- {
- let stdout = if let Some(stdout) = child.stdout.take() {
- stdout
- } else {
- let _ = stdout_read_tx.send(Ok(Value {
- value: UntaggedValue::Error(ShellError::labeled_error(
- "Can't redirect the stdout for external command",
- "can't redirect stdout",
- &stdout_name_tag,
- )),
- tag: stdout_name_tag,
- }));
- return Err(());
- };
-
- // let file = futures::io::AllowStdIo::new(stdout);
- // let stream = FramedRead::new(file, MaybeTextCodec::default());
- let buf_read = BufReader::new(stdout);
- let buf_codec = BufCodecReader::new(buf_read, MaybeTextCodec::default());
-
- for line in buf_codec {
- match line {
- Ok(line) => match line {
- StringOrBinary::String(s) => {
- let result = stdout_read_tx.send(Ok(Value {
- value: UntaggedValue::Primitive(Primitive::String(
- s.clone(),
- )),
- tag: stdout_name_tag.clone(),
- }));
-
- if result.is_err() {
- break;
- }
- }
- StringOrBinary::Binary(b) => {
- let result = stdout_read_tx.send(Ok(Value {
- value: UntaggedValue::Primitive(Primitive::Binary(
- b.into_iter().collect(),
- )),
- tag: stdout_name_tag.clone(),
- }));
-
- if result.is_err() {
- break;
- }
- }
- },
- Err(e) => {
- // If there's an exit status, it makes sense that we may error when
- // trying to read from its stdout pipe (likely been closed). In that
- // case, don't emit an error.
- let should_error = match child.wait() {
- Ok(exit_status) => !exit_status.success(),
- Err(_) => true,
- };
-
- if should_error {
- let _ = stdout_read_tx.send(Ok(Value {
- value: UntaggedValue::Error(ShellError::labeled_error(
- format!("Unable to read from stdout ({})", e),
- "unable to read from stdout",
- &stdout_name_tag,
- )),
- tag: stdout_name_tag.clone(),
- }));
- }
-
- return Ok(());
- }
- }
- }
- }
- if external_redirection == ExternalRedirection::Stderr
- || external_redirection == ExternalRedirection::StdoutAndStderr
- {
- let stderr = if let Some(stderr) = child.stderr.take() {
- stderr
- } else {
- let _ = stdout_read_tx.send(Ok(Value {
- value: UntaggedValue::Error(ShellError::labeled_error(
- "Can't redirect the stderr for external command",
- "can't redirect stderr",
- &stdout_name_tag,
- )),
- tag: stdout_name_tag,
- }));
- return Err(());
- };
-
- // let file = futures::io::AllowStdIo::new(stderr);
- // let stream = FramedRead::new(file, MaybeTextCodec::default());
- let buf_reader = BufReader::new(stderr);
- let buf_codec = BufCodecReader::new(buf_reader, MaybeTextCodec::default());
-
- for line in buf_codec {
- match line {
- Ok(line) => match line {
- StringOrBinary::String(s) => {
- let result = stdout_read_tx.send(Ok(Value {
- value: UntaggedValue::Error(
- ShellError::untagged_runtime_error(s),
- ),
- tag: stdout_name_tag.clone(),
- }));
-
- if result.is_err() {
- break;
- }
- }
- StringOrBinary::Binary(_) => {
- let result = stdout_read_tx.send(Ok(Value {
- value: UntaggedValue::Error(
- ShellError::untagged_runtime_error(""),
- ),
- tag: stdout_name_tag.clone(),
- }));
-
- if result.is_err() {
- break;
- }
- }
- },
- Err(e) => {
- // If there's an exit status, it makes sense that we may error when
- // trying to read from its stdout pipe (likely been closed). In that
- // case, don't emit an error.
- let should_error = match child.wait() {
- Ok(exit_status) => !exit_status.success(),
- Err(_) => true,
- };
-
- if should_error {
- let _ = stdout_read_tx.send(Ok(Value {
- value: UntaggedValue::Error(ShellError::labeled_error(
- format!("Unable to read from stdout ({})", e),
- "unable to read from stdout",
- &stdout_name_tag,
- )),
- tag: stdout_name_tag.clone(),
- }));
- }
-
- return Ok(());
- }
- }
- }
- }
-
- // We can give an error when we see a non-zero exit code, but this is different
- // than what other shells will do.
- let external_failed = match child.wait() {
- Err(_) => true,
- Ok(exit_status) => !exit_status.success(),
- };
-
- if external_failed {
- let cfg = nu_data::config::config(Tag::unknown());
- if let Ok(cfg) = cfg {
- if cfg.contains_key("nonzero_exit_errors") {
- let _ = stdout_read_tx.send(Ok(Value {
- value: UntaggedValue::Error(ShellError::labeled_error(
- "External command failed",
- "command failed",
- &stdout_name_tag,
- )),
- tag: stdout_name_tag.clone(),
- }));
- }
- }
- let _ = stdout_read_tx.send(Ok(Value {
- value: UntaggedValue::nothing(),
- tag: stdout_name_tag,
- }));
- }
-
- Ok(())
- });
-
- let stream = ChannelReceiver::new(rx);
- Ok(stream.into_input_stream())
- }
- Err(e) => Err(ShellError::labeled_error(
- e.to_string(),
- "failed to spawn",
- &command.name_tag,
- )),
- }
-}
-
-struct ChannelReceiver {
- rx: Arc>>>,
-}
-
-impl ChannelReceiver {
- pub fn new(rx: mpsc::Receiver>) -> Self {
- Self {
- rx: Arc::new(Mutex::new(rx)),
- }
- }
-}
-
-impl Iterator for ChannelReceiver {
- type Item = Result;
-
- fn next(&mut self) -> Option {
- let rx = self.rx.lock();
- match rx.recv() {
- Ok(v) => Some(v),
- Err(_) => None,
- }
- }
-}
-
-fn argument_is_quoted(argument: &str) -> bool {
- if argument.len() < 2 {
- return false;
- }
-
- (argument.starts_with('"') && argument.ends_with('"'))
- || (argument.starts_with('\'') && argument.ends_with('\''))
-}
-
-#[allow(unused)]
-fn add_double_quotes(argument: &str) -> String {
- format!("\"{}\"", argument)
-}
-
-#[allow(unused)]
-fn escape_double_quotes(argument: &str) -> Cow<'_, str> {
- // allocate new string only if required
- if argument.contains('"') {
- Cow::Owned(argument.replace('"', r#"\""#))
- } else {
- Cow::Borrowed(argument)
- }
-}
-
-#[allow(unused)]
-fn remove_quotes(argument: &str) -> Option<&str> {
- if !argument_is_quoted(argument) {
- return None;
- }
-
- let size = argument.len();
-
- Some(&argument[1..size - 1])
-}
-
-#[allow(unused)]
-fn shell_os_paths() -> Vec {
- let mut original_paths = vec![];
-
- if let Some(paths) = std::env::var_os(NATIVE_PATH_ENV_VAR) {
- original_paths = std::env::split_paths(&paths).collect::>();
- }
-
- original_paths
-}
-
-#[cfg(test)]
-mod tests {
- use super::{add_double_quotes, argument_is_quoted, escape_double_quotes, remove_quotes};
- #[cfg(feature = "which")]
- use super::{run_external_command, InputStream};
-
- #[cfg(feature = "which")]
- use nu_engine::EvaluationContext;
-
- #[cfg(feature = "which")]
- use nu_test_support::commands::ExternalBuilder;
- // fn read(mut stream: OutputStream) -> Option {
- // match stream.try_next() {
- // Ok(val) => {
- // if let Some(val) = val {
- // val.raw_value()
- // } else {
- // None
- // }
- // }
- // Err(_) => None,
- // }
- // }
-
- #[cfg(feature = "which")]
- fn non_existent_run() {
- use nu_protocol::hir::ExternalRedirection;
- let cmd = ExternalBuilder::for_name("i_dont_exist.exe").build();
-
- let input = InputStream::empty();
- let mut ctx = EvaluationContext::basic();
-
- assert!(run_external_command(cmd, &mut ctx, input, ExternalRedirection::Stdout).is_err());
- }
-
- // fn failure_run() -> Result<(), ShellError> {
- // let cmd = ExternalBuilder::for_name("fail").build();
-
- // let mut ctx = crate::cli::EvaluationContext::basic().expect("There was a problem creating a basic context.");
- // let stream = run_external_command(cmd, &mut ctx, None, false)
- // ?
- // .expect("There was a problem running the external command.");
-
- // match read(stream.into()) {
- // Some(Value {
- // value: UntaggedValue::Error(_),
- // ..
- // }) => {}
- // None | _ => panic!("Command didn't fail."),
- // }
-
- // Ok(())
- // }
-
- // #[test]
- // fn identifies_command_failed() -> Result<(), ShellError> {
- // block_on(failure_run())
- // }
-
- #[cfg(feature = "which")]
- #[test]
- fn identifies_command_not_found() {
- non_existent_run()
- }
-
- #[test]
- fn checks_escape_double_quotes() {
- assert_eq!(escape_double_quotes("andrés"), "andrés");
- assert_eq!(escape_double_quotes(r#"an"drés"#), r#"an\"drés"#);
- assert_eq!(escape_double_quotes(r#""an"drés""#), r#"\"an\"drés\""#);
- }
-
- #[test]
- fn checks_quotes_from_argument_to_be_passed_in() {
- assert!(!argument_is_quoted(""));
-
- assert!(!argument_is_quoted("'"));
- assert!(!argument_is_quoted("'a"));
- assert!(!argument_is_quoted("a"));
- assert!(!argument_is_quoted("a'"));
- assert!(argument_is_quoted("''"));
-
- assert!(!argument_is_quoted(r#"""#));
- assert!(!argument_is_quoted(r#""a"#));
- assert!(!argument_is_quoted(r#"a"#));
- assert!(!argument_is_quoted(r#"a""#));
- assert!(argument_is_quoted(r#""""#));
-
- assert!(!argument_is_quoted("'andrés"));
- assert!(!argument_is_quoted("andrés'"));
- assert!(!argument_is_quoted(r#""andrés"#));
- assert!(!argument_is_quoted(r#"andrés""#));
- assert!(argument_is_quoted("'andrés'"));
- assert!(argument_is_quoted(r#""andrés""#));
- }
-
- #[test]
- fn adds_double_quotes_to_argument_to_be_passed_in() {
- assert_eq!(add_double_quotes("andrés"), "\"andrés\"");
- }
-
- #[test]
- fn strips_quotes_from_argument_to_be_passed_in() {
- assert_eq!(remove_quotes(""), None);
-
- assert_eq!(remove_quotes("'"), None);
- assert_eq!(remove_quotes("'a"), None);
- assert_eq!(remove_quotes("a"), None);
- assert_eq!(remove_quotes("a'"), None);
- assert_eq!(remove_quotes("''"), Some(""));
-
- assert_eq!(remove_quotes(r#"""#), None);
- assert_eq!(remove_quotes(r#""a"#), None);
- assert_eq!(remove_quotes(r#"a"#), None);
- assert_eq!(remove_quotes(r#"a""#), None);
- assert_eq!(remove_quotes(r#""""#), Some(""));
-
- assert_eq!(remove_quotes("'andrés"), None);
- assert_eq!(remove_quotes("andrés'"), None);
- assert_eq!(remove_quotes(r#""andrés"#), None);
- assert_eq!(remove_quotes(r#"andrés""#), None);
- assert_eq!(remove_quotes("'andrés'"), Some("andrés"));
- assert_eq!(remove_quotes(r#""andrés""#), Some("andrés"));
- }
-}
diff --git a/old_nushell/crates/nu-command/src/classified/mod.rs b/old_nushell/crates/nu-command/src/classified/mod.rs
deleted file mode 100644
index 04016e9e7..000000000
--- a/old_nushell/crates/nu-command/src/classified/mod.rs
+++ /dev/null
@@ -1 +0,0 @@
-pub(crate) mod external;
diff --git a/old_nushell/crates/nu-command/src/commands/charting/chart.rs b/old_nushell/crates/nu-command/src/commands/charting/chart.rs
deleted file mode 100644
index edc6f59f5..000000000
--- a/old_nushell/crates/nu-command/src/commands/charting/chart.rs
+++ /dev/null
@@ -1,46 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{ReturnSuccess, Signature, UntaggedValue};
-
-#[derive(Clone)]
-pub struct Chart;
-
-impl WholeStreamCommand for Chart {
- fn name(&self) -> &str {
- "chart"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("chart")
- }
-
- fn usage(&self) -> &str {
- "Displays charts."
- }
-
- fn run_with_actions(&self, args: CommandArgs) -> Result {
- if args.scope().get_command("chart bar").is_none() {
- return Err(ShellError::untagged_runtime_error(
- "nu_plugin_chart not installed.",
- ));
- }
-
- Ok(ActionStream::one(Ok(ReturnSuccess::Value(
- UntaggedValue::string(get_full_help(&Chart, args.scope())).into_value(Tag::unknown()),
- ))))
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::Chart;
- use super::ShellError;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(Chart {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/charting/histogram.rs b/old_nushell/crates/nu-command/src/commands/charting/histogram.rs
deleted file mode 100644
index 4fcf6aa57..000000000
--- a/old_nushell/crates/nu-command/src/commands/charting/histogram.rs
+++ /dev/null
@@ -1,220 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{
- ColumnPath, ReturnSuccess, Signature, SyntaxShape, TaggedDictBuilder, UntaggedValue, Value,
-};
-use nu_source::Tagged;
-
-pub struct Histogram;
-
-impl WholeStreamCommand for Histogram {
- fn name(&self) -> &str {
- "histogram"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("histogram")
- .named(
- "use",
- SyntaxShape::ColumnPath,
- "Use data at the column path given as valuator",
- None,
- )
- .rest(
- "rest",
- SyntaxShape::ColumnPath,
- "column name to give the histogram's frequency column",
- )
- }
-
- fn usage(&self) -> &str {
- "Creates a new table with a histogram based on the column name passed in."
- }
-
- fn run_with_actions(&self, args: CommandArgs) -> Result {
- histogram(args)
- }
-
- fn examples(&self) -> Vec {
- vec![
- Example {
- description: "Get a histogram for the types of files",
- example: "ls | histogram type",
- result: None,
- },
- Example {
- description:
- "Get a histogram for the types of files, with frequency column named percentage",
- example: "ls | histogram type percentage",
- result: None,
- },
- Example {
- description: "Get a histogram for a list of numbers",
- example: "echo [1 2 3 1 1 1 2 2 1 1] | histogram",
- result: None,
- },
- ]
- }
-}
-
-pub fn histogram(args: CommandArgs) -> Result {
- let name = args.call_info.name_tag.clone();
-
- let mut columns = args.rest::(0)?;
- let evaluate_with = args.get_flag::("use")?.map(evaluator);
- let values: Vec = args.input.collect();
-
- let column_grouper = if !columns.is_empty() {
- columns
- .remove(0)
- .split_last()
- .map(|(key, _)| key.as_string().tagged(&name))
- } else {
- None
- };
-
- let frequency_column_name = if columns.is_empty() {
- "frequency".to_string()
- } else if let Some((key, _)) = columns[0].split_last() {
- key.as_string()
- } else {
- "frequency".to_string()
- };
-
- let column = if let Some(ref column) = column_grouper {
- column.clone()
- } else {
- "value".to_string().tagged(&name)
- };
-
- let results = nu_data::utils::report(
- &UntaggedValue::table(&values).into_value(&name),
- nu_data::utils::Operation {
- grouper: Some(Box::new(move |_, _| Ok(String::from("frequencies")))),
- splitter: Some(splitter(column_grouper)),
- format: &None,
- eval: &evaluate_with,
- reduction: &nu_data::utils::Reduction::Count,
- },
- &name,
- )?;
-
- let labels = results.labels.y.clone();
- let mut idx = 0;
-
- Ok(results
- .data
- .table_entries()
- .cloned()
- .collect::>()
- .into_iter()
- .zip(
- results
- .percentages
- .table_entries()
- .cloned()
- .collect::>()
- .into_iter(),
- )
- .map(move |(counts, percentages)| {
- let percentage = percentages
- .table_entries()
- .cloned()
- .last()
- .unwrap_or_else(|| {
- UntaggedValue::decimal_from_float(0.0, name.span).into_value(&name)
- });
- let value = counts
- .table_entries()
- .cloned()
- .last()
- .unwrap_or_else(|| UntaggedValue::int(0).into_value(&name));
-
- let mut fact = TaggedDictBuilder::new(&name);
- let column_value = labels
- .get(idx)
- .ok_or_else(|| {
- ShellError::labeled_error(
- "Unable to load group labels",
- "unable to load group labels",
- &name,
- )
- })?
- .clone();
-
- fact.insert_value(&column.item, column_value);
- fact.insert_untagged("count", value);
-
- let fmt_percentage = format!(
- "{}%",
- // Some(2) < the number of digits
- // true < group the digits
- crate::commands::conversions::into::string::action(
- &percentage,
- &name,
- Some(2),
- true
- )?
- .as_string()?
- );
- fact.insert_untagged("percentage", UntaggedValue::string(fmt_percentage));
-
- let string = "*".repeat(percentage.as_u64().map_err(|_| {
- ShellError::labeled_error("expected a number", "expected a number", &name)
- })? as usize);
-
- fact.insert_untagged(&frequency_column_name, UntaggedValue::string(string));
-
- idx += 1;
-
- ReturnSuccess::value(fact.into_value())
- })
- .into_action_stream())
-}
-
-fn evaluator(by: ColumnPath) -> Box Result + Send> {
- Box::new(move |_: usize, value: &Value| {
- let path = by.clone();
-
- let eval = nu_value_ext::get_data_by_column_path(value, &path, move |_, _, error| error);
-
- match eval {
- Ok(with_value) => Ok(with_value),
- Err(reason) => Err(reason),
- }
- })
-}
-
-fn splitter(
- by: Option>,
-) -> Box Result + Send> {
- match by {
- Some(column) => Box::new(move |_, row: &Value| {
- let key = &column;
-
- match row.get_data_by_key(key.borrow_spanned()) {
- Some(key) => nu_value_ext::as_string(&key),
- None => Err(ShellError::labeled_error(
- "unknown column",
- "unknown column",
- key.tag(),
- )),
- }
- }),
- None => Box::new(move |_, row: &Value| nu_value_ext::as_string(row)),
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::Histogram;
- use super::ShellError;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(Histogram {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/charting/mod.rs b/old_nushell/crates/nu-command/src/commands/charting/mod.rs
deleted file mode 100644
index a69047517..000000000
--- a/old_nushell/crates/nu-command/src/commands/charting/mod.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-mod chart;
-mod histogram;
-
-pub use chart::Chart;
-pub use histogram::Histogram;
diff --git a/old_nushell/crates/nu-command/src/commands/config/clear.rs b/old_nushell/crates/nu-command/src/commands/config/clear.rs
deleted file mode 100644
index 0aa8593df..000000000
--- a/old_nushell/crates/nu-command/src/commands/config/clear.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{Signature, UntaggedValue};
-
-pub struct SubCommand;
-
-impl WholeStreamCommand for SubCommand {
- fn name(&self) -> &str {
- "config clear"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("config clear")
- }
-
- fn usage(&self) -> &str {
- "clear the config"
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- clear(args)
- }
-
- fn examples(&self) -> Vec {
- vec![Example {
- description: "Clear the config (be careful!)",
- example: "config clear",
- result: None,
- }]
- }
-}
-
-pub fn clear(args: CommandArgs) -> Result {
- let name = args.call_info.name_tag.clone();
- let ctx = &args.context;
-
- let result = if let Some(global_cfg) = &mut args.configs().lock().global_config {
- global_cfg.vars.clear();
- global_cfg.write()?;
- ctx.reload_config(global_cfg)?;
-
- let value = UntaggedValue::Row(global_cfg.vars.clone().into()).into_value(name);
- Ok(OutputStream::one(value))
- } else {
- let value = UntaggedValue::Error(crate::commands::config::err_no_global_cfg_present())
- .into_value(name);
-
- Ok(OutputStream::one(value))
- };
-
- result
-}
diff --git a/old_nushell/crates/nu-command/src/commands/config/command.rs b/old_nushell/crates/nu-command/src/commands/config/command.rs
deleted file mode 100644
index f0faea14b..000000000
--- a/old_nushell/crates/nu-command/src/commands/config/command.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-use crate::prelude::*;
-use nu_engine::CommandArgs;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{Signature, UntaggedValue};
-
-pub struct Command;
-
-impl WholeStreamCommand for Command {
- fn name(&self) -> &str {
- "config"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("config")
- }
-
- fn usage(&self) -> &str {
- "Configuration management."
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- let name = args.call_info.name_tag.clone();
-
- if let Some(global_cfg) = &args.configs().lock().global_config {
- let result = global_cfg.vars.clone();
- let value = UntaggedValue::Row(result.into()).into_value(name);
-
- Ok(OutputStream::one(value))
- } else {
- let value = UntaggedValue::Error(crate::commands::config::err_no_global_cfg_present())
- .into_value(name);
-
- Ok(OutputStream::one(value))
- }
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/config/get.rs b/old_nushell/crates/nu-command/src/commands/config/get.rs
deleted file mode 100644
index fac8e110e..000000000
--- a/old_nushell/crates/nu-command/src/commands/config/get.rs
+++ /dev/null
@@ -1,62 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{Signature, SyntaxShape, UntaggedValue, Value};
-
-pub struct SubCommand;
-
-impl WholeStreamCommand for SubCommand {
- fn name(&self) -> &str {
- "config get"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("config get").required(
- "get",
- SyntaxShape::ColumnPath,
- "value to get from the config",
- )
- }
-
- fn usage(&self) -> &str {
- "Gets a value from the config"
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- get(args)
- }
-
- fn examples(&self) -> Vec {
- vec![Example {
- description: "Get the current startup commands",
- example: "config get startup",
- result: None,
- }]
- }
-}
-
-pub fn get(args: CommandArgs) -> Result {
- let name = args.call_info.name_tag.clone();
- let ctx = &args.context;
-
- let column_path = args.req(0)?;
-
- let result = if let Some(global_cfg) = &ctx.configs().lock().global_config {
- let result = UntaggedValue::row(global_cfg.vars.clone()).into_value(&name);
- let value = crate::commands::filters::get::get_column_path(&column_path, &result)?;
- Ok(match value {
- Value {
- value: UntaggedValue::Table(list),
- ..
- } => OutputStream::from_stream(list.into_iter()),
- x => OutputStream::one(x),
- })
- } else {
- let value = UntaggedValue::Error(crate::commands::config::err_no_global_cfg_present())
- .into_value(name);
-
- Ok(OutputStream::one(value))
- };
-
- result
-}
diff --git a/old_nushell/crates/nu-command/src/commands/config/mod.rs b/old_nushell/crates/nu-command/src/commands/config/mod.rs
deleted file mode 100644
index 62f626cf8..000000000
--- a/old_nushell/crates/nu-command/src/commands/config/mod.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-pub mod clear;
-pub mod command;
-pub mod get;
-pub mod path;
-pub mod remove;
-pub mod set;
-pub mod set_into;
-
-pub use clear::SubCommand as ConfigClear;
-pub use command::Command as Config;
-pub use get::SubCommand as ConfigGet;
-pub use path::SubCommand as ConfigPath;
-pub use remove::SubCommand as ConfigRemove;
-pub use set::SubCommand as ConfigSet;
-pub use set_into::SubCommand as ConfigSetInto;
-
-use nu_errors::ShellError;
-
-pub fn err_no_global_cfg_present() -> ShellError {
- ShellError::untagged_runtime_error("No global config found!")
-}
diff --git a/old_nushell/crates/nu-command/src/commands/config/path.rs b/old_nushell/crates/nu-command/src/commands/config/path.rs
deleted file mode 100644
index 4e32596cc..000000000
--- a/old_nushell/crates/nu-command/src/commands/config/path.rs
+++ /dev/null
@@ -1,48 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{Primitive, Signature, UntaggedValue};
-
-pub struct SubCommand;
-
-impl WholeStreamCommand for SubCommand {
- fn name(&self) -> &str {
- "config path"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("config path")
- }
-
- fn usage(&self) -> &str {
- "return the path to the config file"
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- path(args)
- }
-
- fn examples(&self) -> Vec {
- vec![Example {
- description: "Get the path to the current config file",
- example: "config path",
- result: None,
- }]
- }
-}
-
-pub fn path(args: CommandArgs) -> Result {
- let name = args.call_info.name_tag.clone();
-
- if let Some(global_cfg) = &mut args.configs().lock().global_config {
- let value = UntaggedValue::Primitive(Primitive::FilePath(global_cfg.file_path.clone()))
- .into_value(name);
-
- Ok(OutputStream::one(value))
- } else {
- let value = UntaggedValue::Error(crate::commands::config::err_no_global_cfg_present())
- .into_value(name);
-
- Ok(OutputStream::one(value))
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/config/remove.rs b/old_nushell/crates/nu-command/src/commands/config/remove.rs
deleted file mode 100644
index d71ecc5c1..000000000
--- a/old_nushell/crates/nu-command/src/commands/config/remove.rs
+++ /dev/null
@@ -1,70 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{Signature, SyntaxShape, UntaggedValue, Value};
-use nu_source::Tagged;
-
-pub struct SubCommand;
-
-impl WholeStreamCommand for SubCommand {
- fn name(&self) -> &str {
- "config remove"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("config remove").required(
- "remove",
- SyntaxShape::Any,
- "remove a value from the config",
- )
- }
-
- fn usage(&self) -> &str {
- "Removes a value from the config"
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- remove(args)
- }
-
- fn examples(&self) -> Vec {
- vec![Example {
- description: "Remove the startup commands",
- example: "config remove startup",
- result: None,
- }]
- }
-}
-
-pub fn remove(args: CommandArgs) -> Result {
- let name = args.call_info.name_tag.clone();
- let ctx = &args.context;
- let remove: Tagged = args.req(0)?;
-
- let key = remove.to_string();
-
- let result = if let Some(global_cfg) = &mut ctx.configs().lock().global_config {
- if global_cfg.vars.contains_key(&key) {
- global_cfg.vars.swap_remove(&key);
- global_cfg.write()?;
- ctx.reload_config(global_cfg)?;
-
- let value: Value = UntaggedValue::row(global_cfg.vars.clone()).into_value(remove.tag);
-
- Ok(OutputStream::one(value))
- } else {
- Err(ShellError::labeled_error(
- "Key does not exist in config",
- "key",
- remove.tag(),
- ))
- }
- } else {
- let value = UntaggedValue::Error(crate::commands::config::err_no_global_cfg_present())
- .into_value(name);
-
- Ok(OutputStream::one(value))
- };
-
- result
-}
diff --git a/old_nushell/crates/nu-command/src/commands/config/set.rs b/old_nushell/crates/nu-command/src/commands/config/set.rs
deleted file mode 100644
index b6bd986e4..000000000
--- a/old_nushell/crates/nu-command/src/commands/config/set.rs
+++ /dev/null
@@ -1,92 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{Signature, SyntaxShape, UntaggedValue, Value};
-
-pub struct SubCommand;
-
-impl WholeStreamCommand for SubCommand {
- fn name(&self) -> &str {
- "config set"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("config set")
- .required("key", SyntaxShape::ColumnPath, "variable name to set")
- .required("value", SyntaxShape::Any, "value to use")
- }
-
- fn usage(&self) -> &str {
- "Sets a value in the config"
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- set(args)
- }
-
- fn examples(&self) -> Vec {
- vec![
- Example {
- description: "Set auto pivoting",
- example: "config set pivot_mode always",
- result: None,
- },
- Example {
- description: "Set line editor options",
- example: "config set line_editor [[edit_mode, completion_type]; [emacs circular]]",
- result: None,
- },
- Example {
- description: "Set coloring options",
- example: "config set color_config [[header_align header_color]; [left white_bold]]",
- result: None,
- },
- Example {
- description: "Set nested options",
- example: "config set color_config.header_color white",
- result: None,
- },
- ]
- }
-}
-
-pub fn set(args: CommandArgs) -> Result {
- let name = args.call_info.name_tag.clone();
- let ctx = &args.context;
-
- let column_path = args.req(0)?;
- let mut value: Value = args.req(1)?;
-
- let result = if let Some(global_cfg) = &mut ctx.configs().lock().global_config {
- let configuration = UntaggedValue::row(global_cfg.vars.clone()).into_value(&name);
-
- if let UntaggedValue::Table(rows) = &value.value {
- if rows.len() == 1 && rows[0].is_row() {
- value = rows[0].clone();
- }
- }
-
- match configuration.forgiving_insert_data_at_column_path(&column_path, value) {
- Ok(Value {
- value: UntaggedValue::Row(changes),
- ..
- }) => {
- global_cfg.vars = changes.entries;
- global_cfg.write()?;
- ctx.reload_config(global_cfg)?;
-
- let value = UntaggedValue::row(global_cfg.vars.clone()).into_value(name);
- Ok(OutputStream::one(value))
- }
- Ok(_) => Ok(OutputStream::empty()),
- Err(reason) => Err(reason),
- }
- } else {
- let value = UntaggedValue::Error(crate::commands::config::err_no_global_cfg_present())
- .into_value(name);
-
- Ok(OutputStream::one(value))
- };
-
- result
-}
diff --git a/old_nushell/crates/nu-command/src/commands/config/set_into.rs b/old_nushell/crates/nu-command/src/commands/config/set_into.rs
deleted file mode 100644
index f49ae71ab..000000000
--- a/old_nushell/crates/nu-command/src/commands/config/set_into.rs
+++ /dev/null
@@ -1,81 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{Signature, SyntaxShape, UntaggedValue, Value};
-use nu_source::Tagged;
-
-pub struct SubCommand;
-
-impl WholeStreamCommand for SubCommand {
- fn name(&self) -> &str {
- "config set_into"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("config set_into").required(
- "set_into",
- SyntaxShape::String,
- "sets a variable from values in the pipeline",
- )
- }
-
- fn usage(&self) -> &str {
- "Sets a value in the config"
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- set_into(args)
- }
-
- fn examples(&self) -> Vec {
- vec![Example {
- description: "Store the contents of the pipeline as a path",
- example: "echo ['/usr/bin' '/bin'] | config set_into path",
- result: None,
- }]
- }
-}
-
-pub fn set_into(args: CommandArgs) -> Result {
- let name = args.call_info.name_tag.clone();
- let ctx = &args.context;
-
- let set_into: Tagged = args.req(0)?;
-
- let rows: Vec = args.input.collect();
- let key = set_into.to_string();
-
- let result = if let Some(global_cfg) = &mut ctx.configs().lock().global_config {
- if rows.is_empty() {
- return Err(ShellError::labeled_error(
- "No values given for set_into",
- "needs value(s) from pipeline",
- set_into.tag(),
- ));
- } else if rows.len() == 1 {
- // A single value
- let value = &rows[0];
-
- global_cfg.vars.insert(key, value.clone());
- } else {
- // Take in the pipeline as a table
- let value = UntaggedValue::Table(rows).into_value(name.clone());
-
- global_cfg.vars.insert(key, value);
- }
-
- global_cfg.write()?;
- ctx.reload_config(global_cfg)?;
-
- let value = UntaggedValue::row(global_cfg.vars.clone()).into_value(name);
-
- Ok(OutputStream::one(value))
- } else {
- let value = UntaggedValue::Error(crate::commands::config::err_no_global_cfg_present())
- .into_value(name);
-
- Ok(OutputStream::one(value))
- };
-
- result
-}
diff --git a/old_nushell/crates/nu-command/src/commands/conversions/into/binary.rs b/old_nushell/crates/nu-command/src/commands/conversions/into/binary.rs
deleted file mode 100644
index 59aa35bbd..000000000
--- a/old_nushell/crates/nu-command/src/commands/conversions/into/binary.rs
+++ /dev/null
@@ -1,185 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{ColumnPath, Primitive, Signature, SyntaxShape, UntaggedValue, Value};
-use num_bigint::{BigInt, ToBigInt};
-
-pub struct SubCommand;
-
-impl WholeStreamCommand for SubCommand {
- fn name(&self) -> &str {
- "into binary"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("into binary").rest(
- "rest",
- SyntaxShape::ColumnPath,
- "column paths to convert to binary (for table input)",
- )
- }
-
- fn usage(&self) -> &str {
- "Convert value to a binary primitive"
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- into_binary(args)
- }
-
- fn examples(&self) -> Vec {
- vec![
- Example {
- description: "convert string to a nushell binary primitive",
- example:
- "echo 'This is a string that is exactly 52 characters long.' | into binary",
- result: Some(vec![UntaggedValue::binary(
- "This is a string that is exactly 52 characters long."
- .to_string()
- .as_bytes()
- .to_vec(),
- )
- .into()]),
- },
- Example {
- description: "convert a number to a nushell binary primitive",
- example: "echo 1 | into binary",
- result: Some(vec![UntaggedValue::binary(
- i64::from(1).to_le_bytes().to_vec(),
- )
- .into()]),
- },
- Example {
- description: "convert a boolean to a nushell binary primitive",
- example: "echo $true | into binary",
- result: Some(vec![UntaggedValue::binary(
- i64::from(1).to_le_bytes().to_vec(),
- )
- .into()]),
- },
- Example {
- description: "convert a filesize to a nushell binary primitive",
- example: "ls | where name == LICENSE | get size | into binary",
- result: None,
- },
- Example {
- description: "convert a filepath to a nushell binary primitive",
- example: "ls | where name == LICENSE | get name | path expand | into binary",
- result: None,
- },
- Example {
- description: "convert a decimal to a nushell binary primitive",
- example: "echo 1.234 | into binary",
- result: Some(vec![
- UntaggedValue::binary(BigInt::from(1).to_bytes_le().1).into()
- ]),
- },
- ]
- }
-}
-
-fn into_binary(args: CommandArgs) -> Result {
- let column_paths: Vec = args.rest(0)?;
-
- Ok(args
- .input
- .map(move |v| {
- if column_paths.is_empty() {
- action(&v, v.tag())
- } else {
- let mut ret = v;
- for path in &column_paths {
- ret = ret.swap_data_by_column_path(
- path,
- Box::new(move |old| action(old, old.tag())),
- )?;
- }
-
- Ok(ret)
- }
- })
- .into_input_stream())
-}
-
-fn int_to_endian(n: i64) -> Vec {
- if cfg!(target_endian = "little") {
- n.to_le_bytes().to_vec()
- } else {
- n.to_be_bytes().to_vec()
- }
-}
-
-fn bigint_to_endian(n: &BigInt) -> Vec {
- if cfg!(target_endian = "little") {
- n.to_bytes_le().1
- } else {
- n.to_bytes_be().1
- }
-}
-
-pub fn action(input: &Value, tag: impl Into) -> Result {
- let tag = tag.into();
-
- match &input.value {
- UntaggedValue::Primitive(prim) => Ok(UntaggedValue::binary(match prim {
- Primitive::Binary(b) => b.to_vec(),
- Primitive::Int(n_ref) => int_to_endian(*n_ref),
- Primitive::BigInt(n_ref) => bigint_to_endian(n_ref),
- Primitive::Decimal(dec) => match dec.to_bigint() {
- Some(n) => bigint_to_endian(&n),
- None => {
- return Err(ShellError::unimplemented(
- "failed to convert decimal to int",
- ));
- }
- },
- Primitive::Filesize(a_filesize) => match a_filesize.to_bigint() {
- Some(n) => bigint_to_endian(&n),
- None => {
- return Err(ShellError::unimplemented(
- "failed to convert filesize to bigint",
- ));
- }
- },
- Primitive::String(a_string) => a_string.as_bytes().to_vec(),
- Primitive::Boolean(a_bool) => match a_bool {
- false => int_to_endian(0),
- true => int_to_endian(1),
- },
- Primitive::Date(a_date) => a_date.format("%c").to_string().as_bytes().to_vec(),
- Primitive::FilePath(a_filepath) => a_filepath
- .as_path()
- .display()
- .to_string()
- .as_bytes()
- .to_vec(),
- _ => {
- return Err(ShellError::unimplemented(
- "'into binary' for non-numeric primitives",
- ))
- }
- })
- .into_value(&tag)),
- UntaggedValue::Row(_) => Err(ShellError::labeled_error(
- "specify column name to use, with 'into binary COLUMN'",
- "found table",
- tag,
- )),
- _ => Err(ShellError::unimplemented(
- "'into binary' for unsupported type",
- )),
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::ShellError;
- use super::SubCommand;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(SubCommand {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/conversions/into/column_path.rs b/old_nushell/crates/nu-command/src/commands/conversions/into/column_path.rs
deleted file mode 100644
index 141bb68c4..000000000
--- a/old_nushell/crates/nu-command/src/commands/conversions/into/column_path.rs
+++ /dev/null
@@ -1,118 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{ColumnPath, Primitive, Signature, SyntaxShape, UntaggedValue, Value};
-
-pub struct SubCommand;
-
-impl WholeStreamCommand for SubCommand {
- fn name(&self) -> &str {
- "into column-path"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("into column-path").rest(
- "rest",
- SyntaxShape::ColumnPath,
- "values to convert to column path",
- )
- }
-
- fn usage(&self) -> &str {
- "Convert value to column path"
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- into_filepath(args)
- }
-
- fn examples(&self) -> Vec {
- vec![
- Example {
- description: "Convert string to column path in table",
- example: "echo [[name]; ['/dev/null'] ['C:\\Program Files'] ['../../Cargo.toml']] | into column-path name",
- result: Some(vec![
- UntaggedValue::row(indexmap! {
- "name".to_string() => UntaggedValue::column_path("/dev/null", Span::unknown()).into(),
- })
- .into(),
- UntaggedValue::row(indexmap! {
- "name".to_string() => UntaggedValue::column_path("C:\\Program Files", Span::unknown()).into(),
- })
- .into(),
- UntaggedValue::row(indexmap! {
- "name".to_string() => UntaggedValue::column_path("../../Cargo.toml", Span::unknown()).into(),
- })
- .into(),
- ]),
- },
- Example {
- description: "Convert string to column path",
- example: "echo 'Cargo.toml' | into column-path",
- result: Some(vec![UntaggedValue::column_path("Cargo.toml", Span::unknown()).into()]),
- },
- ]
- }
-}
-
-fn into_filepath(args: CommandArgs) -> Result {
- let column_paths: Vec = args.rest(0)?;
-
- Ok(args
- .input
- .map(move |v| {
- if column_paths.is_empty() {
- action(&v, v.tag())
- } else {
- let mut ret = v;
- for path in &column_paths {
- ret = ret.swap_data_by_column_path(
- path,
- Box::new(move |old| action(old, old.tag())),
- )?;
- }
-
- Ok(ret)
- }
- })
- .into_input_stream())
-}
-
-pub fn action(input: &Value, tag: impl Into) -> Result {
- let tag = tag.into();
- match &input.value {
- UntaggedValue::Primitive(prim) => Ok(UntaggedValue::column_path(
- match prim {
- Primitive::String(a_string) => a_string,
- _ => {
- return Err(ShellError::unimplemented(
- "'into column-path' for non-string primitives",
- ))
- }
- },
- Span::unknown(),
- )
- .into_value(&tag)),
- UntaggedValue::Row(_) => Err(ShellError::labeled_error(
- "specify column name to use, with 'into column-path COLUMN'",
- "found table",
- tag,
- )),
- _ => Err(ShellError::unimplemented(
- "'into column-path' for unsupported type",
- )),
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::ShellError;
- use super::SubCommand;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(SubCommand {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/conversions/into/command.rs b/old_nushell/crates/nu-command/src/commands/conversions/into/command.rs
deleted file mode 100644
index 3ae2ff897..000000000
--- a/old_nushell/crates/nu-command/src/commands/conversions/into/command.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{Signature, UntaggedValue};
-
-pub struct Command;
-
-impl WholeStreamCommand for Command {
- fn name(&self) -> &str {
- "into"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("into")
- }
-
- fn usage(&self) -> &str {
- "Apply into function."
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- Ok(OutputStream::one(
- UntaggedValue::string(get_full_help(&Command, args.scope())).into_value(Tag::unknown()),
- ))
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::Command;
- use super::ShellError;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(Command {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/conversions/into/filepath.rs b/old_nushell/crates/nu-command/src/commands/conversions/into/filepath.rs
deleted file mode 100644
index 08e7fff1c..000000000
--- a/old_nushell/crates/nu-command/src/commands/conversions/into/filepath.rs
+++ /dev/null
@@ -1,127 +0,0 @@
-use std::path::PathBuf;
-
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{ColumnPath, Primitive, Signature, SyntaxShape, UntaggedValue, Value};
-
-pub struct SubCommand;
-
-impl WholeStreamCommand for SubCommand {
- fn name(&self) -> &str {
- "into path"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("into path").rest(
- "rest",
- SyntaxShape::ColumnPath,
- "column paths to convert to filepath (for table input)",
- )
- }
-
- fn usage(&self) -> &str {
- "Convert value to filepath"
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- into_filepath(args)
- }
-
- fn examples(&self) -> Vec {
- vec![
- Example {
- description: "Convert string to filepath in table",
- example: "echo [[name]; ['/dev/null'] ['C:\\Program Files'] ['../../Cargo.toml']] | into path name",
- result: Some(vec![
- UntaggedValue::row(indexmap! {
- "name".to_string() => UntaggedValue::filepath("/dev/null").into(),
- })
- .into(),
- UntaggedValue::row(indexmap! {
- "name".to_string() => UntaggedValue::filepath("C:\\Program Files").into(),
- })
- .into(),
- UntaggedValue::row(indexmap! {
- "name".to_string() => UntaggedValue::filepath("../../Cargo.toml").into(),
- })
- .into(),
- ]),
- },
- Example {
- description: "Convert string to filepath",
- example: "echo 'Cargo.toml' | into path",
- result: Some(vec![UntaggedValue::filepath("Cargo.toml").into()]),
- },
- ]
- }
-}
-
-fn into_filepath(args: CommandArgs) -> Result {
- let column_paths: Vec = args.rest(0)?;
-
- Ok(args
- .input
- .map(move |v| {
- if column_paths.is_empty() {
- action(&v, v.tag())
- } else {
- let mut ret = v;
- for path in &column_paths {
- ret = ret.swap_data_by_column_path(
- path,
- Box::new(move |old| action(old, old.tag())),
- )?;
- }
-
- Ok(ret)
- }
- })
- .into_input_stream())
-}
-
-pub fn action(input: &Value, tag: impl Into) -> Result {
- let tag = tag.into();
- match &input.value {
- UntaggedValue::Primitive(prim) => Ok(UntaggedValue::filepath(match prim {
- Primitive::String(a_string) => match filepath_from_string(a_string, &tag) {
- Ok(n) => n,
- Err(e) => {
- return Err(e);
- }
- },
- Primitive::FilePath(a_filepath) => a_filepath.clone(),
- _ => {
- return Err(ShellError::unimplemented(
- "'into path' for non-string primitives",
- ))
- }
- })
- .into_value(&tag)),
- UntaggedValue::Row(_) => Err(ShellError::labeled_error(
- "specify column name to use, with 'into path COLUMN'",
- "found table",
- tag,
- )),
- _ => Err(ShellError::unimplemented(
- "'into path' for unsupported type",
- )),
- }
-}
-
-fn filepath_from_string(a_string: &str, _tag: &Tag) -> Result {
- Ok(PathBuf::from(a_string))
-}
-
-#[cfg(test)]
-mod tests {
- use super::ShellError;
- use super::SubCommand;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(SubCommand {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/conversions/into/filesize.rs b/old_nushell/crates/nu-command/src/commands/conversions/into/filesize.rs
deleted file mode 100644
index 7a3a64834..000000000
--- a/old_nushell/crates/nu-command/src/commands/conversions/into/filesize.rs
+++ /dev/null
@@ -1,182 +0,0 @@
-use std::convert::TryInto;
-
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{ColumnPath, Primitive, Signature, SyntaxShape, UntaggedValue, Value};
-use num_bigint::ToBigInt;
-
-pub struct SubCommand;
-
-impl WholeStreamCommand for SubCommand {
- fn name(&self) -> &str {
- "into filesize"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("into filesize").rest(
- "rest",
- SyntaxShape::ColumnPath,
- "column paths to convert to filesize (for table input)",
- )
- }
-
- fn usage(&self) -> &str {
- "Convert value to filesize"
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- into_filesize(args)
- }
-
- fn examples(&self) -> Vec {
- vec![
- Example {
- description: "Convert string to filesize in table",
- example: "echo [[bytes]; ['5'] [3.2] [4] [2kb]] | into filesize bytes",
- result: Some(vec![
- UntaggedValue::row(indexmap! {
- "bytes".to_string() => UntaggedValue::filesize(5).into(),
- })
- .into(),
- UntaggedValue::row(indexmap! {
- "bytes".to_string() => UntaggedValue::filesize(3).into(),
- })
- .into(),
- UntaggedValue::row(indexmap! {
- "bytes".to_string() => UntaggedValue::filesize(4).into(),
- })
- .into(),
- UntaggedValue::row(indexmap! {
- "bytes".to_string() => UntaggedValue::filesize(2000).into(),
- })
- .into(),
- ]),
- },
- Example {
- description: "Convert string to filesize",
- example: "echo '2' | into filesize",
- result: Some(vec![UntaggedValue::filesize(2).into()]),
- },
- Example {
- description: "Convert decimal to filesize",
- example: "echo 8.3 | into filesize",
- result: Some(vec![UntaggedValue::filesize(8).into()]),
- },
- Example {
- description: "Convert int to filesize",
- example: "echo 5 | into filesize",
- result: Some(vec![UntaggedValue::filesize(5).into()]),
- },
- Example {
- description: "Convert file size to filesize",
- example: "echo 4KB | into filesize",
- result: Some(vec![UntaggedValue::filesize(4000).into()]),
- },
- ]
- }
-}
-
-fn into_filesize(args: CommandArgs) -> Result {
- let column_paths: Vec = args.rest(0)?;
-
- Ok(args
- .input
- .map(move |v| {
- if column_paths.is_empty() {
- action(&v, v.tag())
- } else {
- let mut ret = v;
- for path in &column_paths {
- ret = ret.swap_data_by_column_path(
- path,
- Box::new(move |old| action(old, old.tag())),
- )?;
- }
-
- Ok(ret)
- }
- })
- .into_input_stream())
-}
-
-pub fn action(input: &Value, tag: impl Into) -> Result {
- let tag = tag.into();
- match &input.value {
- UntaggedValue::Primitive(prim) => Ok(UntaggedValue::filesize(match prim {
- Primitive::String(a_string) => match int_from_string(a_string.trim(), &tag) {
- Ok(n) => n,
- Err(e) => {
- return Err(e);
- }
- },
- Primitive::Decimal(dec) => match dec.to_bigint() {
- Some(n) => match n.to_u64() {
- Some(i) => i,
- None => {
- return Err(ShellError::unimplemented(
- "failed to convert decimal to filesize",
- ));
- }
- },
- None => {
- return Err(ShellError::unimplemented(
- "failed to convert decimal to filesize",
- ));
- }
- },
- Primitive::Int(n_ref) => (*n_ref).try_into().map_err(|_| {
- ShellError::unimplemented("cannot convert negative integer to filesize")
- })?,
- Primitive::Filesize(a_filesize) => *a_filesize,
- _ => {
- return Err(ShellError::unimplemented(
- "'into filesize' for non-numeric primitives",
- ))
- }
- })
- .into_value(&tag)),
- UntaggedValue::Row(_) => Err(ShellError::labeled_error(
- "specify column name to use, with 'into filesize COLUMN'",
- "found table",
- tag,
- )),
- _ => Err(ShellError::unimplemented(
- "'into filesize' for unsupported type",
- )),
- }
-}
-
-fn int_from_string(a_string: &str, tag: &Tag) -> Result {
- match a_string.parse::() {
- Ok(n) => Ok(n),
- Err(_) => match a_string.parse::() {
- Ok(f) => match f.to_u64() {
- Some(i) => Ok(i),
- None => Err(ShellError::labeled_error(
- "Could not convert string value to filesize",
- "original value",
- tag.clone(),
- )),
- },
- Err(_) => Err(ShellError::labeled_error(
- "Could not convert string value to filesize",
- "original value",
- tag.clone(),
- )),
- },
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::ShellError;
- use super::SubCommand;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(SubCommand {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/conversions/into/int.rs b/old_nushell/crates/nu-command/src/commands/conversions/into/int.rs
deleted file mode 100644
index afa2a04fe..000000000
--- a/old_nushell/crates/nu-command/src/commands/conversions/into/int.rs
+++ /dev/null
@@ -1,198 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{ColumnPath, Primitive, Signature, SyntaxShape, UntaggedValue, Value};
-use num_bigint::ToBigInt;
-
-pub struct SubCommand;
-
-impl WholeStreamCommand for SubCommand {
- fn name(&self) -> &str {
- "into int"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("into int").rest(
- "rest",
- SyntaxShape::ColumnPath,
- "column paths to convert to int (for table input)",
- )
- }
-
- fn usage(&self) -> &str {
- "Convert value to integer"
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- into_int(args)
- }
-
- fn examples(&self) -> Vec {
- vec![
- Example {
- description: "Convert string to integer in table",
- example: "echo [[num]; ['-5'] [4] [1.5]] | into int num",
- result: Some(vec![
- UntaggedValue::row(indexmap! {
- "num".to_string() => UntaggedValue::int(-5).into(),
- })
- .into(),
- UntaggedValue::row(indexmap! {
- "num".to_string() => UntaggedValue::int(4).into(),
- })
- .into(),
- UntaggedValue::row(indexmap! {
- "num".to_string() => UntaggedValue::int(1).into(),
- })
- .into(),
- ]),
- },
- Example {
- description: "Convert string to integer",
- example: "echo '2' | into int",
- result: Some(vec![UntaggedValue::int(2).into()]),
- },
- Example {
- description: "Convert decimal to integer",
- example: "echo 5.9 | into int",
- result: Some(vec![UntaggedValue::int(5).into()]),
- },
- Example {
- description: "Convert decimal string to integer",
- example: "echo '5.9' | into int",
- result: Some(vec![UntaggedValue::int(5).into()]),
- },
- Example {
- description: "Convert file size to integer",
- example: "echo 4KB | into int",
- result: Some(vec![UntaggedValue::int(4000).into()]),
- },
- Example {
- description: "Convert bool to integer",
- example: "echo $false $true | into int",
- result: Some(vec![
- UntaggedValue::int(0).into(),
- UntaggedValue::int(1).into(),
- ]),
- },
- ]
- }
-}
-
-fn into_int(args: CommandArgs) -> Result {
- let column_paths: Vec = args.rest(0)?;
-
- Ok(args
- .input
- .map(move |v| {
- if column_paths.is_empty() {
- action(&v, v.tag())
- } else {
- let mut ret = v;
- for path in &column_paths {
- ret = ret.swap_data_by_column_path(
- path,
- Box::new(move |old| action(old, old.tag())),
- )?;
- }
-
- Ok(ret)
- }
- })
- .into_input_stream())
-}
-
-pub fn action(input: &Value, tag: impl Into) -> Result {
- let tag = tag.into();
- match &input.value {
- UntaggedValue::Primitive(prim) => Ok(UntaggedValue::int(match prim {
- Primitive::String(a_string) => match int_from_string(a_string, &tag) {
- Ok(n) => n,
- Err(e) => {
- return Err(e);
- }
- },
- Primitive::Decimal(dec) => match dec.to_bigint() {
- Some(n) => match n.to_i64() {
- Some(i) => i,
- None => {
- return Err(ShellError::unimplemented(
- "failed to convert decimal to int",
- ));
- }
- },
- None => {
- return Err(ShellError::unimplemented(
- "failed to convert decimal to int",
- ));
- }
- },
- Primitive::Int(n_ref) => *n_ref,
- Primitive::Boolean(a_bool) => match a_bool {
- false => 0,
- true => 1,
- },
- Primitive::Filesize(a_filesize) => match a_filesize.to_bigint() {
- Some(n) => match n.to_i64() {
- Some(i) => i,
- None => {
- return Err(ShellError::unimplemented(
- "failed to convert filesize to bigint",
- ));
- }
- },
- None => {
- return Err(ShellError::unimplemented(
- "failed to convert filesize to bigint",
- ));
- }
- },
- _ => {
- return Err(ShellError::unimplemented(
- "'into int' for non-numeric primitives",
- ))
- }
- })
- .into_value(&tag)),
- UntaggedValue::Row(_) => Err(ShellError::labeled_error(
- "specify column name to use, with 'into int COLUMN'",
- "found table",
- tag,
- )),
- _ => Err(ShellError::unimplemented("'into int' for unsupported type")),
- }
-}
-
-fn int_from_string(a_string: &str, tag: &Tag) -> Result {
- match a_string.parse::() {
- Ok(n) => Ok(n),
- Err(_) => match a_string.parse::() {
- Ok(f) => match f.to_i64() {
- Some(i) => Ok(i),
- None => Err(ShellError::labeled_error(
- "Could not convert string value to int",
- "original value",
- tag.clone(),
- )),
- },
- Err(_) => Err(ShellError::labeled_error(
- "Could not convert string value to int",
- "original value",
- tag.clone(),
- )),
- },
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::ShellError;
- use super::SubCommand;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(SubCommand {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/conversions/into/mod.rs b/old_nushell/crates/nu-command/src/commands/conversions/into/mod.rs
deleted file mode 100644
index ae029d887..000000000
--- a/old_nushell/crates/nu-command/src/commands/conversions/into/mod.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-mod binary;
-mod column_path;
-mod command;
-mod filepath;
-mod filesize;
-mod int;
-pub mod string;
-
-pub use self::filesize::SubCommand as IntoFilesize;
-pub use binary::SubCommand as IntoBinary;
-pub use column_path::SubCommand as IntoColumnPath;
-pub use command::Command as Into;
-pub use filepath::SubCommand as IntoFilepath;
-pub use int::SubCommand as IntoInt;
-pub use string::SubCommand as IntoString;
diff --git a/old_nushell/crates/nu-command/src/commands/conversions/into/string.rs b/old_nushell/crates/nu-command/src/commands/conversions/into/string.rs
deleted file mode 100644
index 70f19fe66..000000000
--- a/old_nushell/crates/nu-command/src/commands/conversions/into/string.rs
+++ /dev/null
@@ -1,279 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{ColumnPath, Primitive, Signature, SyntaxShape, UntaggedValue, Value};
-use nu_source::Tagged;
-use num_bigint::{BigInt, BigUint, ToBigInt};
-// TODO num_format::SystemLocale once platform-specific dependencies are stable (see Cargo.toml)
-use nu_data::base::shape::InlineShape;
-use num_format::Locale;
-use num_traits::{Pow, Signed};
-use std::iter;
-
-pub struct SubCommand;
-
-impl WholeStreamCommand for SubCommand {
- fn name(&self) -> &str {
- "into string"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("into string")
- .rest(
- "rest",
- SyntaxShape::ColumnPath,
- "column paths to convert to string (for table input)",
- )
- .named(
- "decimals",
- SyntaxShape::Int,
- "decimal digits to which to round",
- Some('d'),
- )
- }
-
- fn usage(&self) -> &str {
- "Convert value to string"
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- into_string(args)
- }
-
- fn examples(&self) -> Vec {
- vec![
- Example {
- description: "convert decimal to string and round to nearest integer",
- example: "echo 1.7 | into string -d 0",
- result: Some(vec![UntaggedValue::string("2").into_untagged_value()]),
- },
- Example {
- description: "convert decimal to string",
- example: "echo 4.3 | into string",
- result: Some(vec![UntaggedValue::string("4.3").into_untagged_value()]),
- },
- Example {
- description: "convert string to string",
- example: "echo '1234' | into string",
- result: Some(vec![UntaggedValue::string("1234").into_untagged_value()]),
- },
- Example {
- description: "convert boolean to string",
- example: "echo $true | into string",
- result: Some(vec![UntaggedValue::string("true").into_untagged_value()]),
- },
- Example {
- description: "convert date to string",
- example: "date now | into string",
- result: None,
- },
- Example {
- description: "convert filepath to string",
- example: "ls Cargo.toml | get name | into string",
- result: None,
- },
- Example {
- description: "convert filesize to string",
- example: "ls Cargo.toml | get size | into string",
- result: None,
- },
- ]
- }
-}
-
-fn into_string(args: CommandArgs) -> Result {
- let decimals: Option> = args.get_flag("decimals")?;
- let column_paths: Vec = args.rest(0)?;
-
- let digits = decimals.as_ref().map(|tagged| tagged.item);
- let group_digits = false;
-
- Ok(args
- .input
- .map(move |v| {
- if column_paths.is_empty() {
- action(&v, v.tag(), digits, group_digits)
- } else {
- let mut ret = v;
- for path in &column_paths {
- ret = ret.swap_data_by_column_path(
- path,
- Box::new(move |old| action(old, old.tag(), digits, group_digits)),
- )?;
- }
-
- Ok(ret)
- }
- })
- .into_input_stream())
-}
-
-pub fn action(
- input: &Value,
- tag: impl Into,
- digits: Option,
- group_digits: bool,
-) -> Result {
- match &input.value {
- UntaggedValue::Primitive(prim) => Ok(UntaggedValue::string(match prim {
- Primitive::Int(int) => {
- if group_digits {
- format_int(*int) // int.to_formatted_string(*locale)
- } else {
- int.to_string()
- }
- }
- Primitive::BigInt(int) => {
- if group_digits {
- format_bigint(int) // int.to_formatted_string(*locale)
- } else {
- int.to_string()
- }
- }
- Primitive::Decimal(dec) => format_decimal(dec.clone(), digits, group_digits),
- Primitive::String(a_string) => a_string.to_string(),
- Primitive::Boolean(a_bool) => a_bool.to_string(),
- Primitive::Date(a_date) => a_date.format("%c").to_string(),
- Primitive::FilePath(a_filepath) => a_filepath.as_path().display().to_string(),
- Primitive::Filesize(a_filesize) => {
- let byte_string = InlineShape::format_bytes(*a_filesize, None);
- byte_string.1
- }
- Primitive::Nothing => "nothing".to_string(),
- _ => {
- return Err(ShellError::unimplemented(&format!(
- "into string for primitive: {:?}",
- prim
- )))
- }
- })
- .into_value(tag)),
- UntaggedValue::Row(_) => Err(ShellError::labeled_error(
- "specify column to use 'into string'",
- "found table",
- input.tag.clone(),
- )),
- UntaggedValue::Table(_) => Err(ShellError::unimplemented("into string for table")),
- _ => Err(ShellError::unimplemented("into string for non-primitive")),
- }
-}
-
-fn format_int(int: i64) -> String {
- int.to_string()
-
- // TODO once platform-specific dependencies are stable (see Cargo.toml)
- // #[cfg(windows)]
- // {
- // int.to_formatted_string(&Locale::en)
- // }
- // #[cfg(not(windows))]
- // {
- // match SystemLocale::default() {
- // Ok(locale) => int.to_formatted_string(&locale),
- // Err(_) => int.to_formatted_string(&Locale::en),
- // }
- // }
-}
-
-fn format_bigint(int: &BigInt) -> String {
- int.to_string()
-
- // TODO once platform-specific dependencies are stable (see Cargo.toml)
- // #[cfg(windows)]
- // {
- // int.to_formatted_string(&Locale::en)
- // }
- // #[cfg(not(windows))]
- // {
- // match SystemLocale::default() {
- // Ok(locale) => int.to_formatted_string(&locale),
- // Err(_) => int.to_formatted_string(&Locale::en),
- // }
- // }
-}
-
-fn format_decimal(mut decimal: BigDecimal, digits: Option, group_digits: bool) -> String {
- if let Some(n) = digits {
- decimal = round_decimal(&decimal, n)
- }
-
- if decimal.is_integer() && (digits.is_none() || digits == Some(0)) {
- let int = decimal
- .to_bigint()
- .expect("integer BigDecimal should convert to BigInt");
- return if group_digits {
- int.to_string()
- } else {
- format_bigint(&int)
- };
- }
-
- let (int, exp) = decimal.as_bigint_and_exponent();
- let factor = BigInt::from(10).pow(BigUint::from(exp as u64)); // exp > 0 for non-int decimal
- let int_part = &int / &factor;
- let dec_part = (&int % &factor)
- .abs()
- .to_biguint()
- .expect("BigInt::abs should always produce positive signed BigInt and thus BigUInt")
- .to_str_radix(10);
-
- let dec_str = if let Some(n) = digits {
- dec_part
- .chars()
- .chain(iter::repeat('0'))
- .take(n as usize)
- .collect()
- } else {
- String::from(dec_part.trim_end_matches('0'))
- };
-
- let format_default_loc = |int_part: BigInt| {
- let loc = Locale::en;
- //TODO: when num_format is available for recent bigint, replace this with the locale-based format
- let (int_str, sep) = (int_part.to_string(), String::from(loc.decimal()));
-
- format!("{}{}{}", int_str, sep, dec_str)
- };
-
- format_default_loc(int_part)
-
- // TODO once platform-specific dependencies are stable (see Cargo.toml)
- // #[cfg(windows)]
- // {
- // format_default_loc(int_part)
- // }
- // #[cfg(not(windows))]
- // {
- // match SystemLocale::default() {
- // Ok(sys_loc) => {
- // let int_str = int_part.to_formatted_string(&sys_loc);
- // let sep = String::from(sys_loc.decimal());
- // format!("{}{}{}", int_str, sep, dec_str)
- // }
- // Err(_) => format_default_loc(int_part),
- // }
- // }
-}
-
-fn round_decimal(decimal: &BigDecimal, mut digits: u64) -> BigDecimal {
- let mut mag = decimal.clone();
- while mag >= BigDecimal::from(1) {
- mag = mag / 10;
- digits += 1;
- }
-
- decimal.with_prec(digits)
-}
-
-#[cfg(test)]
-mod tests {
- use super::ShellError;
- use super::SubCommand;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(SubCommand {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/conversions/mod.rs b/old_nushell/crates/nu-command/src/commands/conversions/mod.rs
deleted file mode 100644
index 70608f782..000000000
--- a/old_nushell/crates/nu-command/src/commands/conversions/mod.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-pub(crate) mod into;
-
-pub use into::*;
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/alias.rs b/old_nushell/crates/nu-command/src/commands/core_commands/alias.rs
deleted file mode 100644
index 4ce2a426d..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/alias.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-
-use nu_errors::ShellError;
-use nu_protocol::{Signature, SyntaxShape, UntaggedValue};
-
-pub struct Alias;
-
-impl WholeStreamCommand for Alias {
- fn name(&self) -> &str {
- "alias"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("alias")
- .required("name", SyntaxShape::String, "the name of the alias")
- .required("equals", SyntaxShape::String, "the equals sign")
- .rest("rest", SyntaxShape::Any, "the expansion for the alias")
- }
-
- fn usage(&self) -> &str {
- "Alias a command to an expansion."
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- alias(args)
- }
-
- fn examples(&self) -> Vec {
- vec![Example {
- description: "Alias ll to ls -l",
- example: "alias ll = ls -l",
- result: None,
- }]
- }
-}
-
-pub fn alias(args: CommandArgs) -> Result {
- // TODO: is there a better way of checking whether no arguments were passed?
- if args.nth(0).is_none() {
- let aliases = UntaggedValue::string(
- &args
- .scope()
- .get_aliases()
- .iter()
- .map(|val| format!("{} = '{}'", val.0, val.1.iter().map(|x| &x.item).join(" ")))
- .join("\n"),
- );
- return Ok(OutputStream::one(aliases));
- }
- Ok(OutputStream::empty())
-}
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/debug.rs b/old_nushell/crates/nu-command/src/commands/core_commands/debug.rs
deleted file mode 100644
index d92380e0d..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/debug.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{ReturnSuccess, Signature, UntaggedValue};
-
-pub struct Debug;
-
-impl WholeStreamCommand for Debug {
- fn name(&self) -> &str {
- "debug"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("debug").switch("raw", "Prints the raw value representation.", Some('r'))
- }
-
- fn usage(&self) -> &str {
- "Print the Rust debug representation of the values."
- }
-
- fn run_with_actions(&self, args: CommandArgs) -> Result {
- debug_value(args)
- }
-}
-
-fn debug_value(args: CommandArgs) -> Result {
- let raw = args.has_flag("raw");
- let input = args.input;
-
- Ok(input
- .map(move |v| {
- if raw {
- ReturnSuccess::value(
- UntaggedValue::string(format!("{:#?}", v)).into_untagged_value(),
- )
- } else {
- ReturnSuccess::debug_value(v)
- }
- })
- .into_action_stream())
-}
-
-#[cfg(test)]
-mod tests {
- use super::Debug;
- use super::ShellError;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(Debug {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/def.rs b/old_nushell/crates/nu-command/src/commands/core_commands/def.rs
deleted file mode 100644
index f247bd7a1..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/def.rs
+++ /dev/null
@@ -1,47 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-
-use nu_errors::ShellError;
-use nu_protocol::{hir::CapturedBlock, Signature, SyntaxShape, Value};
-use nu_source::Tagged;
-
-pub struct Def;
-
-#[derive(Deserialize)]
-pub struct DefArgs {
- pub name: Tagged,
- pub args: Tagged>,
- pub block: CapturedBlock,
-}
-
-impl WholeStreamCommand for Def {
- fn name(&self) -> &str {
- "def"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("def")
- .required("name", SyntaxShape::String, "the name of the command")
- .required(
- "params",
- SyntaxShape::Table,
- "the parameters of the command",
- )
- .required("block", SyntaxShape::Block, "the body of the command")
- }
-
- fn usage(&self) -> &str {
- "Create a command and set it to a definition."
- }
-
- fn run_with_actions(&self, _args: CommandArgs) -> Result {
- // Currently, we don't do anything here because we should have already
- // installed the definition as we entered the scope
- // We just create a command so that we can get proper coloring
- Ok(ActionStream::empty())
- }
-
- fn examples(&self) -> Vec {
- vec![]
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/describe.rs b/old_nushell/crates/nu-command/src/commands/core_commands/describe.rs
deleted file mode 100644
index fa48a9ee9..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/describe.rs
+++ /dev/null
@@ -1,53 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-
-use nu_errors::ShellError;
-use nu_protocol::{ReturnSuccess, Signature, UntaggedValue};
-
-pub struct Describe;
-
-#[derive(Deserialize)]
-pub struct DescribeArgs {}
-
-impl WholeStreamCommand for Describe {
- fn name(&self) -> &str {
- "describe"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("describe")
- }
-
- fn usage(&self) -> &str {
- "Describes the objects in the stream."
- }
-
- fn run_with_actions(&self, args: CommandArgs) -> Result {
- describe(args)
- }
-}
-
-pub fn describe(args: CommandArgs) -> Result {
- Ok(args
- .input
- .map(|row| {
- let name = value::plain_type(&row, 100);
- ReturnSuccess::value(
- UntaggedValue::string(name).into_value(Tag::unknown_anchor(row.tag.span)),
- )
- })
- .into_action_stream())
-}
-
-#[cfg(test)]
-mod tests {
- use super::Describe;
- use super::ShellError;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(Describe {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/do_.rs b/old_nushell/crates/nu-command/src/commands/core_commands/do_.rs
deleted file mode 100644
index 413a9ab37..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/do_.rs
+++ /dev/null
@@ -1,141 +0,0 @@
-use crate::prelude::*;
-use nu_engine::run_block;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{
- hir::CapturedBlock, hir::ExternalRedirection, Signature, SyntaxShape, UntaggedValue, Value,
-};
-
-pub struct Do;
-
-struct DoArgs {
- block: CapturedBlock,
- ignore_errors: bool,
- rest: Vec,
-}
-
-impl WholeStreamCommand for Do {
- fn name(&self) -> &str {
- "do"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("do")
- .required("block", SyntaxShape::Block, "the block to run ")
- .switch(
- "ignore-errors",
- "ignore errors as the block runs",
- Some('i'),
- )
- .rest("rest", SyntaxShape::Any, "the parameter(s) for the block")
- }
-
- fn usage(&self) -> &str {
- "Runs a block, optionally ignoring errors."
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- do_(args)
- }
-
- fn examples(&self) -> Vec {
- vec![
- Example {
- description: "Run the block",
- example: r#"do { echo hello }"#,
- result: Some(vec![Value::from("hello")]),
- },
- Example {
- description: "Run the block and ignore errors",
- example: r#"do -i { thisisnotarealcommand }"#,
- result: Some(vec![]),
- },
- Example {
- description: "Run the block with a parameter",
- example: r#"do { |x| $x + 100 } 55"#,
- result: Some(vec![UntaggedValue::int(155).into()]),
- },
- ]
- }
-}
-
-fn do_(args: CommandArgs) -> Result {
- let external_redirection = args.call_info.args.external_redirection;
-
- let context = args.context().clone();
- let do_args = DoArgs {
- block: args.req(0)?,
- ignore_errors: args.has_flag("ignore-errors"),
- rest: args.rest(1)?,
- };
-
- let block_redirection = match external_redirection {
- ExternalRedirection::None => {
- if do_args.ignore_errors {
- ExternalRedirection::Stderr
- } else {
- ExternalRedirection::None
- }
- }
- ExternalRedirection::Stdout => {
- if do_args.ignore_errors {
- ExternalRedirection::StdoutAndStderr
- } else {
- ExternalRedirection::Stdout
- }
- }
- x => x,
- };
-
- context.scope.enter_scope();
-
- context.scope.add_vars(&do_args.block.captured.entries);
-
- for (param, value) in do_args
- .block
- .block
- .params
- .positional
- .iter()
- .zip(do_args.rest)
- {
- context.scope.add_var(param.0.name(), value.clone());
- }
-
- let result = run_block(
- &do_args.block.block,
- &context,
- args.input,
- block_redirection,
- );
- context.scope.exit_scope();
-
- if do_args.ignore_errors {
- // To properly ignore errors we need to redirect stderr, consume it, and remove
- // any errors we see in the process.
-
- match result {
- Ok(mut stream) => {
- let output = stream.drain_vec();
- context.clear_errors();
- Ok(output.into_iter().into_output_stream())
- }
- Err(_) => Ok(OutputStream::empty()),
- }
- } else {
- result.map(|x| x.into_output_stream())
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::Do;
- use super::ShellError;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(Do {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/echo.rs b/old_nushell/crates/nu-command/src/commands/core_commands/echo.rs
deleted file mode 100644
index cddd5081a..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/echo.rs
+++ /dev/null
@@ -1,207 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::hir::Operator;
-use nu_protocol::{Primitive, Range, RangeInclusion, Signature, SyntaxShape, UntaggedValue, Value};
-
-pub struct Echo;
-
-impl WholeStreamCommand for Echo {
- fn name(&self) -> &str {
- "echo"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("echo").rest("rest", SyntaxShape::Any, "the values to echo")
- }
-
- fn usage(&self) -> &str {
- "Echo the arguments back to the user."
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- echo(args)
- }
-
- fn examples(&self) -> Vec {
- vec![
- Example {
- description: "Put a hello message in the pipeline",
- example: "echo 'hello'",
- result: Some(vec![Value::from("hello")]),
- },
- Example {
- description: "Print the value of the special '$nu' variable",
- example: "echo $nu",
- result: None,
- },
- ]
- }
-}
-
-pub fn expand_value_to_stream(v: Value) -> InputStream {
- match v {
- Value {
- value: UntaggedValue::Table(table),
- ..
- } => InputStream::from_stream(table.into_iter()),
- Value {
- value: UntaggedValue::Primitive(Primitive::Range(range)),
- tag,
- } => InputStream::from_stream(RangeIterator::new(*range, tag)),
- x => InputStream::one(x),
- }
-}
-
-fn echo(args: CommandArgs) -> Result {
- let rest: Vec = args.rest(0)?;
-
- let stream = rest.into_iter().map(|i| match i.as_string() {
- Ok(s) => InputStream::one(UntaggedValue::string(s).into_value(i.tag)),
- _ => expand_value_to_stream(i),
- });
-
- Ok(InputStream::from_stream(stream.flatten()))
-}
-
-struct RangeIterator {
- curr: UntaggedValue,
- end: UntaggedValue,
- tag: Tag,
- is_end_inclusive: bool,
- moves_up: bool,
- one: UntaggedValue,
- negative_one: UntaggedValue,
- done: bool,
-}
-
-impl RangeIterator {
- pub fn new(range: Range, tag: Tag) -> RangeIterator {
- let start = match range.from.0.item {
- Primitive::Nothing => Primitive::Int(0.into()),
- x => x,
- };
-
- let end = match range.to.0.item {
- Primitive::Nothing => Primitive::Int(i64::MAX),
- x => x,
- };
-
- RangeIterator {
- moves_up: start <= end,
- curr: UntaggedValue::Primitive(start),
- end: UntaggedValue::Primitive(end),
- tag,
- is_end_inclusive: matches!(range.to.1, RangeInclusion::Inclusive),
- one: UntaggedValue::int(1),
- negative_one: UntaggedValue::int(-1),
- done: false,
- }
- }
-}
-
-impl Iterator for RangeIterator {
- type Item = Value;
- fn next(&mut self) -> Option {
- use std::cmp::Ordering;
- if self.done {
- return None;
- }
-
- let ordering = if self.end == UntaggedValue::Primitive(Primitive::Nothing) {
- Ordering::Less
- } else {
- match (&self.curr, &self.end) {
- (
- UntaggedValue::Primitive(Primitive::Int(x)),
- UntaggedValue::Primitive(Primitive::Int(y)),
- ) => x.cmp(y),
- (
- UntaggedValue::Primitive(Primitive::Decimal(x)),
- UntaggedValue::Primitive(Primitive::Decimal(y)),
- ) => x.cmp(y),
- (
- UntaggedValue::Primitive(Primitive::Decimal(x)),
- UntaggedValue::Primitive(Primitive::Int(y)),
- ) => x.cmp(&(BigDecimal::from(*y))),
- (
- UntaggedValue::Primitive(Primitive::Int(x)),
- UntaggedValue::Primitive(Primitive::Decimal(y)),
- ) => (BigDecimal::from(*x)).cmp(y),
- _ => {
- self.done = true;
- return Some(
- UntaggedValue::Error(ShellError::labeled_error(
- "Cannot create range",
- "unsupported range",
- self.tag.span,
- ))
- .into_untagged_value(),
- );
- }
- }
- };
-
- if self.moves_up
- && (ordering == Ordering::Less || self.is_end_inclusive && ordering == Ordering::Equal)
- {
- let next_value = nu_data::value::compute_values(Operator::Plus, &self.curr, &self.one);
-
- let mut next = match next_value {
- Ok(result) => result,
-
- Err((left_type, right_type)) => {
- self.done = true;
- return Some(
- UntaggedValue::Error(ShellError::coerce_error(
- left_type.spanned(self.tag.span),
- right_type.spanned(self.tag.span),
- ))
- .into_untagged_value(),
- );
- }
- };
- std::mem::swap(&mut self.curr, &mut next);
-
- Some(next.into_value(self.tag.clone()))
- } else if !self.moves_up
- && (ordering == Ordering::Greater
- || self.is_end_inclusive && ordering == Ordering::Equal)
- {
- let next_value =
- nu_data::value::compute_values(Operator::Plus, &self.curr, &self.negative_one);
-
- let mut next = match next_value {
- Ok(result) => result,
- Err((left_type, right_type)) => {
- self.done = true;
- return Some(
- UntaggedValue::Error(ShellError::coerce_error(
- left_type.spanned(self.tag.span),
- right_type.spanned(self.tag.span),
- ))
- .into_untagged_value(),
- );
- }
- };
- std::mem::swap(&mut self.curr, &mut next);
-
- Some(next.into_value(self.tag.clone()))
- } else {
- None
- }
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::Echo;
- use super::ShellError;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(Echo {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/error/make.rs b/old_nushell/crates/nu-command/src/commands/core_commands/error/make.rs
deleted file mode 100644
index 0d3ca69fe..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/error/make.rs
+++ /dev/null
@@ -1,109 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{Primitive, Signature, UntaggedValue, Value};
-
-pub struct SubCommand;
-
-impl WholeStreamCommand for SubCommand {
- fn name(&self) -> &str {
- "error make"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("error make")
- }
-
- fn usage(&self) -> &str {
- "Create an error."
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- let input = args.input;
-
- Ok(input
- .map(|value| {
- make_error(&value)
- .map(|err| UntaggedValue::Error(err).into_value(value.tag()))
- .unwrap_or_else(|| {
- UntaggedValue::Error(ShellError::untagged_runtime_error(
- "Creating error value not supported.",
- ))
- .into_value(value.tag())
- })
- })
- .into_output_stream())
- }
-
- fn examples(&self) -> Vec {
- vec![Example {
- description: "Creates a labeled error",
- example: r#"[
- [ msg, labels, span];
- ["The message", "Helpful message here", ([[start, end]; [0, 141]])]
-] | error make"#,
- result: None,
- }]
- }
-}
-
-fn make_error(value: &Value) -> Option {
- if let Value {
- value: UntaggedValue::Row(dict),
- ..
- } = value
- {
- let msg = dict.get_data_by_key("msg".spanned_unknown());
-
- let labels =
- dict.get_data_by_key("labels".spanned_unknown())
- .and_then(|table| match &table.value {
- UntaggedValue::Table(_) => table
- .table_entries()
- .map(|value| value.as_string().ok())
- .collect(),
- UntaggedValue::Primitive(Primitive::String(label)) => {
- Some(vec![label.to_string()])
- }
- _ => None,
- });
-
- let _anchor = dict.get_data_by_key("tag".spanned_unknown());
- let span = dict.get_data_by_key("span".spanned_unknown());
-
- if msg.is_none() || labels.is_none() || span.is_none() {
- return None;
- }
-
- let msg = msg.and_then(|msg| msg.as_string().ok());
-
- if let Some(labels) = labels {
- if labels.is_empty() {
- return None;
- }
-
- return Some(ShellError::labeled_error(
- msg.expect("Message will always be present."),
- &labels[0],
- span.map(|data| match data {
- Value {
- value: UntaggedValue::Row(vals),
- ..
- } => match (vals.entries.get("start"), vals.entries.get("end")) {
- (Some(start), Some(end)) => {
- let start = start.as_usize().ok().unwrap_or(0);
- let end = end.as_usize().ok().unwrap_or(0);
-
- Span::new(start, end)
- }
- (_, _) => Span::unknown(),
- },
- _ => Span::unknown(),
- })
- .unwrap_or_else(Span::unknown),
- ));
- }
- }
-
- None
-}
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/error/mod.rs b/old_nushell/crates/nu-command/src/commands/core_commands/error/mod.rs
deleted file mode 100644
index 4a2ff564f..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/error/mod.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-mod make;
-
-pub use make::SubCommand as ErrorMake;
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/find.rs b/old_nushell/crates/nu-command/src/commands/core_commands/find.rs
deleted file mode 100644
index 559f9fa3b..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/find.rs
+++ /dev/null
@@ -1,110 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{Dictionary, Signature, SyntaxShape, UntaggedValue, Value};
-
-pub struct Find;
-
-impl WholeStreamCommand for Find {
- fn name(&self) -> &str {
- "find"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("find").rest("rest", SyntaxShape::String, "search term")
- }
-
- fn usage(&self) -> &str {
- "Find text in the output of a previous command"
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- find(args)
- }
-
- fn examples(&self) -> Vec {
- vec![
- Example {
- description: "Search pipeline output for multiple terms",
- example: r#"ls | find toml md sh"#,
- result: None,
- },
- Example {
- description: "Search strings for term(s)",
- example: r#"echo Cargo.toml | find toml"#,
- result: Some(vec![Value::from("Cargo.toml")]),
- },
- Example {
- description: "Search a number list for term(s)",
- example: r#"[1 2 3 4 5] | find 5"#,
- result: Some(vec![UntaggedValue::int(5).into()]),
- },
- Example {
- description: "Search string list for term(s)",
- example: r#"[moe larry curly] | find l"#,
- result: Some(vec![Value::from("larry"), Value::from("curly")]),
- },
- ]
- }
-}
-
-fn row_contains(row: &Dictionary, search_terms: Vec) -> bool {
- for term in search_terms {
- for (k, v) in &row.entries {
- let key = k.to_string().trim().to_lowercase();
- let value = v.convert_to_string().trim().to_lowercase();
- if key.contains(&term) || value.contains(&term) {
- return true;
- }
- }
- }
-
- false
-}
-
-fn find(args: CommandArgs) -> Result {
- let rest: Vec = args.rest(0)?;
-
- Ok(args
- .input
- .filter(move |row| match &row.value {
- UntaggedValue::Row(row) => {
- let sterms: Vec = rest
- .iter()
- .map(|t| t.convert_to_string().trim().to_lowercase())
- .collect();
- row_contains(row, sterms)
- }
- UntaggedValue::Primitive(_p) => {
- // eprint!("prim {}", p.type_name());
- let sterms: Vec = rest
- .iter()
- .map(|t| t.convert_to_string().trim().to_lowercase())
- .collect();
-
- let prim_string = &row.convert_to_string().trim().to_lowercase();
- for term in sterms {
- if prim_string.contains(&term) {
- return true;
- }
- }
-
- false
- }
- _ => false,
- })
- .into_output_stream())
-}
-
-#[cfg(test)]
-mod tests {
- use super::Find;
- use super::ShellError;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(Find {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/help.rs b/old_nushell/crates/nu-command/src/commands/core_commands/help.rs
deleted file mode 100644
index 08a74bffa..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/help.rs
+++ /dev/null
@@ -1,353 +0,0 @@
-use crate::prelude::*;
-use crate::TaggedListBuilder;
-use nu_engine::{documentation::generate_docs, Command, WholeStreamCommand};
-use nu_errors::ShellError;
-use nu_protocol::{
- Dictionary, NamedType, PositionalType, ReturnSuccess, Signature, SyntaxShape,
- TaggedDictBuilder, UntaggedValue, Value,
-};
-use nu_source::{SpannedItem, Tag, Tagged};
-use nu_value_ext::ValueExt;
-
-pub struct Help;
-
-impl WholeStreamCommand for Help {
- fn name(&self) -> &str {
- "help"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("help")
- .rest(
- "rest",
- SyntaxShape::String,
- "the name of command to get help on",
- )
- .named(
- "find",
- SyntaxShape::String,
- "string to find in command usage",
- Some('f'),
- )
- }
-
- fn usage(&self) -> &str {
- "Display help information about commands."
- }
-
- fn run_with_actions(&self, args: CommandArgs) -> Result {
- help(args)
- }
-
- fn examples(&self) -> Vec {
- vec![
- Example {
- description: "show all commands and sub-commands",
- example: "help commands",
- result: None,
- },
- Example {
- description: "generate documentation",
- example: "help generate_docs",
- result: None,
- },
- Example {
- description: "show help for single command",
- example: "help match",
- result: None,
- },
- Example {
- description: "show help for single sub-command",
- example: "help str lpad",
- result: None,
- },
- Example {
- description: "search for string in command usage",
- example: "help --find char",
- result: None,
- },
- ]
- }
-}
-
-fn help(args: CommandArgs) -> Result {
- let name = args.call_info.name_tag.clone();
- let scope = args.scope().clone();
- let find: Option> = args.get_flag("find")?;
- let rest: Vec> = args.rest(0)?;
-
- if let Some(f) = find {
- let search_string = f.item;
- let full_commands = scope.get_commands_info();
- let mut found_cmds_vec = Vec::new();
-
- for (key, cmd) in full_commands {
- let mut indexmap = IndexMap::new();
-
- let c = cmd.usage().to_string();
- let e = cmd.extra_usage().to_string();
- if key.to_lowercase().contains(&search_string)
- || c.to_lowercase().contains(&search_string)
- || e.to_lowercase().contains(&search_string)
- {
- indexmap.insert(
- "name".to_string(),
- UntaggedValue::string(key).into_value(&name),
- );
-
- indexmap.insert(
- "usage".to_string(),
- UntaggedValue::string(cmd.usage().to_string()).into_value(&name),
- );
-
- indexmap.insert(
- "extra_usage".to_string(),
- UntaggedValue::string(cmd.extra_usage().to_string()).into_value(&name),
- );
-
- found_cmds_vec
- .push(UntaggedValue::Row(Dictionary::from(indexmap)).into_value(&name));
- }
- }
-
- return Ok(found_cmds_vec.into_iter().into_action_stream());
- }
-
- if !rest.is_empty() {
- if rest[0].item == "commands" {
- let mut sorted_names = scope.get_command_names();
- sorted_names.sort();
-
- let (mut subcommand_names, command_names) = sorted_names
- .into_iter()
- // private only commands shouldn't be displayed
- .filter(|cmd_name| {
- scope
- .get_command(cmd_name)
- .filter(|command| !command.is_private())
- .is_some()
- })
- .partition::, _>(|cmd_name| cmd_name.contains(' '));
-
- fn process_name(
- dict: &mut TaggedDictBuilder,
- cmd_name: &str,
- scope: Scope,
- rest: Vec>,
- name: Tag,
- ) -> Result<(), ShellError> {
- let document_tag = rest[0].tag.clone();
- let value = command_dict(
- scope.get_command(cmd_name).ok_or_else(|| {
- ShellError::labeled_error(
- format!("Could not load {}", cmd_name),
- "could not load command",
- document_tag,
- )
- })?,
- name,
- );
-
- dict.insert_untagged("name", cmd_name);
- dict.insert_untagged(
- "description",
- value
- .get_data_by_key("usage".spanned_unknown())
- .ok_or_else(|| {
- ShellError::labeled_error(
- "Expected a usage key",
- "expected a 'usage' key",
- &value.tag,
- )
- })?
- .as_string()?,
- );
-
- Ok(())
- }
-
- fn make_subcommands_table(
- subcommand_names: &mut Vec,
- cmd_name: &str,
- scope: Scope,
- rest: Vec>,
- name: Tag,
- ) -> Result {
- let (matching, not_matching) =
- subcommand_names.drain(..).partition(|subcommand_name| {
- subcommand_name.starts_with(&format!("{} ", cmd_name))
- });
- *subcommand_names = not_matching;
- Ok(if !matching.is_empty() {
- UntaggedValue::table(
- &(matching
- .into_iter()
- .map(|cmd_name: String| -> Result<_, ShellError> {
- let mut short_desc = TaggedDictBuilder::new(name.clone());
- process_name(
- &mut short_desc,
- &cmd_name,
- scope.clone(),
- rest.clone(),
- name.clone(),
- )?;
- Ok(short_desc.into_value())
- })
- .collect::, _>>()?[..]),
- )
- .into_value(name)
- } else {
- UntaggedValue::nothing().into_value(name)
- })
- }
-
- let iterator =
- command_names
- .into_iter()
- .map(move |cmd_name| -> Result<_, ShellError> {
- let mut short_desc = TaggedDictBuilder::new(name.clone());
- process_name(
- &mut short_desc,
- &cmd_name,
- scope.clone(),
- rest.clone(),
- name.clone(),
- )?;
- short_desc.insert_value(
- "subcommands",
- make_subcommands_table(
- &mut subcommand_names,
- &cmd_name,
- scope.clone(),
- rest.clone(),
- name.clone(),
- )?,
- );
- ReturnSuccess::value(short_desc.into_value())
- });
-
- Ok(iterator.into_action_stream())
- } else if rest[0].item == "generate_docs" {
- Ok(ActionStream::one(ReturnSuccess::value(generate_docs(
- &scope,
- ))))
- } else if rest.len() == 2 {
- // Check for a subcommand
- let command_name = format!("{} {}", rest[0].item, rest[1].item);
- if let Some(command) = scope.get_command(&command_name) {
- Ok(ActionStream::one(ReturnSuccess::value(
- UntaggedValue::string(get_full_help(command.stream_command(), &scope))
- .into_value(Tag::unknown()),
- )))
- } else {
- Ok(ActionStream::empty())
- }
- } else if let Some(command) = scope.get_command(&rest[0].item) {
- Ok(ActionStream::one(ReturnSuccess::value(
- UntaggedValue::string(get_full_help(command.stream_command(), &scope))
- .into_value(Tag::unknown()),
- )))
- } else {
- Err(ShellError::labeled_error(
- "Can't find command (use 'help commands' for full list)",
- "can't find command",
- rest[0].tag.span,
- ))
- }
- } else {
- let msg = r#"Welcome to Nushell.
-
-Here are some tips to help you get started.
- * help commands - list all available commands
- * help - display help about a particular command
-
-Nushell works on the idea of a "pipeline". Pipelines are commands connected with the '|' character.
-Each stage in the pipeline works together to load, parse, and display information to you.
-
-[Examples]
-
-List the files in the current directory, sorted by size:
- ls | sort-by size
-
-Get information about the current system:
- sys | get host
-
-Get the processes on your system actively using CPU:
- ps | where cpu > 0
-
-You can also learn more at https://www.nushell.sh/book/"#;
-
- Ok(ActionStream::one(ReturnSuccess::value(
- UntaggedValue::string(msg).into_value(Tag::unknown()),
- )))
- }
-}
-
-fn for_spec(name: &str, ty: &str, required: bool, tag: impl Into) -> Value {
- let tag = tag.into();
-
- let mut spec = TaggedDictBuilder::new(tag);
-
- spec.insert_untagged("name", UntaggedValue::string(name));
- spec.insert_untagged("type", UntaggedValue::string(ty));
- spec.insert_untagged(
- "required",
- UntaggedValue::string(if required { "yes" } else { "no" }),
- );
-
- spec.into_value()
-}
-
-pub fn signature_dict(signature: Signature, tag: impl Into) -> Value {
- let tag = tag.into();
- let mut sig = TaggedListBuilder::new(&tag);
-
- for arg in &signature.positional {
- let is_required = matches!(arg.0, PositionalType::Mandatory(_, _));
-
- sig.push_value(for_spec(arg.0.name(), "argument", is_required, &tag));
- }
-
- if signature.rest_positional.is_some() {
- let is_required = false;
- sig.push_value(for_spec("rest", "argument", is_required, &tag));
- }
-
- for (name, ty) in &signature.named {
- match ty.0 {
- NamedType::Mandatory(_, _) => sig.push_value(for_spec(name, "flag", true, &tag)),
- NamedType::Optional(_, _) => sig.push_value(for_spec(name, "flag", false, &tag)),
- NamedType::Switch(_) => sig.push_value(for_spec(name, "switch", false, &tag)),
- }
- }
-
- sig.into_value()
-}
-
-fn command_dict(command: Command, tag: impl Into) -> Value {
- let tag = tag.into();
-
- let mut cmd_dict = TaggedDictBuilder::new(&tag);
-
- cmd_dict.insert_untagged("name", UntaggedValue::string(command.name()));
-
- cmd_dict.insert_untagged("type", UntaggedValue::string("Command"));
-
- cmd_dict.insert_value("signature", signature_dict(command.signature(), tag));
- cmd_dict.insert_untagged("usage", UntaggedValue::string(command.usage()));
-
- cmd_dict.into_value()
-}
-
-#[cfg(test)]
-mod tests {
- use super::Help;
- use super::ShellError;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(Help {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/history.rs b/old_nushell/crates/nu-command/src/commands/core_commands/history.rs
deleted file mode 100644
index 76447b246..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/history.rs
+++ /dev/null
@@ -1,74 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{ReturnSuccess, Signature, UntaggedValue};
-use std::fs::File;
-use std::io::{BufRead, BufReader};
-
-pub struct History;
-
-impl WholeStreamCommand for History {
- fn name(&self) -> &str {
- "history"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("history").switch("clear", "Clears out the history entries", Some('c'))
- }
-
- fn usage(&self) -> &str {
- "Display command history."
- }
-
- fn run_with_actions(&self, args: CommandArgs) -> Result {
- history(args)
- }
-}
-
-fn history(args: CommandArgs) -> Result {
- let tag = args.call_info.name_tag.clone();
- let ctx = &args.context;
-
- let clear = args.has_flag("clear");
-
- let path = if let Some(global_cfg) = &ctx.configs().lock().global_config {
- nu_data::config::path::history_path_or_default(global_cfg)
- } else {
- nu_data::config::path::default_history_path()
- };
-
- if clear {
- // This is a NOOP, the logic to clear is handled in cli.rs
- Ok(ActionStream::empty())
- } else if let Ok(file) = File::open(path) {
- let reader = BufReader::new(file);
- // Skips the first line, which is a Rustyline internal
- let output = reader.lines().skip(1).filter_map(move |line| match line {
- Ok(line) => Some(ReturnSuccess::value(
- UntaggedValue::string(line).into_value(tag.clone()),
- )),
- Err(_) => None,
- });
-
- Ok(output.into_action_stream())
- } else {
- Err(ShellError::labeled_error(
- "Could not open history",
- "history file could not be opened",
- tag,
- ))
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::History;
- use super::ShellError;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(History {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/if_.rs b/old_nushell/crates/nu-command/src/commands/core_commands/if_.rs
deleted file mode 100644
index 85451ec19..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/if_.rs
+++ /dev/null
@@ -1,154 +0,0 @@
-use crate::prelude::*;
-use nu_engine::evaluate_baseline_expr;
-use nu_engine::run_block;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{
- hir::CapturedBlock, hir::ClassifiedCommand, Signature, SyntaxShape, UntaggedValue,
-};
-use nu_stream::OutputStream;
-
-pub struct If;
-
-impl WholeStreamCommand for If {
- fn name(&self) -> &str {
- "if"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("if")
- .required(
- "condition",
- SyntaxShape::MathExpression,
- "the condition that must match",
- )
- .required(
- "then_case",
- SyntaxShape::Block,
- "block to run if condition is true",
- )
- .required(
- "else_case",
- SyntaxShape::Block,
- "block to run if condition is false",
- )
- }
-
- fn usage(&self) -> &str {
- "Run blocks if a condition is true or false."
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- if_command(args)
- }
-
- fn examples(&self) -> Vec {
- vec![
- Example {
- description: "Run a block if a condition is true",
- example: "let x = 10; if $x > 5 { echo 'greater than 5' } { echo 'less than or equal to 5' }",
- result: Some(vec![UntaggedValue::string("greater than 5").into()]),
- },
- Example {
- description: "Run a block if a condition is false",
- example: "let x = 1; if $x > 5 { echo 'greater than 5' } { echo 'less than or equal to 5' }",
- result: Some(vec![UntaggedValue::string("less than or equal to 5").into()]),
- },
- ]
- }
-}
-fn if_command(args: CommandArgs) -> Result {
- let tag = args.call_info.name_tag.clone();
- let external_redirection = args.call_info.args.external_redirection;
- let context = Arc::new(args.context.clone());
-
- let condition: CapturedBlock = args.req(0)?;
- let then_case: CapturedBlock = args.req(1)?;
- let else_case: CapturedBlock = args.req(2)?;
- let input = args.input;
-
- let cond = {
- if condition.block.block.len() != 1 {
- return Err(ShellError::labeled_error(
- "Expected a condition",
- "expected a condition",
- tag,
- ));
- }
- match condition.block.block[0].pipelines.get(0) {
- Some(item) => match item.list.get(0) {
- Some(ClassifiedCommand::Expr(expr)) => expr,
- _ => {
- return Err(ShellError::labeled_error(
- "Expected a condition",
- "expected a condition",
- tag,
- ));
- }
- },
- None => {
- return Err(ShellError::labeled_error(
- "Expected a condition",
- "expected a condition",
- tag,
- ));
- }
- }
- };
-
- context.scope.enter_scope();
- context.scope.add_vars(&condition.captured.entries);
-
- //FIXME: should we use the scope that's brought in as well?
- let condition = evaluate_baseline_expr(cond, &context);
- let result = match condition {
- Ok(condition) => match condition.as_bool() {
- Ok(b) => {
- if b {
- run_block(&then_case.block, &context, input, external_redirection)
- } else {
- run_block(&else_case.block, &context, input, external_redirection)
- }
- }
- Err(e) => Ok(OutputStream::from_stream(
- vec![UntaggedValue::Error(e).into_untagged_value()].into_iter(),
- )),
- },
- Err(e) => Ok(OutputStream::from_stream(
- vec![UntaggedValue::Error(e).into_untagged_value()].into_iter(),
- )),
- };
- context.scope.exit_scope();
- result
-}
-
-#[cfg(test)]
-mod tests {
- use super::If;
- use super::ShellError;
- use nu_test_support::nu;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(If {})
- }
-
- #[test]
- fn if_doesnt_leak_on_error() {
- let actual = nu!(
- ".",
- r#"
- def test-leak [] {
- let var = "hello"
- if 0 == "" {echo ok} {echo not}
- }
- test-leak
- echo $var
- "#
- );
-
- assert!(actual.err.contains("unknown variable"));
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/ignore.rs b/old_nushell/crates/nu-command/src/commands/core_commands/ignore.rs
deleted file mode 100644
index 9283a4885..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/ignore.rs
+++ /dev/null
@@ -1,49 +0,0 @@
-extern crate unicode_segmentation;
-
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::Signature;
-
-pub struct Ignore;
-
-impl WholeStreamCommand for Ignore {
- fn name(&self) -> &str {
- "ignore"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("ignore")
- }
-
- fn usage(&self) -> &str {
- "Ignore the output of the previous command in the pipeline"
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- let _: Vec<_> = args.input.collect();
-
- Ok(OutputStream::empty())
- }
-
- fn examples(&self) -> Vec {
- vec![Example {
- description: "Ignore the output of an echo command",
- example: r#"echo done | ignore"#,
- result: None,
- }]
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::Ignore;
- use super::ShellError;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(Ignore {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/let_.rs b/old_nushell/crates/nu-command/src/commands/core_commands/let_.rs
deleted file mode 100644
index fb52df72b..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/let_.rs
+++ /dev/null
@@ -1,112 +0,0 @@
-use crate::prelude::*;
-use nu_engine::{evaluate_baseline_expr, FromValue, WholeStreamCommand};
-
-use nu_errors::ShellError;
-use nu_protocol::{
- hir::{CapturedBlock, ClassifiedCommand},
- Signature, SyntaxShape, UntaggedValue,
-};
-
-pub struct Let;
-
-impl WholeStreamCommand for Let {
- fn name(&self) -> &str {
- "let"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("let")
- .required("name", SyntaxShape::String, "the name of the variable")
- .required("equals", SyntaxShape::String, "the equals sign")
- .required(
- "expr",
- SyntaxShape::MathExpression,
- "the value for the variable",
- )
- }
-
- fn usage(&self) -> &str {
- "Create a variable and give it a value."
- }
-
- fn run_with_actions(&self, args: CommandArgs) -> Result {
- letcmd(args)
- }
-
- fn examples(&self) -> Vec {
- vec![
- Example {
- description: "Assign a simple value to a variable",
- example: "let x = 3",
- result: Some(vec![]),
- },
- Example {
- description: "Assign the result of an expression to a variable",
- example: "let result = (3 + 7); echo $result",
- result: Some(vec![UntaggedValue::int(1).into()]),
- },
- Example {
- description: "Create a variable using the full name",
- example: "let $three = 3",
- result: Some(vec![]),
- },
- ]
- }
-}
-
-pub fn letcmd(args: CommandArgs) -> Result {
- let ctx = &args.context;
- let positional = args
- .call_info
- .args
- .positional
- .expect("Internal error: type checker should require args");
-
- let var_name = positional[0].var_name()?;
- let rhs_raw = evaluate_baseline_expr(&positional[2], ctx)?;
- let tag: Tag = positional[2].span.into();
-
- let rhs: CapturedBlock = FromValue::from_value(&rhs_raw)?;
-
- let (expr, _) = {
- if rhs.block.block.len() != 1 {
- return Err(ShellError::labeled_error(
- "Expected a value",
- "expected a value",
- tag,
- ));
- }
- match rhs.block.block[0].pipelines.get(0) {
- Some(item) => match item.list.get(0) {
- Some(ClassifiedCommand::Expr(expr)) => (expr, &rhs.captured),
- _ => {
- return Err(ShellError::labeled_error(
- "Expected a value",
- "expected a value",
- tag,
- ));
- }
- },
- None => {
- return Err(ShellError::labeled_error(
- "Expected a value",
- "expected a value",
- tag,
- ));
- }
- }
- };
-
- ctx.scope.enter_scope();
- let value = evaluate_baseline_expr(expr, ctx);
- ctx.scope.exit_scope();
-
- let value = value?;
-
- // Note: this is a special case for setting the context from a command
- // In this case, if we don't set it now, we'll lose the scope that this
- // variable should be set into.
- ctx.scope.add_var(var_name, value);
-
- Ok(ActionStream::empty())
-}
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/mod.rs b/old_nushell/crates/nu-command/src/commands/core_commands/mod.rs
deleted file mode 100644
index c7fd932d5..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/mod.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-mod alias;
-mod debug;
-mod def;
-mod describe;
-mod do_;
-pub(crate) mod echo;
-mod error;
-mod find;
-mod help;
-mod history;
-mod if_;
-mod ignore;
-mod let_;
-mod nu_plugin;
-mod nu_signature;
-mod source;
-mod tags;
-mod tutor;
-mod unalias;
-mod version;
-
-pub use self::nu_plugin::SubCommand as NuPlugin;
-pub use self::nu_signature::{
- loglevels, testbins, version as core_version, Command as NuSignature,
-};
-pub use alias::Alias;
-pub use debug::Debug;
-pub use def::Def;
-pub use describe::Describe;
-pub use do_::Do;
-pub use echo::Echo;
-pub use error::*;
-pub use find::Find;
-pub use help::Help;
-pub use history::History;
-pub use if_::If;
-pub use ignore::Ignore;
-pub use let_::Let;
-pub use source::Source;
-pub use tags::Tags;
-pub use tutor::Tutor;
-pub use unalias::Unalias;
-pub use version::{version, Version};
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/nu_plugin.rs b/old_nushell/crates/nu-command/src/commands/core_commands/nu_plugin.rs
deleted file mode 100644
index 0f91a6c14..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/nu_plugin.rs
+++ /dev/null
@@ -1,120 +0,0 @@
-use std::path::PathBuf;
-
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-
-use nu_errors::ShellError;
-use nu_path::canonicalize_with;
-use nu_protocol::{CommandAction, ReturnSuccess, Signature, SyntaxShape, UntaggedValue};
-use nu_source::Tagged;
-
-#[cfg(unix)]
-use std::os::unix::fs::PermissionsExt;
-
-pub struct SubCommand;
-
-#[derive(Deserialize)]
-pub struct Arguments {
- #[serde(rename = "load")]
- pub load_path: Option>,
-}
-
-impl WholeStreamCommand for SubCommand {
- fn name(&self) -> &str {
- "nu plugin"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("nu plugin").named(
- "load",
- SyntaxShape::FilePath,
- "a path to load the plugins from",
- Some('l'),
- )
- }
-
- fn usage(&self) -> &str {
- "Nu Plugin"
- }
-
- fn examples(&self) -> Vec {
- vec![Example {
- description: "Load all plugins in the current directory",
- example: "nu plugin --load .",
- result: None,
- }]
- }
-
- fn run_with_actions(&self, args: CommandArgs) -> Result {
- let scope = args.scope().clone();
- let shell_manager = args.shell_manager();
-
- let load_path: Option> = args.get_flag("load")?;
-
- if let Some(Tagged {
- item: load_path,
- tag,
- }) = load_path
- {
- let path = canonicalize_with(load_path, shell_manager.path()).map_err(|_| {
- ShellError::labeled_error(
- "Cannot load plugins from directory",
- "directory not found",
- &tag,
- )
- })?;
-
- if !path.is_dir() {
- return Err(ShellError::labeled_error(
- "Cannot load plugins from directory",
- "is not a directory",
- &tag,
- ));
- }
-
- #[cfg(unix)]
- {
- let has_exec = path
- .metadata()
- .map(|m| umask::Mode::from(m.permissions().mode()).has(umask::USER_READ))
- .map_err(|e| {
- ShellError::labeled_error(
- "Cannot load plugins from directory",
- format!("cannot stat ({})", e),
- &tag,
- )
- })?;
-
- if !has_exec {
- return Err(ShellError::labeled_error(
- "Cannot load plugins from directory",
- "permission denied",
- &tag,
- ));
- }
- }
-
- return Ok(vec![ReturnSuccess::action(CommandAction::AddPlugins(
- path.to_string_lossy().to_string(),
- ))]
- .into());
- }
-
- Ok(ActionStream::one(ReturnSuccess::value(
- UntaggedValue::string(get_full_help(&SubCommand, &scope)).into_value(Tag::unknown()),
- )))
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::ShellError;
- use super::SubCommand;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(SubCommand {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/nu_signature.rs b/old_nushell/crates/nu-command/src/commands/core_commands/nu_signature.rs
deleted file mode 100644
index d8a74295d..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/nu_signature.rs
+++ /dev/null
@@ -1,71 +0,0 @@
-use nu_engine::WholeStreamCommand;
-use nu_protocol::{Signature, SyntaxShape};
-
-pub struct Command;
-
-impl WholeStreamCommand for Command {
- fn name(&self) -> &str {
- "nu"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("nu")
- .switch("version", "Display Nu version", Some('v'))
- .switch("stdin", "redirect stdin", None)
- .switch("skip-plugins", "do not load plugins", None)
- .switch("no-history", "don't save history", None)
- .switch("perf", "show startup performance metrics", None)
- .switch("login", "start Nu as if it was a login shell", Some('l'))
- .named(
- "commands",
- SyntaxShape::String,
- "commands to run",
- Some('c'),
- )
- .named(
- "testbin",
- SyntaxShape::String,
- "test bin: echo_env, cococo, iecho, fail, nonu, chop, repeater, meow",
- None,
- )
- .named("develop", SyntaxShape::String, "trace mode", None)
- .named("debug", SyntaxShape::String, "debug mode", None)
- .named(
- "loglevel",
- SyntaxShape::String,
- "LEVEL: error, warn, info, debug, trace",
- None,
- )
- .named(
- "config-file",
- SyntaxShape::FilePath,
- "custom configuration source file",
- None,
- )
- .rest("rest", SyntaxShape::String, "source file(s) to run")
- }
-
- fn usage(&self) -> &str {
- "Nu - A new type of shell."
- }
-}
-
-pub fn version() -> &'static str {
- env!("CARGO_PKG_VERSION")
-}
-
-pub fn testbins() -> Vec {
- vec![
- "echo_env", "cococo", "iecho", "fail", "nonu", "chop", "repeater", "meow",
- ]
- .into_iter()
- .map(String::from)
- .collect()
-}
-
-pub fn loglevels() -> Vec {
- vec!["error", "warn", "info", "debug", "trace"]
- .into_iter()
- .map(String::from)
- .collect()
-}
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/source.rs b/old_nushell/crates/nu-command/src/commands/core_commands/source.rs
deleted file mode 100644
index 862ef6286..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/source.rs
+++ /dev/null
@@ -1,123 +0,0 @@
-use crate::prelude::*;
-use nu_engine::{script, WholeStreamCommand};
-
-use nu_errors::ShellError;
-use nu_path::{canonicalize, canonicalize_with};
-use nu_protocol::{Signature, SyntaxShape};
-use nu_source::Tagged;
-
-use std::path::Path;
-
-pub struct Source;
-
-#[derive(Deserialize)]
-pub struct SourceArgs {
- pub filename: Tagged,
-}
-
-impl WholeStreamCommand for Source {
- fn name(&self) -> &str {
- "source"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("source").required(
- "filename",
- SyntaxShape::FilePath,
- "the filepath to the script file to source",
- )
- }
-
- fn usage(&self) -> &str {
- "Runs a script file in the current context."
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- source(args)
- }
-
- fn examples(&self) -> Vec {
- vec![]
- }
-}
-
-pub fn source(args: CommandArgs) -> Result {
- let ctx = &args.context;
- let filename: Tagged = args.req(0)?;
-
- let source_file = Path::new(&filename.item);
-
- // Note: this is a special case for setting the context from a command
- // In this case, if we don't set it now, we'll lose the scope that this
- // variable should be set into.
-
- let lib_dirs = &ctx
- .configs()
- .lock()
- .global_config
- .as_ref()
- .map(|configuration| match configuration.var("lib_dirs") {
- Some(paths) => paths
- .table_entries()
- .cloned()
- .map(|path| path.as_string())
- .collect(),
- None => vec![],
- });
-
- if let Some(dir) = lib_dirs {
- for lib_path in dir {
- match lib_path {
- Ok(name) => {
- let path = if let Ok(p) = canonicalize_with(&source_file, name) {
- p
- } else {
- continue;
- };
-
- if let Ok(contents) = std::fs::read_to_string(path) {
- let result = script::run_script_standalone(contents, true, ctx, false);
-
- if let Err(err) = result {
- ctx.error(err);
- }
- return Ok(OutputStream::empty());
- }
- }
- Err(reason) => {
- ctx.error(reason.clone());
- }
- }
- }
- }
-
- let path = canonicalize(source_file).map_err(|e| {
- ShellError::labeled_error(
- format!("Can't load source file. Reason: {}", e),
- "Can't load this file",
- filename.span(),
- )
- })?;
-
- let contents = std::fs::read_to_string(path);
-
- match contents {
- Ok(contents) => {
- let result = script::run_script_standalone(contents, true, ctx, false);
-
- if let Err(err) = result {
- ctx.error(err);
- }
- Ok(OutputStream::empty())
- }
- Err(e) => {
- ctx.error(ShellError::labeled_error(
- format!("Can't load source file. Reason: {}", e),
- "Can't load this file",
- filename.span(),
- ));
-
- Ok(OutputStream::empty())
- }
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/tags.rs b/old_nushell/crates/nu-command/src/commands/core_commands/tags.rs
deleted file mode 100644
index 73e39b274..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/tags.rs
+++ /dev/null
@@ -1,92 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{Primitive, Signature, TaggedDictBuilder, UntaggedValue, Value};
-
-pub struct Tags;
-
-impl WholeStreamCommand for Tags {
- fn name(&self) -> &str {
- "tags"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("tags")
- }
-
- fn usage(&self) -> &str {
- "Read the tags (metadata) for values."
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- Ok(tags(args))
- }
-}
-
-fn build_tag_table(tag: impl Into) -> Value {
- let tag = tag.into();
- let span = tag.span;
-
- TaggedDictBuilder::build(tag.clone(), |tags| {
- if let Some(anchor) = anchor_as_value(&tag) {
- tags.insert_value("anchor", anchor);
- }
-
- tags.insert_value(
- "span",
- TaggedDictBuilder::build(tag.clone(), |span_dict| {
- span_dict.insert_untagged("start", UntaggedValue::int(span.start() as i64));
- span_dict.insert_untagged("end", UntaggedValue::int(span.end() as i64));
- }),
- );
- })
-}
-
-fn tags(args: CommandArgs) -> OutputStream {
- if args.input.is_empty() {
- OutputStream::one(build_tag_table(&args.name_tag()))
- } else {
- args.input
- .map(move |v| build_tag_table(v.tag()))
- .into_output_stream()
- }
-}
-
-fn anchor_as_value(tag: &Tag) -> Option {
- let anchor = tag.anchor.as_ref();
-
- anchor.as_ref()?;
-
- Some(TaggedDictBuilder::build(tag, |table| {
- let value = match anchor {
- Some(AnchorLocation::File(path)) => {
- Some(("file", UntaggedValue::from(path.to_string())))
- }
- Some(AnchorLocation::Url(destination)) => {
- Some(("url", UntaggedValue::from(destination.to_string())))
- }
- Some(AnchorLocation::Source(text)) => Some((
- "source",
- UntaggedValue::Primitive(Primitive::String(text.to_string())),
- )),
- None => None,
- };
-
- if let Some((key, value)) = value {
- table.insert_untagged(key, value);
- }
- }))
-}
-
-#[cfg(test)]
-mod tests {
- use super::ShellError;
- use super::Tags;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(Tags {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/tutor.rs b/old_nushell/crates/nu-command/src/commands/core_commands/tutor.rs
deleted file mode 100644
index 284515ae5..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/tutor.rs
+++ /dev/null
@@ -1,431 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{Signature, SyntaxShape, UntaggedValue};
-
-pub struct Tutor;
-
-impl WholeStreamCommand for Tutor {
- fn name(&self) -> &str {
- "tutor"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("tutor")
- .optional(
- "search",
- SyntaxShape::String,
- "item to search for, or 'list' to list available tutorials",
- )
- .named(
- "find",
- SyntaxShape::String,
- "Search tutorial for a phrase",
- Some('f'),
- )
- }
-
- fn usage(&self) -> &str {
- "Run the tutorial. To begin, run: tutor"
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- tutor(args)
- }
-
- fn examples(&self) -> Vec {
- vec![
- Example {
- description: "Begin the tutorial",
- example: "tutor begin",
- result: None,
- },
- Example {
- description: "Search a tutorial by phrase",
- example: "tutor -f \"$in\"",
- result: None,
- },
- ]
- }
-}
-
-fn tutor(args: CommandArgs) -> Result {
- let tag = args.name_tag();
- let scope = args.scope().clone();
-
- let search: Option = args.opt(0).unwrap_or(None);
- let find: Option = args.get_flag("find")?;
-
- let search_space = [
- (vec!["begin"], begin_tutor()),
- (
- vec!["table", "tables", "row", "rows", "column", "columns"],
- table_tutor(),
- ),
- (vec!["cell", "cells"], cell_tutor()),
- (
- vec![
- "expr",
- "exprs",
- "expressions",
- "subexpression",
- "subexpressions",
- "sub-expression",
- "sub-expressions",
- ],
- expression_tutor(),
- ),
- (vec!["echo"], echo_tutor()),
- (vec!["each", "iteration", "iter"], each_tutor()),
- (
- vec!["var", "vars", "variable", "variables"],
- variable_tutor(),
- ),
- (vec!["engine-q", "e-q"], engineq_tutor()),
- (vec!["block", "blocks"], block_tutor()),
- (vec!["shorthand", "shorthands"], shorthand_tutor()),
- ];
-
- if let Some(find) = find {
- let mut results = vec![];
- for search_group in search_space {
- if search_group.1.contains(&find) {
- results.push(search_group.0[0].to_string())
- }
- }
-
- let message = format!("You can find '{}' in the following topics:\n{}\n\nYou can learn about a topic using `tutor` followed by the name of the topic.\nFor example: `tutor table` to open the table topic.\n\n",
- find,
- results.into_iter().map(|x| format!("- {}", x)).join("\n")
- );
-
- return Ok(display(tag, &scope, &message));
- } else if let Some(search) = search {
- for search_group in search_space {
- if search_group.0.contains(&search.as_str()) {
- return Ok(display(tag, &scope, search_group.1));
- }
- }
- }
- Ok(display(tag, &scope, default_tutor()))
-}
-
-fn default_tutor() -> &'static str {
- r#"
-Welcome to the Nushell tutorial!
-
-With the `tutor` command, you'll be able to learn a lot about how Nushell
-works along with many fun tips and tricks to speed up everyday tasks.
-
-To get started, you can use `tutor begin`.
-
-"#
-}
-
-fn begin_tutor() -> &'static str {
- r#"
-Nushell is a structured shell and programming language. One way to begin
-using it is to try a few of the commands.
-
-The first command to try is `ls`. The `ls` command will show you a list
-of the files in the current directory. Notice that these files are shown
-as a table. Each column of this table not only tells us what is being
-shown, but also gives us a way to work with the data.
-
-You can combine the `ls` command with other commands using the pipeline
-symbol '|'. This allows data to flow from one command to the next.
-
-For example, if we only wanted the name column, we could do:
-```
-ls | select name
-```
-Notice that we still get a table, but this time it only has one column:
-the name column.
-
-You can continue to learn more about tables by running:
-```
-tutor tables
-```
-If at any point, you'd like to restart this tutorial, you can run:
-```
-tutor begin
-```
-"#
-}
-
-fn table_tutor() -> &'static str {
- r#"
-The most common form of data in Nushell is the table. Tables contain rows and
-columns of data. In each cell of the table, there is data that you can access
-using Nushell commands.
-
-To get the 3rd row in the table, you can use the `nth` command:
-```
-ls | nth 2
-```
-This will get the 3rd (note that `nth` is zero-based) row in the table created
-by the `ls` command. You can use `nth` on any table created by other commands
-as well.
-
-You can also access the column of data in one of two ways. If you want
-to keep the column as part of a new table, you can use `select`.
-```
-ls | select name
-```
-This runs `ls` and returns only the "name" column of the table.
-
-If, instead, you'd like to get access to the values inside of the column, you
-can use the `get` command.
-```
-ls | get name
-```
-This allows us to get to the list of strings that are the filenames rather
-than having a full table. In some cases, this can make the names easier to
-work with.
-
-You can continue to learn more about working with cells of the table by
-running:
-```
-tutor cells
-```
-"#
-}
-
-fn cell_tutor() -> &'static str {
- r#"
-Working with cells of data in the table is a key part of working with data in
-Nushell. Because of this, there is a rich list of commands to work with cells
-as well as handy shorthands for accessing cells.
-
-Cells can hold simple values like strings and numbers, or more complex values
-like lists and tables.
-
-To reach a cell of data from a table, you can combine a row operation and a
-column operation.
-```
-ls | nth 4 | get name
-```
-You can combine these operations into one step using a shortcut.
-```
-(ls).4.name
-```
-Names/strings represent columns names and numbers represent row numbers.
-
-The `(ls)` is a form of expression. You can continue to learn more about
-expressions by running:
-```
-tutor expressions
-```
-You can also learn about these cell shorthands by running:
-```
-tutor shorthands
-```
-"#
-}
-
-fn expression_tutor() -> &'static str {
- r#"
-Expressions give you the power to mix calls to commands with math. The
-simplest expression is a single value like a string or number.
-```
-3
-```
-Expressions can also include math operations like addition or division.
-```
-10 / 2
-```
-Normally, an expression is one type of operation: math or commands. You can
-mix these types by using subexpressions. Subexpressions are just like
-expressions, but they're wrapped in parentheses `()`.
-```
-10 * (3 + 4)
-```
-Here we use parentheses to create a higher math precedence in the math
-expression.
-```
-echo (2 + 3)
-```
-You can continue to learn more about the `echo` command by running:
-```
-tutor echo
-```
-"#
-}
-
-fn echo_tutor() -> &'static str {
- r#"
-The `echo` command in Nushell is a powerful tool for not only seeing values,
-but also for creating new ones.
-```
-echo "Hello"
-```
-You can echo output. This output, if it's not redirected using a "|" pipeline
-will be displayed to the screen.
-```
-echo 1..10
-```
-You can also use echo to work with individual values of a range. In this
-example, `echo` will create the values from 1 to 10 as a list.
-```
-echo 1 2 3 4 5
-```
-You can also create lists of values by passing `echo` multiple arguments.
-This can be helpful if you want to later processes these values.
-
-The `echo` command can pair well with the `each` command which can run
-code on each row, or item, of input.
-
-You can continue to learn more about the `each` command by running:
-```
-tutor each
-```
-"#
-}
-
-fn each_tutor() -> &'static str {
- r#"
-The `each` command gives us a way of working with each individual row or
-element of a list one at a time. It reads these in from the pipeline and
-runs a block on each element. A block is a group of pipelines.
-```
-echo 1 2 3 | each { $it + 10}
-```
-This example iterates over each element sent by `echo`, giving us three new
-values that are the original value + 10. Here, the `$it` is a variable that
-is the name given to the block's parameter by default.
-
-You can learn more about blocks by running:
-```
-tutor blocks
-```
-You can also learn more about variables by running:
-```
-tutor variables
-```
-"#
-}
-
-fn variable_tutor() -> &'static str {
- r#"
-Variables are an important way to store values to be used later. To create a
-variable, you can use the `let` keyword. The `let` command will create a
-variable and then assign it a value in one step.
-```
-let $x = 3
-```
-Once created, we can refer to this variable by name.
-```
-$x
-```
-Nushell also comes with built-in variables. The `$nu` variable is a reserved
-variable that contains a lot of information about the currently running
-instance of Nushell. The `$it` variable is the name given to block parameters
-if you don't specify one. And `$in` is the variable that allows you to work
-with all of the data coming in from the pipeline in one place.
-
-"#
-}
-
-fn block_tutor() -> &'static str {
- r#"
-Blocks are a special form of expression that hold code to be run at a later
-time. Often, you'll see blocks as one of the arguments given to commands
-like `each` and `if`.
-```
-ls | each {|x| $x.name}
-```
-The above will create a list of the filenames in the directory.
-```
-if $true { echo "it's true" } { echo "it's not true" }
-```
-This `if` call will run the first block if the expression is true, or the
-second block if the expression is false.
-
-"#
-}
-
-fn shorthand_tutor() -> &'static str {
- r#"
-You can access cells in a table using a shorthand notation sometimes called a
-"column path" or "cell path". These paths allow you to go from a table to
-rows, columns, or cells inside of the table.
-
-Shorthand paths are made from rows numbers, column names, or both. You can use
-them on any variable or subexpression.
-```
-$nu.cwd
-```
-The above accesses the built-in `$nu` variable, gets its table, and then uses
-the shorthand path to retrieve only the cell data inside the "cwd" column.
-```
-(ls).name.4
-```
-This will retrieve the cell data in the "name" column on the 5th row (note:
-row numbers are zero-based).
-
-Rows and columns don't need to come in any specific order. You can get the
-same value using:
-```
-(ls).4.name
-```
-"#
-}
-
-fn engineq_tutor() -> &'static str {
- r#"
-Engine-q is the upcoming engine for Nushell. Build for speed and correctness,
-it also comes with a set of changes from Nushell versions prior to 0.60. To
-get ready for engine-q look for some of these changes that might impact your
-current scripts:
-
-* Engine-q now uses a few new data structures, including a record syntax
- that allows you to model key-value pairs similar to JSON objects.
-* Environment variables can now contain more than just strings. Structured
- values are converted to strings for external commands using converters.
-* `if` will now use an `else` keyword before the else block.
-* We're moving from "config.toml" to "config.nu". This means startup will
- now be a script file.
-* `config` and its subcommands are being replaced by a record that you can
- update in the shell which contains all the settings under the variable
- `$config`.
-* bigint/bigdecimal values are now machine i64 and f64 values
-* And more, you can read more about upcoming changes in the up-to-date list
- at: https://github.com/nushell/engine-q/issues/522
-"#
-}
-
-fn display(tag: Tag, scope: &Scope, help: &str) -> OutputStream {
- let help = help.split('`');
-
- let mut build = String::new();
- let mut code_mode = false;
- let palette = nu_engine::DefaultPalette {};
-
- for item in help {
- if code_mode {
- code_mode = false;
-
- //TODO: support no-color mode
- let colored_example = nu_engine::Painter::paint_string(item, scope, &palette);
- build.push_str(&colored_example);
- } else {
- code_mode = true;
- build.push_str(item);
- }
- }
-
- OutputStream::one(UntaggedValue::string(build).into_value(tag))
-}
-
-#[cfg(test)]
-mod tests {
- use super::ShellError;
- use super::Tutor;
-
- #[test]
- fn examples_work_as_expected() -> Result<(), ShellError> {
- use crate::examples::test as test_examples;
-
- test_examples(Tutor {})
- }
-}
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/unalias.rs b/old_nushell/crates/nu-command/src/commands/core_commands/unalias.rs
deleted file mode 100644
index 75de72b95..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/unalias.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-use crate::prelude::*;
-use nu_engine::WholeStreamCommand;
-
-use nu_errors::ShellError;
-use nu_protocol::{Signature, SyntaxShape};
-
-pub struct Unalias;
-
-impl WholeStreamCommand for Unalias {
- fn name(&self) -> &str {
- "unalias"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("unalias").required("name", SyntaxShape::String, "the name of the alias")
- }
-
- fn usage(&self) -> &str {
- "Removes an alias"
- }
-
- fn run(&self, args: CommandArgs) -> Result {
- unalias(args)
- }
-
- fn examples(&self) -> Vec {
- vec![Example {
- description: "Remove the 'v' alias",
- example: "unalias v",
- result: None,
- }]
- }
-}
-
-pub fn unalias(_: CommandArgs) -> Result {
- Ok(OutputStream::empty())
-}
diff --git a/old_nushell/crates/nu-command/src/commands/core_commands/version.rs b/old_nushell/crates/nu-command/src/commands/core_commands/version.rs
deleted file mode 100644
index dcd08bcf0..000000000
--- a/old_nushell/crates/nu-command/src/commands/core_commands/version.rs
+++ /dev/null
@@ -1,315 +0,0 @@
-use crate::prelude::*;
-use indexmap::IndexMap;
-use nu_engine::WholeStreamCommand;
-use nu_errors::ShellError;
-use nu_protocol::{value::StrExt, value::StringExt, Dictionary, Signature, UntaggedValue};
-
-pub mod shadow {
- include!(concat!(env!("OUT_DIR"), "/shadow.rs"));
-}
-
-pub struct Version;
-
-impl WholeStreamCommand for Version {
- fn name(&self) -> &str {
- "version"
- }
-
- fn signature(&self) -> Signature {
- Signature::build("version")
- }
-
- fn usage(&self) -> &str {
- "Display Nu version."
- }
-
- fn run(&self, args: CommandArgs) -> Result