From 1fcf671ca45063289986f9761b17c54bfbcdfc95 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Wed, 4 Dec 2019 19:38:40 +1300 Subject: [PATCH 1/4] Re-enable the textview plugin, now its own crate --- Cargo.lock | 3 ++- Cargo.toml | 2 +- crates/nu-build/Cargo.toml | 2 +- crates/nu-errors/Cargo.toml | 2 +- crates/nu-parser/Cargo.toml | 2 +- crates/nu-protocol/Cargo.toml | 2 +- crates/nu-source/Cargo.toml | 2 +- crates/{nu-textview => nu_plugin_textview}/Cargo.toml | 11 +++-------- crates/{nu-textview => nu_plugin_textview}/build.rs | 0 .../{nu-textview => nu_plugin_textview}/src/main.rs | 5 +++-- 10 files changed, 14 insertions(+), 17 deletions(-) rename crates/{nu-textview => nu_plugin_textview}/Cargo.toml (72%) rename crates/{nu-textview => nu_plugin_textview}/build.rs (100%) rename crates/{nu-textview => nu_plugin_textview}/src/main.rs (98%) diff --git a/Cargo.lock b/Cargo.lock index 42749f2bb3..9e892aee65 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2079,13 +2079,14 @@ dependencies = [ ] [[package]] -name = "nu-textview" +name = "nu_plugin_textview" version = "0.1.0" dependencies = [ "ansi_term 0.12.1", "crossterm", "nu", "nu-build", + "nu-errors", "nu-protocol", "nu-source", "syntect", diff --git a/Cargo.toml b/Cargo.toml index 63eca929ec..90b7166ab0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ documentation = "https://book.nushell.sh" [workspace] -members = ["crates/nu-errors", "crates/nu-source", "crates/nu-textview", "crates/nu-protocol", "crates/nu-parser", "crates/nu-build"] +members = ["crates/nu-errors", "crates/nu-source", "crates/nu_plugin_textview", "crates/nu-protocol", "crates/nu-parser", "crates/nu-build"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/nu-build/Cargo.toml b/crates/nu-build/Cargo.toml index 66a6ffbbe0..c9d2baf317 100644 --- a/crates/nu-build/Cargo.toml +++ b/crates/nu-build/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nu-build" version = "0.1.0" -authors = ["Yehuda Katz "] +authors = ["Yehuda Katz ", "Jonathan Turner ", "Andrés N. Robalino "] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/nu-errors/Cargo.toml b/crates/nu-errors/Cargo.toml index 3c3f4a4409..fc4c723464 100644 --- a/crates/nu-errors/Cargo.toml +++ b/crates/nu-errors/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nu-errors" version = "0.1.0" -authors = ["Yehuda Katz "] +authors = ["Yehuda Katz ", "Jonathan Turner ", "Andrés N. Robalino "] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/nu-parser/Cargo.toml b/crates/nu-parser/Cargo.toml index 0fea0a1112..0c9c89b9af 100644 --- a/crates/nu-parser/Cargo.toml +++ b/crates/nu-parser/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nu-parser" version = "0.1.0" -authors = ["Yehuda Katz "] +authors = ["Yehuda Katz ", "Jonathan Turner ", "Andrés N. Robalino "] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/nu-protocol/Cargo.toml b/crates/nu-protocol/Cargo.toml index 4379527189..2851ef3f1d 100644 --- a/crates/nu-protocol/Cargo.toml +++ b/crates/nu-protocol/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nu-protocol" version = "0.1.0" -authors = ["Yehuda Katz "] +authors = ["Yehuda Katz ", "Jonathan Turner ", "Andrés N. Robalino "] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/nu-source/Cargo.toml b/crates/nu-source/Cargo.toml index f30a937267..3eb0f59f23 100644 --- a/crates/nu-source/Cargo.toml +++ b/crates/nu-source/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "nu-source" version = "0.1.0" -authors = ["Yehuda Katz "] +authors = ["Yehuda Katz ", "Jonathan Turner ", "Andrés N. Robalino "] edition = "2018" description = "A source string characterizer for Nushell" license = "MIT" diff --git a/crates/nu-textview/Cargo.toml b/crates/nu_plugin_textview/Cargo.toml similarity index 72% rename from crates/nu-textview/Cargo.toml rename to crates/nu_plugin_textview/Cargo.toml index dab1b330b6..b6ea36489d 100644 --- a/crates/nu-textview/Cargo.toml +++ b/crates/nu_plugin_textview/Cargo.toml @@ -1,24 +1,19 @@ [package] -name = "nu-textview" +name = "nu_plugin_textview" version = "0.1.0" -authors = ["Yehuda Katz "] +authors = ["Yehuda Katz ", "Jonathan Turner ", "Andrés N. Robalino "] edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html -[[bin]] -name = "nu_plugin_textview" -path = "src/main.rs" -required-features = ["textview"] - [dependencies] - syntect = { version = "3.2.0" } ansi_term = "0.12.1" crossterm = { version = "0.10.2" } nu = { path = "../.." } nu-protocol = { path = "../nu-protocol" } nu-source = { path = "../nu-source" } +nu-errors = { path = "../nu-errors" } url = "2.1.0" [build-dependencies] diff --git a/crates/nu-textview/build.rs b/crates/nu_plugin_textview/build.rs similarity index 100% rename from crates/nu-textview/build.rs rename to crates/nu_plugin_textview/build.rs diff --git a/crates/nu-textview/src/main.rs b/crates/nu_plugin_textview/src/main.rs similarity index 98% rename from crates/nu-textview/src/main.rs rename to crates/nu_plugin_textview/src/main.rs index 208eaae810..8163c91dbe 100644 --- a/crates/nu-textview/src/main.rs +++ b/crates/nu_plugin_textview/src/main.rs @@ -1,7 +1,8 @@ use crossterm::{cursor, terminal, RawScreen}; use crossterm::{InputEvent, KeyEvent}; -use nu::{CallInfo, Plugin, Primitive, ShellError, Signature, UntaggedValue, Value}; -use nu_protocol::{outln, serve_plugin}; +use nu::Plugin; +use nu_errors::ShellError; +use nu_protocol::{outln, serve_plugin, CallInfo, Primitive, Signature, UntaggedValue, Value}; use nu_source::AnchorLocation; use syntect::easy::HighlightLines; From 871fc72892a101bb5cff0dfddfe4c4c55a56d9f0 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Wed, 4 Dec 2019 19:49:38 +1300 Subject: [PATCH 2/4] Test all subcrates --- .azure/azure-pipelines.yml | 2 +- crates/nu-parser/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure/azure-pipelines.yml b/.azure/azure-pipelines.yml index f4c24325e3..ce98593c3d 100644 --- a/.azure/azure-pipelines.yml +++ b/.azure/azure-pipelines.yml @@ -45,7 +45,7 @@ steps: - bash: RUSTFLAGS="-D warnings" cargo test --all-features condition: eq(variables['style'], 'unflagged') displayName: Run tests - - bash: NUSHELL_ENABLE_ALL_FLAGS=1 RUSTFLAGS="-D warnings" cargo test --all-features + - bash: NUSHELL_ENABLE_ALL_FLAGS=1 RUSTFLAGS="-D warnings" cargo test -all --all-features condition: eq(variables['style'], 'canary') displayName: Run tests - bash: cargo fmt --all -- --check diff --git a/crates/nu-parser/Cargo.toml b/crates/nu-parser/Cargo.toml index 0c9c89b9af..804d3183fd 100644 --- a/crates/nu-parser/Cargo.toml +++ b/crates/nu-parser/Cargo.toml @@ -40,4 +40,4 @@ pretty_assertions = "0.6.1" nu-build = { version = "0.1.0", path = "../nu-build" } [features] -trace = ["nom-tracable/trace"] +#trace = ["nom-tracable/trace"] From 35edf22ac39e119c57aa4b06adf19886aae3e6e2 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Wed, 4 Dec 2019 19:53:06 +1300 Subject: [PATCH 3/4] Test all subcrates --- .azure/azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure/azure-pipelines.yml b/.azure/azure-pipelines.yml index ce98593c3d..70ff5e4af0 100644 --- a/.azure/azure-pipelines.yml +++ b/.azure/azure-pipelines.yml @@ -42,10 +42,10 @@ steps: echo "##vso[task.prependpath]$HOME/.cargo/bin" rustup component add rustfmt --toolchain "stable" displayName: Install Rust - - bash: RUSTFLAGS="-D warnings" cargo test --all-features + - bash: RUSTFLAGS="-D warnings" cargo test --all --all-features condition: eq(variables['style'], 'unflagged') displayName: Run tests - - bash: NUSHELL_ENABLE_ALL_FLAGS=1 RUSTFLAGS="-D warnings" cargo test -all --all-features + - bash: NUSHELL_ENABLE_ALL_FLAGS=1 RUSTFLAGS="-D warnings" cargo test --all --all-features condition: eq(variables['style'], 'canary') displayName: Run tests - bash: cargo fmt --all -- --check From cfda67ff82ee3c9b1dacc89d9a0e93ee16837e5c Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Thu, 5 Dec 2019 05:28:48 +1300 Subject: [PATCH 4/4] Finish making the textview plugin optional --- Cargo.lock | 2 +- Cargo.toml | 2 ++ crates/nu_plugin_textview/Cargo.toml | 1 - crates/nu_plugin_textview/src/main.rs | 5 +++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9e892aee65..0e277e06ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1927,6 +1927,7 @@ dependencies = [ "nu-parser", "nu-protocol", "nu-source", + "nu_plugin_textview", "num-bigint", "num-traits 0.2.10", "onig_sys", @@ -2084,7 +2085,6 @@ version = "0.1.0" dependencies = [ "ansi_term 0.12.1", "crossterm", - "nu", "nu-build", "nu-errors", "nu-protocol", diff --git a/Cargo.toml b/Cargo.toml index 90b7166ab0..5228b41a5c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ nu-source = { version = "0.1.0", path = "./crates/nu-source" } nu-protocol = { version = "0.1.0", path = "./crates/nu-protocol" } nu-errors = { version = "0.1.0", path = "./crates/nu-errors" } nu-parser = { version = "0.1.0", path = "./crates/nu-parser" } +nu_plugin_textview = {version = "0.1.0", path = "./crates/nu_plugin_textview", optional=true} query_interface = "0.3.5" typetag = "0.1.4" @@ -114,6 +115,7 @@ binaryview = ["image", "crossterm"] sys = ["heim", "battery"] ps = ["heim"] starship-prompt = ["starship"] +textview = ["nu_plugin_textview"] #trace = ["nu-parser/trace"] [dependencies.rusqlite] diff --git a/crates/nu_plugin_textview/Cargo.toml b/crates/nu_plugin_textview/Cargo.toml index b6ea36489d..82e0abae2a 100644 --- a/crates/nu_plugin_textview/Cargo.toml +++ b/crates/nu_plugin_textview/Cargo.toml @@ -10,7 +10,6 @@ edition = "2018" syntect = { version = "3.2.0" } ansi_term = "0.12.1" crossterm = { version = "0.10.2" } -nu = { path = "../.." } nu-protocol = { path = "../nu-protocol" } nu-source = { path = "../nu-source" } nu-errors = { path = "../nu-errors" } diff --git a/crates/nu_plugin_textview/src/main.rs b/crates/nu_plugin_textview/src/main.rs index 8163c91dbe..6a35fed906 100644 --- a/crates/nu_plugin_textview/src/main.rs +++ b/crates/nu_plugin_textview/src/main.rs @@ -1,8 +1,9 @@ use crossterm::{cursor, terminal, RawScreen}; use crossterm::{InputEvent, KeyEvent}; -use nu::Plugin; use nu_errors::ShellError; -use nu_protocol::{outln, serve_plugin, CallInfo, Primitive, Signature, UntaggedValue, Value}; +use nu_protocol::{ + outln, serve_plugin, CallInfo, Plugin, Primitive, Signature, UntaggedValue, Value, +}; use nu_source::AnchorLocation; use syntect::easy::HighlightLines;