Move some plugins back to being core shippable plugins

This commit is contained in:
Jonathan Turner 2019-12-10 13:05:40 +13:00
parent 7d70b5feda
commit 88f899d341
13 changed files with 102 additions and 290 deletions

232
Cargo.lock generated
View File

@ -153,13 +153,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36a698e449024a5d18994a815998bf5e2e4bc1883e35a7d7ba95b6b69ee45907"
dependencies = [
"cfg-if",
"core-foundation 0.6.4",
"core-foundation",
"lazycell",
"libc",
"mach 0.2.3",
"nix 0.15.0",
"num-traits 0.2.10",
"uom",
"uom 0.26.0",
"winapi 0.3.8",
]
@ -418,17 +418,7 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d"
dependencies = [
"core-foundation-sys 0.6.2",
"libc",
]
[[package]]
name = "core-foundation"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171"
dependencies = [
"core-foundation-sys 0.7.0",
"core-foundation-sys",
"libc",
]
@ -438,12 +428,6 @@ version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b"
[[package]]
name = "core-foundation-sys"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"
[[package]]
name = "crc32fast"
version = "1.2.0"
@ -922,31 +906,6 @@ version = "0.1.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef"
[[package]]
name = "futures"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6f16056ecbb57525ff698bb955162d0cd03bee84e6241c27ff75c08d8ca5987"
dependencies = [
"futures-channel",
"futures-core",
"futures-executor",
"futures-io",
"futures-sink",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-channel"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcae98ca17d102fd8a3603727b9259fcf7fa4239b603d2142926189bc8999b86"
dependencies = [
"futures-core",
"futures-sink",
]
[[package]]
name = "futures-channel-preview"
version = "0.3.0-alpha.19"
@ -969,17 +928,6 @@ version = "0.3.0-alpha.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b35b6263fb1ef523c3056565fa67b1d16f0a8604ff12b11b08c25f28a734c60a"
[[package]]
name = "futures-executor"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e274736563f686a837a0568b478bdabfeaec2dca794b5649b04e2fe1627c231"
dependencies = [
"futures-core",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-executor-preview"
version = "0.3.0-alpha.19"
@ -991,12 +939,6 @@ dependencies = [
"num_cpus",
]
[[package]]
name = "futures-io"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e676577d229e70952ab25f3945795ba5b16d63ca794ca9d2c860e5595d20b5ff"
[[package]]
name = "futures-io-preview"
version = "0.3.0-alpha.19"
@ -1029,12 +971,6 @@ dependencies = [
"futures-util-preview",
]
[[package]]
name = "futures-sink"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "171be33efae63c2d59e6dbba34186fe0d6394fb378069a76dfd80fdcffd43c16"
[[package]]
name = "futures-sink-preview"
version = "0.3.0-alpha.19"
@ -1049,9 +985,13 @@ checksum = "0bae52d6b29cf440e298856fec3965ee6fa71b06aa7495178615953fd669e5f9"
[[package]]
name = "futures-timer"
version = "2.0.2"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1de7508b218029b0f01662ed8f61b1c964b3ae99d6f25462d0f55a595109df6"
checksum = "7946248e9429ff093345d3e8fdf4eb0f9b2d79091611c9c14f744971a6f8be45"
dependencies = [
"futures-core-preview",
"pin-utils",
]
[[package]]
name = "futures-util"
@ -1059,19 +999,13 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0d66274fb76985d3c62c886d1da7ac4c0903a8c9f754e8fe0f35a6a6cc39e76"
dependencies = [
"futures 0.1.29",
"futures-channel",
"futures-core",
"futures-io",
"futures-macro",
"futures-sink",
"futures-task",
"memchr",
"pin-utils",
"proc-macro-hack",
"proc-macro-nested",
"slab",
"tokio-io",
]
[[package]]
@ -1080,7 +1014,7 @@ version = "0.3.0-alpha.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ce968633c17e5f97936bd2797b6e38fb56cf16a7422319f7ec2e30d3c470e8d"
dependencies = [
"futures 0.1.29",
"futures",
"futures-channel-preview",
"futures-core-preview",
"futures-io-preview",
@ -1174,9 +1108,9 @@ dependencies = [
[[package]]
name = "heim"
version = "0.0.9"
version = "0.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28f11cfed41a4703f8f56ccbe411073c52bd3996d92e3ccac90d36bd0e86e0eb"
checksum = "de848466ae9659d5ab634615bdd0b7d558a41ae524ee4d59c880d12499af5b77"
dependencies = [
"heim-common",
"heim-cpu",
@ -1193,28 +1127,28 @@ dependencies = [
[[package]]
name = "heim-common"
version = "0.0.9"
version = "0.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f97d185137ab6437750cb22a115d4c64027620d48c57893d31720abcba42c388"
checksum = "63f408c31e695732096a0383df16cd3efee4adb32ba3ad086fb85a7dc8f53100"
dependencies = [
"cfg-if",
"core-foundation 0.7.0",
"futures-core",
"futures-util",
"core-foundation",
"futures-core-preview",
"futures-util-preview",
"lazy_static 1.4.0",
"libc",
"mach 0.3.2",
"nix 0.16.0",
"nix 0.15.0",
"pin-utils",
"uom",
"uom 0.25.0",
"winapi 0.3.8",
]
[[package]]
name = "heim-cpu"
version = "0.0.9"
version = "0.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "328091d34621a28af550523e1c139749fa4bc4590a8ea91b160a0f4b82dd8b06"
checksum = "5785004dfdbd68a814d504b27b8ddc16c748a856835dfb6e65b15142090664ef"
dependencies = [
"cfg-if",
"heim-common",
@ -1228,9 +1162,9 @@ dependencies = [
[[package]]
name = "heim-derive"
version = "0.0.9"
version = "0.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc97d9bf8ca9af8a02a533acea548756f23d4759474a1df8e79eb2b57f3cf7ac"
checksum = "9573bedf4673c1b254bce7f1521559329d2b27995b693b695fa13be2b15c188b"
dependencies = [
"proc-macro2",
"quote",
@ -1239,13 +1173,13 @@ dependencies = [
[[package]]
name = "heim-disk"
version = "0.0.9"
version = "0.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82179359c7b215ae46fe8ac0f9015b8e5dfd6368cd0d113f261b28cb8993713f"
checksum = "c84980e62564828ae4ca70a8bfbdb0f139cc89abb6c91b8b4809518346a72366"
dependencies = [
"bitflags",
"cfg-if",
"core-foundation 0.7.0",
"core-foundation",
"heim-common",
"heim-derive",
"heim-runtime",
@ -1257,9 +1191,9 @@ dependencies = [
[[package]]
name = "heim-host"
version = "0.0.9"
version = "0.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64b9c8c5f7d1479102a503e3f233241bfb819bf916f02b15e10ba5fbfee7a7f3"
checksum = "1de019d5969f6bab766311be378788bd1bb068b59c4f3861c539a420fc258ed3"
dependencies = [
"cfg-if",
"heim-common",
@ -1274,9 +1208,9 @@ dependencies = [
[[package]]
name = "heim-memory"
version = "0.0.9"
version = "0.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d04e9e068b57049062622cf4a182a45f320459e266c39dfc52ca65fc8c178e3a"
checksum = "a9cdbe6433197da8387dcd0cf1afd9184db4385d55f8a76355b28ceabe99cdc5"
dependencies = [
"cfg-if",
"heim-common",
@ -1290,9 +1224,9 @@ dependencies = [
[[package]]
name = "heim-net"
version = "0.0.9"
version = "0.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c6323430ecae9b74378b37d0078768989c98b570daacec1d899737d90d72a5b"
checksum = "7b0f5e590eb2f8b23229ff4b06f7e7aee0e229837d3697f362014343682ae073"
dependencies = [
"bitflags",
"cfg-if",
@ -1302,14 +1236,14 @@ dependencies = [
"hex 0.4.0",
"libc",
"macaddr",
"nix 0.16.0",
"nix 0.15.0",
]
[[package]]
name = "heim-process"
version = "0.0.9"
version = "0.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b20a58b335dc9837088b2c9290822b55c661071cb542f0002e62ed18e8464379"
checksum = "a64874316339b9c0c7953e7a87d2b32e2400bf6778650ac11b76b05d3c37e121"
dependencies = [
"cfg-if",
"darwin-libproc",
@ -1330,12 +1264,12 @@ dependencies = [
[[package]]
name = "heim-runtime"
version = "0.0.5"
version = "0.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f87591c7b202868445a7da04b3d8f987b0672dd68c3d66e24fe8f759171dd612"
checksum = "13ef10b5ab5a501e6537b1414db0e3c488425d88bb131bd4e9ff7c0e61e5fbd1"
dependencies = [
"cfg-if",
"futures-channel",
"futures-channel-preview",
"heim-common",
"lazy_static 1.4.0",
"threadpool",
@ -1343,9 +1277,9 @@ dependencies = [
[[package]]
name = "heim-sensors"
version = "0.0.4"
version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f663425e6ed38a6356ee5751a2ebae421f7449fd0507b7e698c7e1e9fabee0c"
checksum = "8ad8b3c9032bca1a76dd43e1eb5c8044e0c505343cb21949dc7acd1bc55b408b"
dependencies = [
"cfg-if",
"heim-common",
@ -1355,9 +1289,9 @@ dependencies = [
[[package]]
name = "heim-virt"
version = "0.0.9"
version = "0.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dd975e9ca42170c0f65102b867e69c3d060027f9bb02fb29cc554f7a0e5680b"
checksum = "bb2dda5314da10a8fbcdf130c065abc65f02c3ace72c6f143ad4537520536e2b"
dependencies = [
"cfg-if",
"heim-common",
@ -1850,19 +1784,6 @@ dependencies = [
"void",
]
[[package]]
name = "nix"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19a8300bf427d432716764070ff70d5b2b7801c958b9049686e6cbd8b06fad92"
dependencies = [
"bitflags",
"cc",
"cfg-if",
"libc",
"void",
]
[[package]]
name = "nodrop"
version = "0.1.14"
@ -1939,6 +1860,7 @@ dependencies = [
"app_dirs",
"async-stream",
"base64 0.11.0",
"battery",
"bigdecimal",
"bson",
"byte-unit",
@ -1949,17 +1871,20 @@ dependencies = [
"chrono-humanize",
"clap",
"clipboard",
"crossterm",
"csv",
"ctrlc",
"derive-new",
"dirs 2.0.2",
"dunce",
"futures-preview",
"futures-timer",
"futures-util",
"futures_codec",
"getset",
"git2",
"glob",
"heim",
"hex 0.4.0",
"indexmap",
"itertools 0.8.2",
@ -1981,14 +1906,12 @@ dependencies = [
"nu_plugin_inc",
"nu_plugin_match",
"nu_plugin_post",
"nu_plugin_ps",
"nu_plugin_str",
"nu_plugin_sum",
"nu_plugin_sys",
"nu_plugin_textview",
"nu_plugin_tree",
"num-bigint",
"num-traits 0.2.10",
"onig_sys",
"pin-utils",
"pretty-hex",
"pretty_assertions",
@ -2012,6 +1935,7 @@ dependencies = [
"starship",
"strip-ansi-escapes",
"subprocess",
"syntect",
"tempfile",
"term",
"termcolor",
@ -2021,6 +1945,7 @@ dependencies = [
"typetag",
"umask",
"unicode-xid",
"url",
"which",
]
@ -2227,20 +2152,6 @@ dependencies = [
"url",
]
[[package]]
name = "nu_plugin_ps"
version = "0.1.0"
dependencies = [
"futures 0.3.1",
"futures-timer",
"heim",
"nu-build",
"nu-errors",
"nu-protocol",
"nu-source",
"pin-utils",
]
[[package]]
name = "nu_plugin_str"
version = "0.1.0"
@ -2266,35 +2177,6 @@ dependencies = [
"nu-source",
]
[[package]]
name = "nu_plugin_sys"
version = "0.1.0"
dependencies = [
"battery",
"futures 0.3.1",
"futures-timer",
"heim",
"nu-build",
"nu-errors",
"nu-protocol",
"nu-source",
"pin-utils",
]
[[package]]
name = "nu_plugin_textview"
version = "0.1.0"
dependencies = [
"ansi_term 0.12.1",
"crossterm",
"nu-build",
"nu-errors",
"nu-protocol",
"nu-source",
"syntect",
"url",
]
[[package]]
name = "nu_plugin_tree"
version = "0.1.0"
@ -3468,7 +3350,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5090db468dad16e1a7a54c8c67280c5e4b544f3d3e018f0b913b400261f85926"
dependencies = [
"bytes",
"futures 0.1.29",
"futures",
"log",
]
@ -3586,13 +3468,23 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
[[package]]
name = "uom"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3198c29f199fa8a23d732f4aa21ddc4f4d0a257cb0c2a44afea30145ce2575c1"
dependencies = [
"num-rational",
"num-traits 0.2.10",
"typenum",
]
[[package]]
name = "uom"
version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cec796ec5f7ac557631709079168286056205c51c60aac33f51764bdc7b8dc4"
dependencies = [
"num-rational",
"num-traits 0.2.10",
"typenum",
]
@ -3712,7 +3604,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83420b37346c311b9ed822af41ec2e82839bfe99867ec6c54e2da43b7538771c"
dependencies = [
"cfg-if",
"futures 0.1.29",
"futures",
"futures-channel-preview",
"futures-util-preview",
"js-sys",

View File

@ -17,16 +17,13 @@ members = [
"crates/nu-errors",
"crates/nu-source",
"crates/nu_plugin_average",
"crates/nu_plugin_textview",
"crates/nu_plugin_binaryview",
"crates/nu_plugin_fetch",
"crates/nu_plugin_inc",
"crates/nu_plugin_match",
"crates/nu_plugin_post",
"crates/nu_plugin_ps",
"crates/nu_plugin_post",
"crates/nu_plugin_str",
"crates/nu_plugin_sum",
"crates/nu_plugin_sys",
"crates/nu_plugin_tree",
"crates/nu-protocol",
"crates/nu-parser",
@ -43,16 +40,13 @@ nu-errors = { version = "0.1.0", path = "./crates/nu-errors" }
nu-parser = { version = "0.1.0", path = "./crates/nu-parser" }
nu-value-ext = { version = "0.1.0", path = "./crates/nu-value-ext" }
nu_plugin_average = {version = "0.1.0", path = "./crates/nu_plugin_average", optional=true}
nu_plugin_textview = {version = "0.1.0", path = "./crates/nu_plugin_textview", optional=true}
nu_plugin_binaryview = {version = "0.1.0", path = "./crates/nu_plugin_binaryview", optional=true}
nu_plugin_fetch = {version = "0.1.0", path = "./crates/nu_plugin_fetch", optional=true}
nu_plugin_inc = {version = "0.1.0", path = "./crates/nu_plugin_inc", optional=true}
nu_plugin_match = {version = "0.1.0", path = "./crates/nu_plugin_match", optional=true}
nu_plugin_post = {version = "0.1.0", path = "./crates/nu_plugin_post", optional=true}
nu_plugin_ps = {version = "0.1.0", path = "./crates/nu_plugin_ps", optional=true}
nu_plugin_str = {version = "0.1.0", path = "./crates/nu_plugin_str", optional=true}
nu_plugin_sum = {version = "0.1.0", path = "./crates/nu_plugin_sum", optional=true}
nu_plugin_sys = {version = "0.1.0", path = "./crates/nu_plugin_sys", optional=true}
nu_plugin_tree = {version = "0.1.0", path = "./crates/nu_plugin_tree", optional=true}
query_interface = "0.3.5"
@ -123,14 +117,22 @@ natural = "0.3.0"
clipboard = {version = "0.5", optional = true }
ptree = {version = "0.2" }
starship = { version = "0.28", optional = true}
heim = {version = "0.0.8", optional = true}
battery = {version = "0.7.5", optional = true}
syntect = {version = "3.2.0", optional = true }
onig_sys = {version = "=69.1.0", optional = true }
crossterm = {version = "0.10.2", optional = true}
futures-timer = {version = "1.0.2", optional = true}
url = {version = "2.1.0", optional = true}
[features]
default = ["sys", "ps", "match", "inc", "average", "str", "sum"]
sys = ["nu_plugin_ps"]
default = ["sys", "ps", "textview", "match", "inc", "average", "str", "sum"]
sys = ["heim", "battery"]
ps = ["heim"]
textview = ["crossterm", "syntect", "onig_sys"]
starship-prompt = ["starship"]
textview = ["nu_plugin_textview"]
binaryview = ["nu_plugin_binaryview"]
ps = ["nu_plugin_ps"]
match = ["nu_plugin_match"]
tree = ["nu_plugin_tree"]
inc = ["nu_plugin_inc"]
@ -155,6 +157,23 @@ nu-build = { version = "0.1.0", path = "./crates/nu-build" }
name = "nu"
path = "src/lib.rs"
# Core plugins that ship with `cargo install nu` by default
[[bin]]
name = "nu_plugin_textview"
path = "src/core_plugins/textview.rs"
required-features = ["textview"]
[[bin]]
name = "nu_plugin_ps"
path = "src/core_plugins/ps.rs"
required-features = ["ps"]
[[bin]]
name = "nu_plugin_sys"
path = "src/core_plugins/sys.rs"
required-features = ["sys"]
# Main nu binary
[[bin]]
name = "nu"
path = "src/main.rs"

View File

@ -9,7 +9,6 @@ license = "MIT"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
serde = { version = "1.0.103", features = ["derive"] }
derive-new = "0.5.8"
getset = "0.0.9"

View File

@ -1,19 +0,0 @@
[package]
name = "nu_plugin_ps"
version = "0.1.0"
authors = ["Yehuda Katz <wycats@gmail.com>", "Jonathan Turner <jonathan.d.turner@gmail.com>", "Andrés N. Robalino <andres@androbtech.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
nu-protocol = { path = "../nu-protocol" }
nu-source = { path = "../nu-source" }
nu-errors = { path = "../nu-errors" }
futures = { version = "0.3.0", features = ["compat", "io-compat"] }
heim = "0.0.9"
futures-timer = "2.0.2"
pin-utils = "0.1.0-alpha.4"
[build-dependencies]
nu-build = { version = "0.1.0", path = "../nu-build" }

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -1,20 +0,0 @@
[package]
name = "nu_plugin_sys"
version = "0.1.0"
authors = ["Yehuda Katz <wycats@gmail.com>", "Jonathan Turner <jonathan.d.turner@gmail.com>", "Andrés N. Robalino <andres@androbtech.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
nu-protocol = { path = "../nu-protocol" }
nu-source = { path = "../nu-source" }
nu-errors = { path = "../nu-errors" }
futures = { version = "0.3.0", features = ["compat", "io-compat"] }
heim = "0.0.9"
futures-timer = "2.0.2"
pin-utils = "0.1.0-alpha.4"
battery = "0.7.5"
[build-dependencies]
nu-build = { version = "0.1.0", path = "../nu-build" }

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -1,19 +0,0 @@
[package]
name = "nu_plugin_textview"
version = "0.1.0"
authors = ["Yehuda Katz <wycats@gmail.com>", "Jonathan Turner <jonathan.d.turner@gmail.com>", "Andrés N. Robalino <andres@androbtech.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
syntect = { version = "3.2.0" }
ansi_term = "0.12.1"
crossterm = { version = "0.10.2" }
nu-protocol = { path = "../nu-protocol" }
nu-source = { path = "../nu-source" }
nu-errors = { path = "../nu-errors" }
url = "2.1.0"
[build-dependencies]
nu-build = { version = "0.1.0", path = "../nu-build" }

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -255,12 +255,12 @@ fn view_text_value(value: &Value) {
Some(extension) => {
// Load these once at the start of your program
let ps: SyntaxSet = syntect::dumps::from_binary(include_bytes!(
"../../../assets/syntaxes.bin"
"../../assets/syntaxes.bin"
));
if let Some(syntax) = ps.find_syntax_by_extension(&extension) {
let ts: ThemeSet = syntect::dumps::from_binary(include_bytes!(
"../../../assets/themes.bin"
"../../assets/themes.bin"
));
let mut h = HighlightLines::new(syntax, &ts.themes["OneHalfDark"]);

View File

@ -65,8 +65,8 @@ fn default_row_data_if_column_missing() {
open los_tres_amigos.json
| get amigos
| default rusty_luck 1
| get rusty_luck
| sum
| where rusty_luck == 1
| count
| echo $it
"#
));
@ -486,7 +486,8 @@ fn get_more_than_one_member() {
open sample.toml
| get fortune_tellers
| get arepas broken_builds
| sum
| where $it == 1
| count
| echo $it
"#
));
@ -535,11 +536,11 @@ fn save_figures_out_intelligently_where_to_write_out_with_metadata() {
nu!(
cwd: dirs.root(),
"open save_test_1/cargo_sample.toml | inc package.version --minor | save"
"open save_test_1/cargo_sample.toml | save"
);
let actual = h::file_contents(&subject_file);
assert!(actual.contains("0.2.0"));
assert!(actual.contains("0.1.1"));
})
}
@ -577,43 +578,11 @@ fn save_can_write_out_csv() {
nu!(
cwd: dirs.root(),
"open {}/cargo_sample.toml | inc package.version --minor | get package | save save_test_2/cargo_sample.csv",
"open {}/cargo_sample.toml | get package | save save_test_2/cargo_sample.csv",
dirs.formats()
);
let actual = h::file_contents(expected_file);
assert!(actual.contains("[Table],A shell for the GitHub era,2018,ISC,nu,0.2.0"));
})
}
// This test is more tricky since we are checking for binary output. The output rendered in ASCII is (roughly):
// <20>authors+0Yehuda Katz <wycats@gmail.com>descriptionA shell for the GitHub eraedition2018licenseISCnamenuversion0.2.0
// It is not valid utf-8, so this is just an approximation.
#[test]
fn save_can_write_out_bson() {
Playground::setup("save_test_3", |dirs, _| {
let expected_file = dirs.test().join("cargo_sample.bson");
nu!(
cwd: dirs.root(),
"open {}/cargo_sample.toml | inc package.version --minor | get package | save save_test_3/cargo_sample.bson",
dirs.formats()
);
let actual = h::file_contents_binary(expected_file);
assert!(
actual
== vec![
168, 0, 0, 0, 4, 97, 117, 116, 104, 111, 114, 115, 0, 43, 0, 0, 0, 2, 48, 0,
31, 0, 0, 0, 89, 101, 104, 117, 100, 97, 32, 75, 97, 116, 122, 32, 60, 119,
121, 99, 97, 116, 115, 64, 103, 109, 97, 105, 108, 46, 99, 111, 109, 62, 0, 0,
2, 100, 101, 115, 99, 114, 105, 112, 116, 105, 111, 110, 0, 27, 0, 0, 0, 65,
32, 115, 104, 101, 108, 108, 32, 102, 111, 114, 32, 116, 104, 101, 32, 71, 105,
116, 72, 117, 98, 32, 101, 114, 97, 0, 2, 101, 100, 105, 116, 105, 111, 110, 0,
5, 0, 0, 0, 50, 48, 49, 56, 0, 2, 108, 105, 99, 101, 110, 115, 101, 0, 4, 0, 0,
0, 73, 83, 67, 0, 2, 110, 97, 109, 101, 0, 3, 0, 0, 0, 110, 117, 0, 2, 118,
101, 114, 115, 105, 111, 110, 0, 6, 0, 0, 0, 48, 46, 50, 46, 48, 0, 0
]
);
assert!(actual.contains("[Table],A shell for the GitHub era,2018,ISC,nu,0.1.1"));
})
}