Trying this as a workaround to the [[bin]] issue

This commit is contained in:
Jonathan Turner 2019-12-10 16:57:55 +13:00
parent 17586bdfbd
commit 1dcbd89a89
17 changed files with 212 additions and 14 deletions

74
Cargo.lock generated
View File

@ -1903,9 +1903,14 @@ dependencies = [
"nu_plugin_average",
"nu_plugin_binaryview",
"nu_plugin_fetch",
"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",
@ -2109,6 +2114,19 @@ dependencies = [
"url",
]
[[package]]
name = "nu_plugin_inc"
version = "0.1.0"
dependencies = [
"indexmap",
"nu-build",
"nu-errors",
"nu-protocol",
"nu-source",
"nu-value-ext",
"semver",
]
[[package]]
name = "nu_plugin_match"
version = "0.1.0"
@ -2137,6 +2155,34 @@ dependencies = [
"url",
]
[[package]]
name = "nu_plugin_ps"
version = "0.1.0"
dependencies = [
"futures-preview",
"futures-timer",
"heim",
"nu-build",
"nu-errors",
"nu-protocol",
"nu-source",
"pin-utils",
]
[[package]]
name = "nu_plugin_str"
version = "0.1.0"
dependencies = [
"indexmap",
"nu-build",
"nu-errors",
"nu-protocol",
"nu-source",
"nu-value-ext",
"num-bigint",
"regex",
]
[[package]]
name = "nu_plugin_sum"
version = "0.1.0"
@ -2147,6 +2193,34 @@ dependencies = [
"nu-source",
]
[[package]]
name = "nu_plugin_sys"
version = "0.1.0"
dependencies = [
"battery",
"futures-preview",
"heim",
"nu-build",
"nu-errors",
"nu-protocol",
"nu-source",
]
[[package]]
name = "nu_plugin_textview"
version = "0.1.0"
dependencies = [
"ansi_term 0.12.1",
"crossterm",
"nu-build",
"nu-errors",
"nu-protocol",
"nu-source",
"onig_sys",
"syntect",
"url",
]
[[package]]
name = "nu_plugin_tree"
version = "0.1.0"

View File

@ -19,9 +19,14 @@ members = [
"crates/nu_plugin_average",
"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_str",
"crates/nu_plugin_sum",
"crates/nu_plugin_sys",
"crates/nu_plugin_textview",
"crates/nu_plugin_tree",
"crates/nu-protocol",
"crates/nu-parser",
@ -40,9 +45,14 @@ 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_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_textview = {version = "0.1.0", path = "./crates/nu_plugin_textview", optional=true}
nu_plugin_tree = {version = "0.1.0", path = "./crates/nu_plugin_tree", optional=true}
query_interface = "0.3.5"
@ -122,9 +132,9 @@ url = {version = "2.1.0", optional = true}
semver = {version = "0.9.0", optional = true}
[features]
default = ["sys", "ps", "textview", "match", "inc", "average", "str", "sum"]
default = ["sys", "ps", "textview", "inc", "str"]
sys = ["heim", "battery"]
ps = ["heim"]
ps = ["heim", "futures-timer"]
textview = ["crossterm", "syntect", "onig_sys", "url"]
inc = ["semver"]
str = []
@ -154,29 +164,31 @@ name = "nu"
path = "src/lib.rs"
# 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_textview"
path = "src/core_plugins/textview.rs"
name = "nu_plugin_core_textview"
path = "crates/nu_plugin_textview/src/main.rs"
required-features = ["textview"]
[[bin]]
name = "nu_plugin_inc"
path = "src/core_plugins/inc.rs"
name = "nu_plugin_core_inc"
path = "crates/nu_plugin_inc/src/main.rs"
required-features = ["inc"]
[[bin]]
name = "nu_plugin_ps"
path = "src/core_plugins/ps.rs"
name = "nu_plugin_core_ps"
path = "crates/nu_plugin_ps/src/main.rs"
required-features = ["ps"]
[[bin]]
name = "nu_plugin_str"
path = "src/core_plugins/str.rs"
name = "nu_plugin_core_str"
path = "crates/nu_plugin_str/src/main.rs"
required-features = ["str"]
[[bin]]
name = "nu_plugin_sys"
path = "src/core_plugins/sys.rs"
name = "nu_plugin_core_sys"
path = "crates/nu_plugin_sys/src/main.rs"
required-features = ["sys"]
# Main nu binary

View File

@ -0,0 +1,18 @@
[package]
name = "nu_plugin_inc"
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" }
nu-value-ext = { path = "../nu-value-ext" }
semver = "0.9.0"
indexmap = "1.3.0"
[build-dependencies]
nu-build = { version = "0.1.0", path = "../nu-build" }

View File

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

View File

@ -0,0 +1,20 @@
[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-preview = { version = "=0.3.0-alpha.19", features = ["compat", "io-compat"] }
heim = "0.0.8"
futures-timer = "1.0.3"
pin-utils = "0.1.0-alpha.4"
[build-dependencies]
nu-build = { version = "0.1.0", path = "../nu-build" }

View File

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

View File

@ -0,0 +1,20 @@
[package]
name = "nu_plugin_str"
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" }
nu-value-ext = { path = "../nu-value-ext" }
regex = "1"
indexmap = "1.3.0"
num-bigint = "0.2.3"
[build-dependencies]
nu-build = { version = "0.1.0", path = "../nu-build" }

View File

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

View File

@ -0,0 +1,18 @@
[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" }
heim = "0.0.8"
futures-preview = { version = "=0.3.0-alpha.19", features = ["compat", "io-compat"] }
battery = "0.7.5"
[build-dependencies]
nu-build = { version = "0.1.0", path = "../nu-build" }

View File

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

View File

@ -0,0 +1,21 @@
[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]
nu-protocol = { path = "../nu-protocol" }
nu-source = { path = "../nu-source" }
nu-errors = { path = "../nu-errors" }
crossterm = "0.10.2"
syntect = "3.2.0"
onig_sys = "~69.1.0"
ansi_term = "0.12.1"
url = "2.1.0"
[build-dependencies]
nu-build = { version = "0.1.0", path = "../nu-build" }

View File

@ -0,0 +1,3 @@
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"]);