mirror of
https://github.com/nushell/nushell.git
synced 2024-12-26 00:50:03 +01:00
Merge pull request #1076 from jonathandturner/finish_plugin_refactor
Trying this as a workaround to the [[bin]] issue
This commit is contained in:
commit
16272b1b20
74
Cargo.lock
generated
74
Cargo.lock
generated
@ -1903,9 +1903,14 @@ dependencies = [
|
|||||||
"nu_plugin_average",
|
"nu_plugin_average",
|
||||||
"nu_plugin_binaryview",
|
"nu_plugin_binaryview",
|
||||||
"nu_plugin_fetch",
|
"nu_plugin_fetch",
|
||||||
|
"nu_plugin_inc",
|
||||||
"nu_plugin_match",
|
"nu_plugin_match",
|
||||||
"nu_plugin_post",
|
"nu_plugin_post",
|
||||||
|
"nu_plugin_ps",
|
||||||
|
"nu_plugin_str",
|
||||||
"nu_plugin_sum",
|
"nu_plugin_sum",
|
||||||
|
"nu_plugin_sys",
|
||||||
|
"nu_plugin_textview",
|
||||||
"nu_plugin_tree",
|
"nu_plugin_tree",
|
||||||
"num-bigint",
|
"num-bigint",
|
||||||
"num-traits 0.2.10",
|
"num-traits 0.2.10",
|
||||||
@ -2109,6 +2114,19 @@ dependencies = [
|
|||||||
"url",
|
"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]]
|
[[package]]
|
||||||
name = "nu_plugin_match"
|
name = "nu_plugin_match"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@ -2137,6 +2155,34 @@ dependencies = [
|
|||||||
"url",
|
"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]]
|
[[package]]
|
||||||
name = "nu_plugin_sum"
|
name = "nu_plugin_sum"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
@ -2147,6 +2193,34 @@ dependencies = [
|
|||||||
"nu-source",
|
"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]]
|
[[package]]
|
||||||
name = "nu_plugin_tree"
|
name = "nu_plugin_tree"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
36
Cargo.toml
36
Cargo.toml
@ -19,9 +19,14 @@ members = [
|
|||||||
"crates/nu_plugin_average",
|
"crates/nu_plugin_average",
|
||||||
"crates/nu_plugin_binaryview",
|
"crates/nu_plugin_binaryview",
|
||||||
"crates/nu_plugin_fetch",
|
"crates/nu_plugin_fetch",
|
||||||
|
"crates/nu_plugin_inc",
|
||||||
"crates/nu_plugin_match",
|
"crates/nu_plugin_match",
|
||||||
"crates/nu_plugin_post",
|
"crates/nu_plugin_post",
|
||||||
|
"crates/nu_plugin_ps",
|
||||||
|
"crates/nu_plugin_str",
|
||||||
"crates/nu_plugin_sum",
|
"crates/nu_plugin_sum",
|
||||||
|
"crates/nu_plugin_sys",
|
||||||
|
"crates/nu_plugin_textview",
|
||||||
"crates/nu_plugin_tree",
|
"crates/nu_plugin_tree",
|
||||||
"crates/nu-protocol",
|
"crates/nu-protocol",
|
||||||
"crates/nu-parser",
|
"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_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_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_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_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_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_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}
|
nu_plugin_tree = {version = "0.1.0", path = "./crates/nu_plugin_tree", optional=true}
|
||||||
|
|
||||||
query_interface = "0.3.5"
|
query_interface = "0.3.5"
|
||||||
@ -122,9 +132,9 @@ url = {version = "2.1.0", optional = true}
|
|||||||
semver = {version = "0.9.0", optional = true}
|
semver = {version = "0.9.0", optional = true}
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["sys", "ps", "textview", "match", "inc", "average", "str", "sum"]
|
default = ["sys", "ps", "textview", "inc", "str"]
|
||||||
sys = ["heim", "battery"]
|
sys = ["heim", "battery"]
|
||||||
ps = ["heim"]
|
ps = ["heim", "futures-timer"]
|
||||||
textview = ["crossterm", "syntect", "onig_sys", "url"]
|
textview = ["crossterm", "syntect", "onig_sys", "url"]
|
||||||
inc = ["semver"]
|
inc = ["semver"]
|
||||||
str = []
|
str = []
|
||||||
@ -154,29 +164,31 @@ name = "nu"
|
|||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
# Core plugins that ship with `cargo install nu` by default
|
# 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]]
|
[[bin]]
|
||||||
name = "nu_plugin_textview"
|
name = "nu_plugin_core_textview"
|
||||||
path = "src/core_plugins/textview.rs"
|
path = "crates/nu_plugin_textview/src/main.rs"
|
||||||
required-features = ["textview"]
|
required-features = ["textview"]
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "nu_plugin_inc"
|
name = "nu_plugin_core_inc"
|
||||||
path = "src/core_plugins/inc.rs"
|
path = "crates/nu_plugin_inc/src/main.rs"
|
||||||
required-features = ["inc"]
|
required-features = ["inc"]
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "nu_plugin_ps"
|
name = "nu_plugin_core_ps"
|
||||||
path = "src/core_plugins/ps.rs"
|
path = "crates/nu_plugin_ps/src/main.rs"
|
||||||
required-features = ["ps"]
|
required-features = ["ps"]
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "nu_plugin_str"
|
name = "nu_plugin_core_str"
|
||||||
path = "src/core_plugins/str.rs"
|
path = "crates/nu_plugin_str/src/main.rs"
|
||||||
required-features = ["str"]
|
required-features = ["str"]
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "nu_plugin_sys"
|
name = "nu_plugin_core_sys"
|
||||||
path = "src/core_plugins/sys.rs"
|
path = "crates/nu_plugin_sys/src/main.rs"
|
||||||
required-features = ["sys"]
|
required-features = ["sys"]
|
||||||
|
|
||||||
# Main nu binary
|
# Main nu binary
|
||||||
|
18
crates/nu_plugin_inc/Cargo.toml
Normal file
18
crates/nu_plugin_inc/Cargo.toml
Normal 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" }
|
3
crates/nu_plugin_inc/build.rs
Normal file
3
crates/nu_plugin_inc/build.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
nu_build::build()
|
||||||
|
}
|
20
crates/nu_plugin_ps/Cargo.toml
Normal file
20
crates/nu_plugin_ps/Cargo.toml
Normal 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" }
|
3
crates/nu_plugin_ps/build.rs
Normal file
3
crates/nu_plugin_ps/build.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
nu_build::build()
|
||||||
|
}
|
20
crates/nu_plugin_str/Cargo.toml
Normal file
20
crates/nu_plugin_str/Cargo.toml
Normal 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" }
|
3
crates/nu_plugin_str/build.rs
Normal file
3
crates/nu_plugin_str/build.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
nu_build::build()
|
||||||
|
}
|
18
crates/nu_plugin_sys/Cargo.toml
Normal file
18
crates/nu_plugin_sys/Cargo.toml
Normal 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" }
|
3
crates/nu_plugin_sys/build.rs
Normal file
3
crates/nu_plugin_sys/build.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
nu_build::build()
|
||||||
|
}
|
21
crates/nu_plugin_textview/Cargo.toml
Normal file
21
crates/nu_plugin_textview/Cargo.toml
Normal 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" }
|
3
crates/nu_plugin_textview/build.rs
Normal file
3
crates/nu_plugin_textview/build.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
nu_build::build()
|
||||||
|
}
|
@ -255,12 +255,12 @@ fn view_text_value(value: &Value) {
|
|||||||
Some(extension) => {
|
Some(extension) => {
|
||||||
// Load these once at the start of your program
|
// Load these once at the start of your program
|
||||||
let ps: SyntaxSet = syntect::dumps::from_binary(include_bytes!(
|
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) {
|
if let Some(syntax) = ps.find_syntax_by_extension(&extension) {
|
||||||
let ts: ThemeSet = syntect::dumps::from_binary(include_bytes!(
|
let ts: ThemeSet = syntect::dumps::from_binary(include_bytes!(
|
||||||
"../../assets/themes.bin"
|
"../../../assets/themes.bin"
|
||||||
));
|
));
|
||||||
let mut h = HighlightLines::new(syntax, &ts.themes["OneHalfDark"]);
|
let mut h = HighlightLines::new(syntax, &ts.themes["OneHalfDark"]);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user