From 15e66ae0656a0e5b45b6d3eb4c017f46ea336b20 Mon Sep 17 00:00:00 2001 From: utam0k Date: Sun, 7 Jun 2020 04:13:38 +0900 Subject: [PATCH 01/12] Implement an option to show paths made of mkdir. (#1932) --- crates/nu-cli/src/commands/mkdir.rs | 6 +++++- crates/nu-cli/src/shell/filesystem_shell.rs | 14 +++++++++--- crates/nu-cli/tests/commands/mkdir.rs | 24 ++++++++++++++++++++- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/crates/nu-cli/src/commands/mkdir.rs b/crates/nu-cli/src/commands/mkdir.rs index 54debf250c..34f2e0c026 100644 --- a/crates/nu-cli/src/commands/mkdir.rs +++ b/crates/nu-cli/src/commands/mkdir.rs @@ -11,6 +11,8 @@ pub struct Mkdir; #[derive(Deserialize)] pub struct MkdirArgs { pub rest: Vec>, + #[serde(rename = "show-created-paths")] + pub show_created_paths: bool, } #[async_trait] @@ -20,7 +22,9 @@ impl WholeStreamCommand for Mkdir { } fn signature(&self) -> Signature { - Signature::build("mkdir").rest(SyntaxShape::Path, "the name(s) of the path(s) to create") + Signature::build("mkdir") + .rest(SyntaxShape::Path, "the name(s) of the path(s) to create") + .switch("show-created-paths", "show the path(s) created.", Some('s')) } fn usage(&self) -> &str { diff --git a/crates/nu-cli/src/shell/filesystem_shell.rs b/crates/nu-cli/src/shell/filesystem_shell.rs index a423a00a3c..141fd00cee 100644 --- a/crates/nu-cli/src/shell/filesystem_shell.rs +++ b/crates/nu-cli/src/shell/filesystem_shell.rs @@ -396,11 +396,15 @@ impl Shell for FilesystemShell { fn mkdir( &self, - MkdirArgs { rest: directories }: MkdirArgs, + MkdirArgs { + rest: directories, + show_created_paths, + }: MkdirArgs, name: Tag, path: &str, ) -> Result { let path = Path::new(path); + let mut stream = VecDeque::new(); if directories.is_empty() { return Err(ShellError::labeled_error( @@ -413,7 +417,7 @@ impl Shell for FilesystemShell { for dir in directories.iter() { let create_at = path.join(&dir.item); - let dir_res = std::fs::create_dir_all(create_at); + let dir_res = std::fs::create_dir_all(&create_at); if let Err(reason) = dir_res { return Err(ShellError::labeled_error( reason.to_string(), @@ -421,9 +425,13 @@ impl Shell for FilesystemShell { dir.tag(), )); } + if show_created_paths { + let val = format!("{:}", create_at.to_string_lossy()).into(); + stream.push_back(Ok(ReturnSuccess::Value(val))); + } } - Ok(OutputStream::empty()) + Ok(stream.into()) } fn mv( diff --git a/crates/nu-cli/tests/commands/mkdir.rs b/crates/nu-cli/tests/commands/mkdir.rs index e6d545c4a4..b14376f250 100644 --- a/crates/nu-cli/tests/commands/mkdir.rs +++ b/crates/nu-cli/tests/commands/mkdir.rs @@ -1,6 +1,6 @@ use nu_test_support::fs::files_exist_at; -use nu_test_support::nu; use nu_test_support::playground::Playground; +use nu_test_support::{nu, pipeline}; use std::path::Path; #[test] @@ -61,3 +61,25 @@ fn create_directory_two_parents_up_using_multiple_dots() { assert!(expected.exists()); }) } + +#[test] +fn show_created_paths() { + Playground::setup("mkdir_test_2", |dirs, _| { + let actual = nu!( + cwd: dirs.test(), + pipeline( + r#" + mkdir -s dir_1 dir_2 dir_3 + | count + | echo $it + "# + )); + + assert!(files_exist_at( + vec![Path::new("dir_1"), Path::new("dir_2"), Path::new("dir_3")], + dirs.test() + )); + + assert_eq!(actual.out, "3"); + }) +} From bef9669b85c31752d01e61844eba4ef4b5938e7f Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Sat, 6 Jun 2020 23:50:52 -0400 Subject: [PATCH 02/12] When the nushell is located in a path that has a space in it, these tests break, this fixes it (#1944) --- crates/nu-cli/tests/commands/cd.rs | 6 +++--- crates/nu-cli/tests/commands/cp.rs | 2 +- crates/nu-cli/tests/commands/save.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/nu-cli/tests/commands/cd.rs b/crates/nu-cli/tests/commands/cd.rs index 8d7b15bfbe..d9c12bb96a 100644 --- a/crates/nu-cli/tests/commands/cd.rs +++ b/crates/nu-cli/tests/commands/cd.rs @@ -24,7 +24,7 @@ fn filesystem_change_from_current_directory_using_absolute_path() { let actual = nu!( cwd: dirs.test(), r#" - cd {} + cd "{}" pwd | echo $it "#, dirs.formats() @@ -113,9 +113,9 @@ fn filesystem_change_current_directory_to_parent_directory_after_delete_cwd() { let actual = nu!( cwd: dirs.test().join("foo/bar"), r#" - rm {}/foo/bar + rm {}/foo/bar echo "," - cd .. + cd .. pwd | echo $it "#, dirs.test() diff --git a/crates/nu-cli/tests/commands/cp.rs b/crates/nu-cli/tests/commands/cp.rs index 0249d53ed5..9fe1272b77 100644 --- a/crates/nu-cli/tests/commands/cp.rs +++ b/crates/nu-cli/tests/commands/cp.rs @@ -8,7 +8,7 @@ fn copies_a_file() { Playground::setup("cp_test_1", |dirs, _| { nu!( cwd: dirs.root(), - "cp {} cp_test_1/sample.ini", + "cp \"{}\" cp_test_1/sample.ini", dirs.formats().join("sample.ini") ); diff --git a/crates/nu-cli/tests/commands/save.rs b/crates/nu-cli/tests/commands/save.rs index 913e076487..7a6e42b15d 100644 --- a/crates/nu-cli/tests/commands/save.rs +++ b/crates/nu-cli/tests/commands/save.rs @@ -37,7 +37,7 @@ fn writes_out_csv() { nu!( cwd: dirs.root(), - "open {}/cargo_sample.toml | get package | save save_test_2/cargo_sample.csv", + "open \"{}/cargo_sample.toml\" | get package | save save_test_2/cargo_sample.csv", dirs.formats() ); From 160191e9f461bd88b94e9bec8614c37c9efdd404 Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Sat, 6 Jun 2020 23:52:42 -0400 Subject: [PATCH 03/12] Cal updates (#1945) * Clean up `use` statements * Update cal code to be ready for future data coloring --- crates/nu-cli/src/commands/cal.rs | 35 ++++++++++++++++++------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/crates/nu-cli/src/commands/cal.rs b/crates/nu-cli/src/commands/cal.rs index a79dc2918e..bd80c2a18f 100644 --- a/crates/nu-cli/src/commands/cal.rs +++ b/crates/nu-cli/src/commands/cal.rs @@ -1,11 +1,9 @@ +use crate::commands::{command::EvaluatedWholeStreamCommandArgs, WholeStreamCommand}; use crate::prelude::*; use chrono::{Datelike, Local, NaiveDate}; -use nu_errors::ShellError; -use nu_protocol::Dictionary; - -use crate::commands::{command::EvaluatedWholeStreamCommandArgs, WholeStreamCommand}; use indexmap::IndexMap; -use nu_protocol::{Signature, SyntaxShape, UntaggedValue, Value}; +use nu_errors::ShellError; +use nu_protocol::{Dictionary, Signature, SyntaxShape, UntaggedValue, Value}; pub struct Cal; @@ -250,7 +248,7 @@ fn add_month_to_table( tag: &Tag, selected_year: i32, current_month: u32, - _current_day_option: Option, // Can be used in the future to display current day + current_day_option: Option, ) -> Result<(), ShellError> { let month_helper_result = MonthHelper::new(selected_year, current_month); @@ -316,14 +314,23 @@ fn add_month_to_table( } for day in &days_of_the_week { - let value = if (day_count <= day_limit) - && (day_count > month_helper.day_number_month_starts_on) - { - UntaggedValue::int(day_count - month_helper.day_number_month_starts_on) - .into_value(tag) - } else { - UntaggedValue::nothing().into_value(tag) - }; + let should_add_day_number_to_table = + (day_count <= day_limit) && (day_count > month_helper.day_number_month_starts_on); + + let mut value = UntaggedValue::nothing().into_value(tag); + + if should_add_day_number_to_table { + let day_count_with_offset = day_count - month_helper.day_number_month_starts_on; + + value = UntaggedValue::int(day_count_with_offset).into_value(tag); + + if let Some(current_day) = current_day_option { + if current_day == day_count_with_offset { + // TODO: Update the value here with a color when color support is added + // This colors the current day + } + } + } indexmap.insert((*day).to_string(), value); From 48672f8e30bc5b3a8fc7e2a685fc34063b352aed Mon Sep 17 00:00:00 2001 From: utam0k Date: Mon, 8 Jun 2020 01:15:57 +0900 Subject: [PATCH 04/12] Assign variables when passed as an argument. (#1947) --- crates/nu-cli/src/commands/command.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/nu-cli/src/commands/command.rs b/crates/nu-cli/src/commands/command.rs index 5b2884fb36..77b51a4d2a 100644 --- a/crates/nu-cli/src/commands/command.rs +++ b/crates/nu-cli/src/commands/command.rs @@ -384,18 +384,16 @@ impl WholeStreamCommand for FnFilterCommand { async fn run( &self, - args: CommandArgs, - registry: &CommandRegistry, - ) -> Result { - let CommandArgs { + CommandArgs { host, ctrl_c, shell_manager, call_info, mut input, .. - } = args; - + }: CommandArgs, + registry: &CommandRegistry, + ) -> Result { let host: Arc> = host.clone(); let registry: CommandRegistry = registry.clone(); let func = self.func; From 545f70705ecaeca56f50b0267ac4a9151f5cf02e Mon Sep 17 00:00:00 2001 From: Arash Outadi Date: Sun, 7 Jun 2020 13:02:37 -0700 Subject: [PATCH 05/12] ISSUE-1907 Disallow invalid top level TOML (#1946) * Do not allow invalid top-level toml Move recursive toml conversion into a helper func * Forgot to format * Forgot to use helper inside collect values Added some additional tests --- crates/nu-cli/src/commands/to_toml.rs | 108 ++++++++++++++++++++++++-- 1 file changed, 103 insertions(+), 5 deletions(-) diff --git a/crates/nu-cli/src/commands/to_toml.rs b/crates/nu-cli/src/commands/to_toml.rs index c4adac94bc..db61b51e55 100644 --- a/crates/nu-cli/src/commands/to_toml.rs +++ b/crates/nu-cli/src/commands/to_toml.rs @@ -26,9 +26,22 @@ impl WholeStreamCommand for ToTOML { ) -> Result { to_toml(args, registry) } + // TODO: add an example here. What commands to run to get a Row(Dictionary)? + // fn examples(&self) -> Vec { + // vec![ + // Example { + // description: + // "Outputs an TOML string representing TOML document", + // example: "echo [1 2 3] | to json", + // result: Some(vec![Value::from("[1,2,3]")]), + // }, + // ] + // } } -pub fn value_to_toml_value(v: &Value) -> Result { +// Helper method to recursively convert nu_protocol::Value -> toml::Value +// This shouldn't be called at the top-level +fn helper(v: &Value) -> Result { Ok(match &v.value { UntaggedValue::Primitive(Primitive::Boolean(b)) => toml::Value::Boolean(*b), UntaggedValue::Primitive(Primitive::Bytes(b)) => toml::Value::Integer(*b as i64), @@ -66,7 +79,6 @@ pub fn value_to_toml_value(v: &Value) -> Result { }) .collect::, ShellError>>()?, ), - UntaggedValue::Table(l) => toml::Value::Array(collect_values(l)?), UntaggedValue::Error(e) => return Err(e.clone()), UntaggedValue::Block(_) => toml::Value::String("".to_string()), @@ -77,18 +89,47 @@ pub fn value_to_toml_value(v: &Value) -> Result { UntaggedValue::Row(o) => { let mut m = toml::map::Map::new(); for (k, v) in o.entries.iter() { - m.insert(k.clone(), value_to_toml_value(v)?); + m.insert(k.clone(), helper(v)?); } toml::Value::Table(m) } }) } +/// Converts a nu_protocol::Value into a toml::Value +/// Will return a Shell Error, if the Nu Value is not a valid top-level TOML Value +pub fn value_to_toml_value(v: &Value) -> Result { + match &v.value { + UntaggedValue::Row(o) => { + let mut m = toml::map::Map::new(); + for (k, v) in o.entries.iter() { + m.insert(k.clone(), helper(v)?); + } + Ok(toml::Value::Table(m)) + } + UntaggedValue::Primitive(Primitive::String(s)) => { + // Attempt to de-serialize the String + toml::de::from_str(s).map_err(|_| { + ShellError::labeled_error( + format!("{:?} unable to de-serialize string to TOML", s), + "invalid TOML", + v.tag(), + ) + }) + } + _ => Err(ShellError::labeled_error( + format!("{:?} is not a valid top-level TOML", v.value), + "invalid TOML", + v.tag(), + )), + } +} + fn collect_values(input: &[Value]) -> Result, ShellError> { let mut out = vec![]; for value in input { - out.push(value_to_toml_value(value)?); + out.push(helper(value)?); } Ok(out) @@ -141,7 +182,8 @@ fn to_toml(args: CommandArgs, registry: &CommandRegistry) -> Result What we do in "crates/nu-cli/src/data/config.rs" to write the config file + let mut m = indexmap::IndexMap::new(); + m.insert("rust".to_owned(), Value::from("editor")); + m.insert("is".to_owned(), Value::nothing()); + m.insert( + "features".to_owned(), + UntaggedValue::Table(vec![ + UntaggedValue::string("hello").into_untagged_value(), + UntaggedValue::string("array").into_untagged_value(), + ]) + .into_untagged_value(), + ); + let tv = value_to_toml_value(&UntaggedValue::Row(Dictionary::new(m)).into_untagged_value()) + .expect("Expected Ok from valid TOML dictionary"); + assert_eq!( + tv.get("features"), + Some(&toml::Value::Array(vec![ + toml::Value::String("hello".to_owned()), + toml::Value::String("array".to_owned()) + ])) + ); + // TOML string + let tv = value_to_toml_value(&Value::from( + r#" + title = "TOML Example" + + [owner] + name = "Tom Preston-Werner" + dob = 1979-05-27T07:32:00-08:00 # First class dates + + [dependencies] + rustyline = "4.1.0" + sysinfo = "0.8.4" + chrono = { version = "0.4.6", features = ["serde"] } + "#, + )) + .expect("Expected Ok from valid TOML string"); + assert_eq!( + tv.get("title").unwrap(), + &toml::Value::String("TOML Example".to_owned()) + ); + // + // Negative Tests + // + value_to_toml_value(&Value::from("not_valid")) + .expect_err("Expected non-valid toml (String) to cause error!"); + value_to_toml_value(&UntaggedValue::Table(vec![Value::from("1")]).into_untagged_value()) + .expect_err("Expected non-valid toml (Table) to cause error!"); + } } From ec7ff5960d290b8d2426f36125a8cb98c2d551f5 Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Mon, 8 Jun 2020 00:48:10 -0400 Subject: [PATCH 06/12] Remove async_stream! from some commands (#1951) * Remove async_stream! from open.rs * Ran rustfmt * Fix Clippy warning * Removed async_stream! from evaluate_by.rs * Removed async_stream! from exit.rs * Removed async_stream! from from_eml.rs * Removed async_stream! from group_by_date.rs * Removed async_stream! from group_by.rs * Removed async_stream! from map_max.rs * Removed async_stream! from to_sqlite.rs * Removed async_stream! from to_md.rs * Removed async_stream! from to_html.rs --- crates/nu-cli/src/commands/evaluate_by.rs | 45 +++--- crates/nu-cli/src/commands/exit.rs | 21 +-- crates/nu-cli/src/commands/from_eml.rs | 64 ++++---- crates/nu-cli/src/commands/group_by.rs | 39 +++-- crates/nu-cli/src/commands/group_by_date.rs | 75 +++++---- crates/nu-cli/src/commands/map_max_by.rs | 43 +++--- crates/nu-cli/src/commands/open.rs | 46 +++--- crates/nu-cli/src/commands/to_html.rs | 160 ++++++++++---------- crates/nu-cli/src/commands/to_md.rs | 75 ++++----- crates/nu-cli/src/commands/to_sqlite.rs | 37 +++-- 10 files changed, 306 insertions(+), 299 deletions(-) diff --git a/crates/nu-cli/src/commands/evaluate_by.rs b/crates/nu-cli/src/commands/evaluate_by.rs index 12e4d72b59..6db406724f 100644 --- a/crates/nu-cli/src/commands/evaluate_by.rs +++ b/crates/nu-cli/src/commands/evaluate_by.rs @@ -37,42 +37,37 @@ impl WholeStreamCommand for EvaluateBy { args: CommandArgs, registry: &CommandRegistry, ) -> Result { - evaluate_by(args, registry) + evaluate_by(args, registry).await } } -pub fn evaluate_by( +pub async fn evaluate_by( args: CommandArgs, registry: &CommandRegistry, ) -> Result { let registry = registry.clone(); - let stream = async_stream! { - let name = args.call_info.name_tag.clone(); - let (EvaluateByArgs { evaluate_with }, mut input) = args.process(®istry).await?; - let values: Vec = input.collect().await; + let name = args.call_info.name_tag.clone(); + let (EvaluateByArgs { evaluate_with }, mut input) = args.process(®istry).await?; + let values: Vec = input.collect().await; - if values.is_empty() { - yield Err(ShellError::labeled_error( - "Expected table from pipeline", - "requires a table input", - name - )) + if values.is_empty() { + Err(ShellError::labeled_error( + "Expected table from pipeline", + "requires a table input", + name, + )) + } else { + let evaluate_with = if let Some(evaluator) = evaluate_with { + Some(evaluator.item().clone()) } else { + None + }; - let evaluate_with = if let Some(evaluator) = evaluate_with { - Some(evaluator.item().clone()) - } else { - None - }; - - match evaluate(&values[0], evaluate_with, name) { - Ok(evaluated) => yield ReturnSuccess::value(evaluated), - Err(err) => yield Err(err) - } + match evaluate(&values[0], evaluate_with, name) { + Ok(evaluated) => Ok(OutputStream::one(ReturnSuccess::value(evaluated))), + Err(err) => Err(err), } - }; - - Ok(stream.to_output_stream()) + } } #[cfg(test)] diff --git a/crates/nu-cli/src/commands/exit.rs b/crates/nu-cli/src/commands/exit.rs index 1463dec3be..1d451addc0 100644 --- a/crates/nu-cli/src/commands/exit.rs +++ b/crates/nu-cli/src/commands/exit.rs @@ -25,7 +25,7 @@ impl WholeStreamCommand for Exit { args: CommandArgs, registry: &CommandRegistry, ) -> Result { - exit(args, registry) + exit(args, registry).await } fn examples(&self) -> Vec { @@ -44,19 +44,20 @@ impl WholeStreamCommand for Exit { } } -pub fn exit(args: CommandArgs, registry: &CommandRegistry) -> Result { +pub async fn exit( + args: CommandArgs, + registry: &CommandRegistry, +) -> Result { let registry = registry.clone(); - let stream = async_stream! { - let args = args.evaluate_once(®istry).await?; + let args = args.evaluate_once(®istry).await?; - if args.call_info.args.has("now") { - yield Ok(ReturnSuccess::Action(CommandAction::Exit)); - } else { - yield Ok(ReturnSuccess::Action(CommandAction::LeaveShell)); - } + let command_action = if args.call_info.args.has("now") { + CommandAction::Exit + } else { + CommandAction::LeaveShell }; - Ok(stream.to_output_stream()) + Ok(OutputStream::one(ReturnSuccess::action(command_action))) } #[cfg(test)] diff --git a/crates/nu-cli/src/commands/from_eml.rs b/crates/nu-cli/src/commands/from_eml.rs index 2b479472ce..a896f291f7 100644 --- a/crates/nu-cli/src/commands/from_eml.rs +++ b/crates/nu-cli/src/commands/from_eml.rs @@ -40,7 +40,7 @@ impl WholeStreamCommand for FromEML { args: CommandArgs, registry: &CommandRegistry, ) -> Result { - from_eml(args, registry) + from_eml(args, registry).await } } @@ -77,46 +77,54 @@ fn headerfieldvalue_to_value(tag: &Tag, value: &HeaderFieldValue) -> UntaggedVal } } -fn from_eml(args: CommandArgs, registry: &CommandRegistry) -> Result { +async fn from_eml( + args: CommandArgs, + registry: &CommandRegistry, +) -> Result { let tag = args.call_info.name_tag.clone(); let registry = registry.clone(); - let stream = async_stream! { - let (eml_args, mut input): (FromEMLArgs, _) = args.process(®istry).await?; - let value = input.collect_string(tag.clone()).await?; + let (eml_args, input): (FromEMLArgs, _) = args.process(®istry).await?; + let value = input.collect_string(tag.clone()).await?; - let body_preview = eml_args.preview_body.map(|b| b.item).unwrap_or(DEFAULT_BODY_PREVIEW); + let body_preview = eml_args + .preview_body + .map(|b| b.item) + .unwrap_or(DEFAULT_BODY_PREVIEW); - let eml = EmlParser::from_string(value.item) + let eml = EmlParser::from_string(value.item) .with_body_preview(body_preview) .parse() - .map_err(|_| ShellError::labeled_error("Could not parse .eml file", "could not parse .eml file", &tag))?; + .map_err(|_| { + ShellError::labeled_error( + "Could not parse .eml file", + "could not parse .eml file", + &tag, + ) + })?; - let mut dict = TaggedDictBuilder::new(&tag); + let mut dict = TaggedDictBuilder::new(&tag); - if let Some(subj) = eml.subject { - dict.insert_untagged("Subject", UntaggedValue::string(subj)); - } + if let Some(subj) = eml.subject { + dict.insert_untagged("Subject", UntaggedValue::string(subj)); + } - if let Some(from) = eml.from { - dict.insert_untagged("From", headerfieldvalue_to_value(&tag, &from)); - } + if let Some(from) = eml.from { + dict.insert_untagged("From", headerfieldvalue_to_value(&tag, &from)); + } - if let Some(to) = eml.to { - dict.insert_untagged("To", headerfieldvalue_to_value(&tag, &to)); - } + if let Some(to) = eml.to { + dict.insert_untagged("To", headerfieldvalue_to_value(&tag, &to)); + } - for HeaderField{ name, value } in eml.headers.iter() { - dict.insert_untagged(name, headerfieldvalue_to_value(&tag, &value)); - } + for HeaderField { name, value } in eml.headers.iter() { + dict.insert_untagged(name, headerfieldvalue_to_value(&tag, &value)); + } - if let Some(body) = eml.body { - dict.insert_untagged("Body", UntaggedValue::string(body)); - } + if let Some(body) = eml.body { + dict.insert_untagged("Body", UntaggedValue::string(body)); + } - yield ReturnSuccess::value(dict.into_value()); - }; - - Ok(stream.to_output_stream()) + Ok(OutputStream::one(ReturnSuccess::value(dict.into_value()))) } #[cfg(test)] diff --git a/crates/nu-cli/src/commands/group_by.rs b/crates/nu-cli/src/commands/group_by.rs index b26830655c..4b63ed8233 100644 --- a/crates/nu-cli/src/commands/group_by.rs +++ b/crates/nu-cli/src/commands/group_by.rs @@ -35,7 +35,7 @@ impl WholeStreamCommand for GroupBy { args: CommandArgs, registry: &CommandRegistry, ) -> Result { - group_by(args, registry) + group_by(args, registry).await } fn examples(&self) -> Vec { @@ -71,30 +71,27 @@ impl WholeStreamCommand for GroupBy { } } -pub fn group_by(args: CommandArgs, registry: &CommandRegistry) -> Result { +pub async fn group_by( + args: CommandArgs, + registry: &CommandRegistry, +) -> Result { let registry = registry.clone(); let name = args.call_info.name_tag.clone(); - let stream = async_stream! { - let (GroupByArgs { column_name }, mut input) = args.process(®istry).await?; - let values: Vec = input.collect().await; - - if values.is_empty() { - yield Err(ShellError::labeled_error( - "Expected table from pipeline", - "requires a table input", - name - )) - } else { - - match crate::utils::data::group(column_name, &values, None, &name) { - Ok(grouped) => yield ReturnSuccess::value(grouped), - Err(err) => yield Err(err), - } + let (GroupByArgs { column_name }, input) = args.process(®istry).await?; + let values: Vec = input.collect().await; + if values.is_empty() { + Err(ShellError::labeled_error( + "Expected table from pipeline", + "requires a table input", + name, + )) + } else { + match crate::utils::data::group(column_name, &values, None, &name) { + Ok(grouped) => Ok(OutputStream::one(ReturnSuccess::value(grouped))), + Err(err) => Err(err), } - }; - - Ok(stream.to_output_stream()) + } } pub fn group( diff --git a/crates/nu-cli/src/commands/group_by_date.rs b/crates/nu-cli/src/commands/group_by_date.rs index b36ab63dac..f361deb207 100644 --- a/crates/nu-cli/src/commands/group_by_date.rs +++ b/crates/nu-cli/src/commands/group_by_date.rs @@ -42,7 +42,7 @@ impl WholeStreamCommand for GroupByDate { args: CommandArgs, registry: &CommandRegistry, ) -> Result { - group_by_date(args, registry) + group_by_date(args, registry).await } fn examples(&self) -> Vec { @@ -58,50 +58,59 @@ enum Grouper { ByDate(Option), } -pub fn group_by_date( +pub async fn group_by_date( args: CommandArgs, registry: &CommandRegistry, ) -> Result { let registry = registry.clone(); let name = args.call_info.name_tag.clone(); - let stream = async_stream! { - let (GroupByDateArgs { column_name, format }, mut input) = args.process(®istry).await?; - let values: Vec = input.collect().await; + let ( + GroupByDateArgs { + column_name, + format, + }, + input, + ) = args.process(®istry).await?; + let values: Vec = input.collect().await; - if values.is_empty() { - yield Err(ShellError::labeled_error( - "Expected table from pipeline", - "requires a table input", - name - )) + if values.is_empty() { + Err(ShellError::labeled_error( + "Expected table from pipeline", + "requires a table input", + name, + )) + } else { + let grouper = if let Some(Tagged { item: fmt, tag: _ }) = format { + Grouper::ByDate(Some(fmt)) } else { + Grouper::ByDate(None) + }; - let grouper = if let Some(Tagged { item: fmt, tag }) = format { - Grouper::ByDate(Some(fmt)) - } else { - Grouper::ByDate(None) - }; - - match grouper { - Grouper::ByDate(None) => { - match crate::utils::data::group(column_name, &values, Some(Box::new(|row: &Value| row.format("%Y-%b-%d"))), &name) { - Ok(grouped) => yield ReturnSuccess::value(grouped), - Err(err) => yield Err(err), - } + match grouper { + Grouper::ByDate(None) => { + match crate::utils::data::group( + column_name, + &values, + Some(Box::new(|row: &Value| row.format("%Y-%b-%d"))), + &name, + ) { + Ok(grouped) => Ok(OutputStream::one(ReturnSuccess::value(grouped))), + Err(err) => Err(err), } - Grouper::ByDate(Some(fmt)) => { - match crate::utils::data::group(column_name, &values, Some(Box::new(move |row: &Value| { - row.format(&fmt) - })), &name) { - Ok(grouped) => yield ReturnSuccess::value(grouped), - Err(err) => yield Err(err), - } + } + Grouper::ByDate(Some(fmt)) => { + match crate::utils::data::group( + column_name, + &values, + Some(Box::new(move |row: &Value| row.format(&fmt))), + &name, + ) { + Ok(grouped) => Ok(OutputStream::one(ReturnSuccess::value(grouped))), + Err(err) => Err(err), } } } - }; - - Ok(stream.to_output_stream()) + } } #[cfg(test)] diff --git a/crates/nu-cli/src/commands/map_max_by.rs b/crates/nu-cli/src/commands/map_max_by.rs index 836041ab09..a8664ab724 100644 --- a/crates/nu-cli/src/commands/map_max_by.rs +++ b/crates/nu-cli/src/commands/map_max_by.rs @@ -38,42 +38,37 @@ impl WholeStreamCommand for MapMaxBy { args: CommandArgs, registry: &CommandRegistry, ) -> Result { - map_max_by(args, registry) + map_max_by(args, registry).await } } -pub fn map_max_by( +pub async fn map_max_by( args: CommandArgs, registry: &CommandRegistry, ) -> Result { let registry = registry.clone(); let name = args.call_info.name_tag.clone(); - let stream = async_stream! { - let (MapMaxByArgs { column_name }, mut input) = args.process(®istry).await?; - let values: Vec = input.collect().await; + let (MapMaxByArgs { column_name }, mut input) = args.process(®istry).await?; + let values: Vec = input.collect().await; - if values.is_empty() { - yield Err(ShellError::labeled_error( - "Expected table from pipeline", - "requires a table input", - name - )) + if values.is_empty() { + Err(ShellError::labeled_error( + "Expected table from pipeline", + "requires a table input", + name, + )) + } else { + let map_by_column = if let Some(column_to_map) = column_name { + Some(column_to_map.item().clone()) } else { + None + }; - let map_by_column = if let Some(column_to_map) = column_name { - Some(column_to_map.item().clone()) - } else { - None - }; - - match map_max(&values[0], map_by_column, name) { - Ok(table_maxed) => yield ReturnSuccess::value(table_maxed), - Err(err) => yield Err(err) - } + match map_max(&values[0], map_by_column, name) { + Ok(table_maxed) => Ok(OutputStream::one(ReturnSuccess::value(table_maxed))), + Err(err) => Err(err), } - }; - - Ok(stream.to_output_stream()) + } } #[cfg(test)] diff --git a/crates/nu-cli/src/commands/open.rs b/crates/nu-cli/src/commands/open.rs index 0be878b33f..ce7e52f2ab 100644 --- a/crates/nu-cli/src/commands/open.rs +++ b/crates/nu-cli/src/commands/open.rs @@ -42,7 +42,7 @@ impl WholeStreamCommand for Open { args: CommandArgs, registry: &CommandRegistry, ) -> Result { - open(args, registry) + open(args, registry).await } fn examples(&self) -> Vec { @@ -54,39 +54,33 @@ impl WholeStreamCommand for Open { } } -fn open(args: CommandArgs, registry: &CommandRegistry) -> Result { +async fn open(args: CommandArgs, registry: &CommandRegistry) -> Result { let cwd = PathBuf::from(args.shell_manager.path()); let full_path = cwd; let registry = registry.clone(); - let stream = async_stream! { - let (OpenArgs { path, raw }, _) = args.process(®istry).await?; - let result = fetch(&full_path, &path.item, path.tag.span).await; + let (OpenArgs { path, raw }, _) = args.process(®istry).await?; + let result = fetch(&full_path, &path.item, path.tag.span).await; - if let Err(e) = result { - yield Err(e); - return; - } - let (file_extension, contents, contents_tag) = result?; + let (file_extension, contents, contents_tag) = result?; - let file_extension = if raw.item { - None - } else { - // If the extension could not be determined via mimetype, try to use the path - // extension. Some file types do not declare their mimetypes (such as bson files). - file_extension.or(path.extension().map(|x| x.to_string_lossy().to_string())) - }; - - let tagged_contents = contents.into_value(&contents_tag); - - if let Some(extension) = file_extension { - yield Ok(ReturnSuccess::Action(CommandAction::AutoConvert(tagged_contents, extension))) - } else { - yield ReturnSuccess::value(tagged_contents); - } + let file_extension = if raw.item { + None + } else { + // If the extension could not be determined via mimetype, try to use the path + // extension. Some file types do not declare their mimetypes (such as bson files). + file_extension.or_else(|| path.extension().map(|x| x.to_string_lossy().to_string())) }; - Ok(stream.to_output_stream()) + let tagged_contents = contents.into_value(&contents_tag); + + if let Some(extension) = file_extension { + Ok(OutputStream::one(ReturnSuccess::action( + CommandAction::AutoConvert(tagged_contents, extension), + ))) + } else { + Ok(OutputStream::one(ReturnSuccess::value(tagged_contents))) + } } pub async fn fetch( diff --git a/crates/nu-cli/src/commands/to_html.rs b/crates/nu-cli/src/commands/to_html.rs index df460ceb80..c6de43506d 100644 --- a/crates/nu-cli/src/commands/to_html.rs +++ b/crates/nu-cli/src/commands/to_html.rs @@ -27,98 +27,106 @@ impl WholeStreamCommand for ToHTML { args: CommandArgs, registry: &CommandRegistry, ) -> Result { - to_html(args, registry) + to_html(args, registry).await } } -fn to_html(args: CommandArgs, registry: &CommandRegistry) -> Result { +async fn to_html( + args: CommandArgs, + registry: &CommandRegistry, +) -> Result { let registry = registry.clone(); - let stream = async_stream! { - let args = args.evaluate_once(®istry).await?; - let name_tag = args.name_tag(); - let input: Vec = args.input.collect().await; - let headers = nu_protocol::merge_descriptors(&input); - let mut output_string = "".to_string(); + let args = args.evaluate_once(®istry).await?; + let name_tag = args.name_tag(); + let input: Vec = args.input.collect().await; + let headers = nu_protocol::merge_descriptors(&input); + let mut output_string = "".to_string(); - if !headers.is_empty() && (headers.len() > 1 || headers[0] != "") { - output_string.push_str(""); + if !headers.is_empty() && (headers.len() > 1 || headers[0] != "") { + output_string.push_str("
"); - output_string.push_str(""); - for header in &headers { - output_string.push_str(""); - } - output_string.push_str(""); + output_string.push_str(""); + for header in &headers { + output_string.push_str(""); } + output_string.push_str(""); + } - for row in input { - match row.value { - UntaggedValue::Primitive(Primitive::Binary(b)) => { - // This might be a bit much, but it's fun :) - match row.tag.anchor { - Some(AnchorLocation::Url(f)) | - Some(AnchorLocation::File(f)) => { - let extension = f.split('.').last().map(String::from); - match extension { - Some(s) if ["png", "jpg", "bmp", "gif", "tiff", "jpeg"].contains(&s.to_lowercase().as_str()) => { - output_string.push_str(""); - } - _ => {} + for row in input { + match row.value { + UntaggedValue::Primitive(Primitive::Binary(b)) => { + // This might be a bit much, but it's fun :) + match row.tag.anchor { + Some(AnchorLocation::Url(f)) | Some(AnchorLocation::File(f)) => { + let extension = f.split('.').last().map(String::from); + match extension { + Some(s) + if ["png", "jpg", "bmp", "gif", "tiff", "jpeg"] + .contains(&s.to_lowercase().as_str()) => + { + output_string.push_str(""); } + _ => {} } - _ => {} } - } - UntaggedValue::Primitive(Primitive::String(ref b)) => { - // This might be a bit much, but it's fun :) - match row.tag.anchor { - Some(AnchorLocation::Url(f)) | - Some(AnchorLocation::File(f)) => { - let extension = f.split('.').last().map(String::from); - match extension { - Some(s) if s.to_lowercase() == "svg" => { - output_string.push_str(""); - continue; - } - _ => {} - } - } - _ => {} - } - output_string.push_str(&(htmlescape::encode_minimal(&format_leaf(&row.value).plain_string(100_000)).replace("\n", "
"))); - } - UntaggedValue::Row(row) => { - output_string.push_str(""); - for header in &headers { - let data = row.get_data(header); - output_string.push_str(""); - } - output_string.push_str(""); - } - p => { - output_string.push_str(&(htmlescape::encode_minimal(&format_leaf(&p).plain_string(100_000)).replace("\n", "
"))); + _ => {} } } + UntaggedValue::Primitive(Primitive::String(ref b)) => { + // This might be a bit much, but it's fun :) + match row.tag.anchor { + Some(AnchorLocation::Url(f)) | Some(AnchorLocation::File(f)) => { + let extension = f.split('.').last().map(String::from); + match extension { + Some(s) if s.to_lowercase() == "svg" => { + output_string.push_str(""); + continue; + } + _ => {} + } + } + _ => {} + } + output_string.push_str( + &(htmlescape::encode_minimal(&format_leaf(&row.value).plain_string(100_000)) + .replace("\n", "
")), + ); + } + UntaggedValue::Row(row) => { + output_string.push_str(""); + for header in &headers { + let data = row.get_data(header); + output_string.push_str(""); + } + output_string.push_str(""); + } + p => { + output_string.push_str( + &(htmlescape::encode_minimal(&format_leaf(&p).plain_string(100_000)) + .replace("\n", "
")), + ); + } } + } - if !headers.is_empty() && (headers.len() > 1 || headers[0] != "") { - output_string.push_str("
"); - output_string.push_str(&htmlescape::encode_minimal(&header)); - output_string.push_str("
"); + output_string.push_str(&htmlescape::encode_minimal(&header)); + output_string.push_str("
"); - output_string.push_str(&format_leaf(data.borrow()).plain_string(100_000)); - output_string.push_str("
"); + output_string.push_str(&format_leaf(data.borrow()).plain_string(100_000)); + output_string.push_str("
"); - } - output_string.push_str(""); + if !headers.is_empty() && (headers.len() > 1 || headers[0] != "") { + output_string.push_str(""); + } + output_string.push_str(""); - yield ReturnSuccess::value(UntaggedValue::string(output_string).into_value(name_tag)); - }; - - Ok(stream.to_output_stream()) + Ok(OutputStream::one(ReturnSuccess::value( + UntaggedValue::string(output_string).into_value(name_tag), + ))) } #[cfg(test)] diff --git a/crates/nu-cli/src/commands/to_md.rs b/crates/nu-cli/src/commands/to_md.rs index 81e400a639..587390abc3 100644 --- a/crates/nu-cli/src/commands/to_md.rs +++ b/crates/nu-cli/src/commands/to_md.rs @@ -26,55 +26,58 @@ impl WholeStreamCommand for ToMarkdown { args: CommandArgs, registry: &CommandRegistry, ) -> Result { - to_html(args, registry) + to_html(args, registry).await } } -fn to_html(args: CommandArgs, registry: &CommandRegistry) -> Result { +async fn to_html( + args: CommandArgs, + registry: &CommandRegistry, +) -> Result { let registry = registry.clone(); - let stream = async_stream! { - let args = args.evaluate_once(®istry).await?; - let name_tag = args.name_tag(); - let input: Vec = args.input.collect().await; - let headers = nu_protocol::merge_descriptors(&input); - let mut output_string = String::new(); + let args = args.evaluate_once(®istry).await?; + let name_tag = args.name_tag(); + let input: Vec = args.input.collect().await; + let headers = nu_protocol::merge_descriptors(&input); + let mut output_string = String::new(); - if !headers.is_empty() && (headers.len() > 1 || headers[0] != "") { + if !headers.is_empty() && (headers.len() > 1 || headers[0] != "") { + output_string.push_str("|"); + for header in &headers { + output_string.push_str(&htmlescape::encode_minimal(&header)); output_string.push_str("|"); - for header in &headers { - output_string.push_str(&htmlescape::encode_minimal(&header)); - output_string.push_str("|"); - } - output_string.push_str("\n|"); - for _ in &headers { - output_string.push_str("-"); - output_string.push_str("|"); - } - output_string.push_str("\n"); } + output_string.push_str("\n|"); + for _ in &headers { + output_string.push_str("-"); + output_string.push_str("|"); + } + output_string.push_str("\n"); + } - for row in input { - match row.value { - UntaggedValue::Row(row) => { + for row in input { + match row.value { + UntaggedValue::Row(row) => { + output_string.push_str("|"); + for header in &headers { + let data = row.get_data(header); + output_string.push_str(&format_leaf(data.borrow()).plain_string(100_000)); output_string.push_str("|"); - for header in &headers { - let data = row.get_data(header); - output_string.push_str(&format_leaf(data.borrow()).plain_string(100_000)); - output_string.push_str("|"); - } - output_string.push_str("\n"); - } - p => { - output_string.push_str(&(htmlescape::encode_minimal(&format_leaf(&p).plain_string(100_000)))); - output_string.push_str("\n"); } + output_string.push_str("\n"); + } + p => { + output_string.push_str( + &(htmlescape::encode_minimal(&format_leaf(&p).plain_string(100_000))), + ); + output_string.push_str("\n"); } } + } - yield ReturnSuccess::value(UntaggedValue::string(output_string).into_value(name_tag)); - }; - - Ok(stream.to_output_stream()) + Ok(OutputStream::one(ReturnSuccess::value( + UntaggedValue::string(output_string).into_value(name_tag), + ))) } #[cfg(test)] diff --git a/crates/nu-cli/src/commands/to_sqlite.rs b/crates/nu-cli/src/commands/to_sqlite.rs index 012661a74d..9e6805c5fa 100644 --- a/crates/nu-cli/src/commands/to_sqlite.rs +++ b/crates/nu-cli/src/commands/to_sqlite.rs @@ -27,7 +27,7 @@ impl WholeStreamCommand for ToSQLite { args: CommandArgs, registry: &CommandRegistry, ) -> Result { - to_sqlite(args, registry) + to_sqlite(args, registry).await } fn is_binary(&self) -> bool { @@ -56,7 +56,7 @@ impl WholeStreamCommand for ToDB { args: CommandArgs, registry: &CommandRegistry, ) -> Result { - to_sqlite(args, registry) + to_sqlite(args, registry).await } fn is_binary(&self) -> bool { @@ -203,26 +203,23 @@ fn sqlite_input_stream_to_bytes(values: Vec) -> Result Result { +async fn to_sqlite( + args: CommandArgs, + registry: &CommandRegistry, +) -> Result { let registry = registry.clone(); - let stream = async_stream! { - let args = args.evaluate_once(®istry).await?; - let name_tag = args.name_tag(); - let input: Vec = args.input.collect().await; + let args = args.evaluate_once(®istry).await?; + let name_tag = args.name_tag(); + let input: Vec = args.input.collect().await; - match sqlite_input_stream_to_bytes(input) { - Ok(out) => yield ReturnSuccess::value(out), - _ => { - yield Err(ShellError::labeled_error( - "Expected a table with SQLite-compatible structure from pipeline", - "requires SQLite-compatible input", - name_tag, - )) - }, - } - }; - - Ok(stream.to_output_stream()) + match sqlite_input_stream_to_bytes(input) { + Ok(out) => Ok(OutputStream::one(ReturnSuccess::value(out))), + _ => Err(ShellError::labeled_error( + "Expected a table with SQLite-compatible structure from pipeline", + "requires SQLite-compatible input", + name_tag, + )), + } } #[cfg(test)] From bf459e09cb9131254e08837aa8f4c1f198fc082f Mon Sep 17 00:00:00 2001 From: Sam Hedin Date: Mon, 8 Jun 2020 09:55:25 +0200 Subject: [PATCH 07/12] WIP: Per directory env-variables (#1943) * Add args in .nurc file to environment * Working dummy version * Add add_nurc to sync_env command * Parse .nurc file * Delete env vars after leaving directory * Removing vals not working, strangely * Refactoring, add comment * Debugging * Debug by logging to file * Add and remove env var behavior appears correct However, it does not use existing code that well. * Move work to cli.rs * Parse config directories * I am in a state of distress * Rename .nurc to .nu * Some notes for me * Refactoring * Removing vars works, but not done in a very nice fashion * Refactor env_vars_to_delete * Refactor env_vars_to_add() * Move directory environment code to separate file * Refactor from_config * Restore env values * Working? * Working? * Update comments and change var name * Formatting * Remove vars after leaving dir * Remove notes I made * Rename config function * Clippy * Cleanup and handle errors * cargo fmt * Better error messages, remove last (?) unwrap * FORMAT PLZ * Rename whitelisted_directories to allowed_directories * Add comment to clarify how overwritten values are restored. --- crates/nu-cli/src/data/config/conf.rs | 6 +- crates/nu-cli/src/data/config/nuconfig.rs | 12 ++ crates/nu-cli/src/data/config/tests.rs | 4 + crates/nu-cli/src/env.rs | 1 + .../src/env/directory_specific_environment.rs | 195 ++++++++++++++++++ crates/nu-cli/src/env/environment.rs | 46 ++++- crates/nu-cli/src/env/environment_syncer.rs | 4 +- 7 files changed, 259 insertions(+), 9 deletions(-) create mode 100644 crates/nu-cli/src/env/directory_specific_environment.rs diff --git a/crates/nu-cli/src/data/config/conf.rs b/crates/nu-cli/src/data/config/conf.rs index b3504441e2..1f53f0c7a2 100644 --- a/crates/nu-cli/src/data/config/conf.rs +++ b/crates/nu-cli/src/data/config/conf.rs @@ -4,7 +4,7 @@ use std::fmt::Debug; pub trait Conf: Debug + Send { fn env(&self) -> Option; fn path(&self) -> Option; - + fn nu_env_dirs(&self) -> Option; fn reload(&self); } @@ -13,6 +13,10 @@ impl Conf for Box { (**self).env() } + fn nu_env_dirs(&self) -> Option { + (**self).nu_env_dirs() + } + fn path(&self) -> Option { (**self).path() } diff --git a/crates/nu-cli/src/data/config/nuconfig.rs b/crates/nu-cli/src/data/config/nuconfig.rs index 3444e1f7a9..54001026a2 100644 --- a/crates/nu-cli/src/data/config/nuconfig.rs +++ b/crates/nu-cli/src/data/config/nuconfig.rs @@ -20,6 +20,10 @@ impl Conf for NuConfig { self.path() } + fn nu_env_dirs(&self) -> Option { + self.nu_env_dirs() + } + fn reload(&self) { let mut vars = self.vars.lock(); @@ -52,6 +56,14 @@ impl NuConfig { None } + pub fn nu_env_dirs(&self) -> Option { + let vars = self.vars.lock(); + if let Some(dirs) = vars.get("nu_env_dirs") { + return Some(dirs.clone()); + } + None + } + pub fn path(&self) -> Option { let vars = self.vars.lock(); diff --git a/crates/nu-cli/src/data/config/tests.rs b/crates/nu-cli/src/data/config/tests.rs index ecbe0cb7f7..ea8712fe0f 100644 --- a/crates/nu-cli/src/data/config/tests.rs +++ b/crates/nu-cli/src/data/config/tests.rs @@ -16,6 +16,10 @@ impl Conf for FakeConfig { self.config.env() } + fn nu_env_dirs(&self) -> Option { + None + } + fn path(&self) -> Option { self.config.path() } diff --git a/crates/nu-cli/src/env.rs b/crates/nu-cli/src/env.rs index 3f1dd1c311..74ae277ab5 100644 --- a/crates/nu-cli/src/env.rs +++ b/crates/nu-cli/src/env.rs @@ -1,3 +1,4 @@ +pub(crate) mod directory_specific_environment; pub(crate) mod environment; pub(crate) mod environment_syncer; pub(crate) mod host; diff --git a/crates/nu-cli/src/env/directory_specific_environment.rs b/crates/nu-cli/src/env/directory_specific_environment.rs new file mode 100644 index 0000000000..ca201aed0f --- /dev/null +++ b/crates/nu-cli/src/env/directory_specific_environment.rs @@ -0,0 +1,195 @@ +use indexmap::IndexMap; +use nu_protocol::{Primitive, UntaggedValue, Value}; +use std::io::{Error, ErrorKind, Result}; +use std::{ffi::OsString, fmt::Debug, path::PathBuf}; + +#[derive(Debug, Default)] +pub struct DirectorySpecificEnvironment { + allowed_directories: Vec, + + //Directory -> Env key. If an environment var has been added from a .nu in a directory, we track it here so we can remove it when the user leaves the directory. + added_env_vars: IndexMap>, + + //Directory -> (env_key, value). If a .nu overwrites some existing environment variables, they are added here so that they can be restored later. + overwritten_env_values: IndexMap>, +} + +impl DirectorySpecificEnvironment { + pub fn new(allowed_directories: Option) -> DirectorySpecificEnvironment { + let mut allowed_directories = if let Some(Value { + value: UntaggedValue::Table(ref wrapped_directories), + tag: _, + }) = allowed_directories + { + wrapped_directories + .iter() + .filter_map(|dirval| { + if let Value { + value: UntaggedValue::Primitive(Primitive::String(ref dir)), + tag: _, + } = dirval + { + return Some(PathBuf::from(&dir)); + } + None + }) + .collect() + } else { + vec![] + }; + allowed_directories.sort(); + + DirectorySpecificEnvironment { + allowed_directories, + added_env_vars: IndexMap::new(), + overwritten_env_values: IndexMap::new(), + } + } + + //If we are no longer in a directory, we restore the values it overwrote. + pub fn overwritten_values_to_restore(&mut self) -> Result> { + let current_dir = std::env::current_dir()?; + + let mut keyvals_to_restore = IndexMap::new(); + let mut new_overwritten = IndexMap::new(); + + for (directory, keyvals) in &self.overwritten_env_values { + let mut working_dir = Some(current_dir.as_path()); + + let mut re_add_keyvals = true; + while let Some(wdir) = working_dir { + if wdir == directory.as_path() { + re_add_keyvals = false; + new_overwritten.insert(directory.clone(), keyvals.clone()); + break; + } else { + working_dir = working_dir //Keep going up in the directory structure with .parent() + .ok_or_else(|| { + Error::new(ErrorKind::NotFound, "Root directory has no parent") + })? + .parent(); + } + } + if re_add_keyvals { + for (k, v) in keyvals { + keyvals_to_restore.insert( + k.clone(), + v.to_str() + .ok_or_else(|| { + Error::new( + ErrorKind::Other, + format!("{:?} is not valid unicode", v), + ) + })? + .to_string(), + ); + } + } + } + + self.overwritten_env_values = new_overwritten; + Ok(keyvals_to_restore) + } + + pub fn env_vars_to_add(&mut self) -> Result> { + let current_dir = std::env::current_dir()?; + + let mut vars_to_add = IndexMap::new(); + for dir in &self.allowed_directories { + let mut working_dir = Some(current_dir.as_path()); + + //Start in the current directory, then traverse towards the root with working_dir to see if we are in a subdirectory of a valid directory. + while let Some(wdir) = working_dir { + if wdir == dir.as_path() { + let toml_doc = std::fs::read_to_string(wdir.join(".nu").as_path())? + .parse::()?; + + let vars_in_current_file = toml_doc + .get("env") + .ok_or_else(|| { + std::io::Error::new( + std::io::ErrorKind::InvalidData, + "No [env] section in .nu-file", + ) + })? + .as_table() + .ok_or_else(|| { + Error::new( + ErrorKind::InvalidData, + "Malformed [env] section in .nu-file", + ) + })?; + + let mut keys_in_current_nufile = vec![]; + for (k, v) in vars_in_current_file { + vars_to_add.insert( + k.clone(), + v.as_str() + .ok_or_else(|| { + Error::new( + ErrorKind::InvalidData, + format!("Could not read environment variable: {}", v), + ) + })? + .to_string(), + ); //This is used to add variables to the environment + keys_in_current_nufile.push(k.clone()); //this is used to keep track of which directory added which variables + } + + //If we are about to overwrite any environment variables, we save them first so they can be restored later. + self.overwritten_env_values.insert( + wdir.to_path_buf(), + keys_in_current_nufile + .iter() + .filter_map(|key| { + if let Some(val) = std::env::var_os(key) { + return Some((key.clone(), val)); + } + None + }) + .collect(), + ); + + self.added_env_vars + .insert(wdir.to_path_buf(), keys_in_current_nufile); + break; + } else { + working_dir = working_dir //Keep going up in the directory structure with .parent() + .ok_or_else(|| { + Error::new(ErrorKind::NotFound, "Root directory has no parent") + })? + .parent(); + } + } + } + + Ok(vars_to_add) + } + + //If the user has left directories which added env vars through .nu, we clear those vars + pub fn env_vars_to_delete(&mut self) -> Result> { + let current_dir = std::env::current_dir()?; + + //Gather up all environment variables that should be deleted. + //If we are not in a directory or one of its subdirectories, mark the env_vals it maps to for removal. + let vars_to_delete = self.added_env_vars.iter().fold( + Vec::new(), + |mut vars_to_delete, (directory, env_vars)| { + let mut working_dir = Some(current_dir.as_path()); + + while let Some(wdir) = working_dir { + if wdir == directory { + return vars_to_delete; + } else { + working_dir = working_dir.expect("Root directory has no parent").parent(); + } + } + //only delete vars from directories we are not in + vars_to_delete.extend(env_vars.clone()); + vars_to_delete + }, + ); + + Ok(vars_to_delete) + } +} diff --git a/crates/nu-cli/src/env/environment.rs b/crates/nu-cli/src/env/environment.rs index 9b586eded2..41e3270a61 100644 --- a/crates/nu-cli/src/env/environment.rs +++ b/crates/nu-cli/src/env/environment.rs @@ -1,4 +1,5 @@ use crate::data::config::Conf; +use crate::env::directory_specific_environment::*; use indexmap::{indexmap, IndexSet}; use nu_protocol::{UntaggedValue, Value}; use std::ffi::OsString; @@ -8,7 +9,7 @@ pub trait Env: Debug + Send { fn env(&self) -> Option; fn path(&self) -> Option; - fn add_env(&mut self, key: &str, value: &str); + fn add_env(&mut self, key: &str, value: &str, overwrite_existing: bool); fn add_path(&mut self, new_path: OsString); } @@ -21,8 +22,8 @@ impl Env for Box { (**self).path() } - fn add_env(&mut self, key: &str, value: &str) { - (**self).add_env(key, value); + fn add_env(&mut self, key: &str, value: &str, overwrite_existing: bool) { + (**self).add_env(key, value, overwrite_existing); } fn add_path(&mut self, new_path: OsString) { @@ -34,6 +35,7 @@ impl Env for Box { pub struct Environment { environment_vars: Option, path_vars: Option, + pub direnv: DirectorySpecificEnvironment, } impl Environment { @@ -41,6 +43,7 @@ impl Environment { Environment { environment_vars: None, path_vars: None, + direnv: DirectorySpecificEnvironment::new(None), } } @@ -51,9 +54,38 @@ impl Environment { Environment { environment_vars: env, path_vars: path, + direnv: DirectorySpecificEnvironment::new(configuration.nu_env_dirs()), } } + pub fn maintain_directory_environment(&mut self) -> std::io::Result<()> { + self.direnv.env_vars_to_delete()?.iter().for_each(|k| { + self.remove_env(&k); + }); + self.direnv.env_vars_to_add()?.iter().for_each(|(k, v)| { + self.add_env(&k, &v, true); + }); + + self.direnv + .overwritten_values_to_restore()? + .iter() + .for_each(|(k, v)| { + self.add_env(&k, &v, true); + }); + + Ok(()) + } + + fn remove_env(&mut self, key: &str) { + if let Some(Value { + value: UntaggedValue::Row(ref mut envs), + tag: _, + }) = self.environment_vars + { + envs.entries.remove(key); + }; + } + pub fn morph(&mut self, configuration: &T) { self.environment_vars = configuration.env(); self.path_vars = configuration.path(); @@ -77,7 +109,7 @@ impl Env for Environment { None } - fn add_env(&mut self, key: &str, value: &str) { + fn add_env(&mut self, key: &str, value: &str, overwrite_existing: bool) { let value = UntaggedValue::string(value); let new_envs = { @@ -88,7 +120,7 @@ impl Env for Environment { { let mut new_envs = envs.clone(); - if !new_envs.contains_key(key) { + if !new_envs.contains_key(key) || overwrite_existing { new_envs.insert_data_at_key(key, value.into_value(tag.clone())); } @@ -206,7 +238,7 @@ mod tests { let fake_config = FakeConfig::new(&file); let mut actual = Environment::from_config(&fake_config); - actual.add_env("USER", "NUNO"); + actual.add_env("USER", "NUNO", false); assert_eq!( actual.env(), @@ -239,7 +271,7 @@ mod tests { let fake_config = FakeConfig::new(&file); let mut actual = Environment::from_config(&fake_config); - actual.add_env("SHELL", "/usr/bin/sh"); + actual.add_env("SHELL", "/usr/bin/sh", false); assert_eq!( actual.env(), diff --git a/crates/nu-cli/src/env/environment_syncer.rs b/crates/nu-cli/src/env/environment_syncer.rs index 852ccfa75c..fbcd72e6a6 100644 --- a/crates/nu-cli/src/env/environment_syncer.rs +++ b/crates/nu-cli/src/env/environment_syncer.rs @@ -49,7 +49,9 @@ impl EnvironmentSyncer { if name != "path" && name != "PATH" { // account for new env vars present in the current session // that aren't loaded from config. - environment.add_env(&name, &value); + environment.add_env(&name, &value, false); + + environment.maintain_directory_environment().ok(); // clear the env var from the session // we are about to replace them From 2fa83b0bbe214c43712d4ad0705b9486357887cb Mon Sep 17 00:00:00 2001 From: Michael Nitschinger Date: Mon, 8 Jun 2020 19:17:19 +0200 Subject: [PATCH 08/12] Pub expose InterruptibleStream and InputStream. (#1952) This allows crate users to make sure their long-running streams can be interrupted with ctrl-c. --- crates/nu-cli/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/nu-cli/src/lib.rs b/crates/nu-cli/src/lib.rs index e840095ca8..cd923e2c19 100644 --- a/crates/nu-cli/src/lib.rs +++ b/crates/nu-cli/src/lib.rs @@ -44,7 +44,7 @@ pub use crate::data::primitive; pub use crate::data::value; pub use crate::env::environment_syncer::EnvironmentSyncer; pub use crate::env::host::BasicHost; -pub use crate::stream::OutputStream; +pub use crate::stream::{InputStream, InterruptibleStream, OutputStream}; pub use nu_value_ext::ValueExt; pub use num_traits::cast::ToPrimitive; From 3bb2c9beedc1feff72b08ebb28467957c00c2f70 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Tue, 9 Jun 2020 15:54:20 +1200 Subject: [PATCH 09/12] Rename env file to .nu-env (#1953) --- crates/nu-cli/src/env/directory_specific_environment.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/nu-cli/src/env/directory_specific_environment.rs b/crates/nu-cli/src/env/directory_specific_environment.rs index ca201aed0f..27d7509cfe 100644 --- a/crates/nu-cli/src/env/directory_specific_environment.rs +++ b/crates/nu-cli/src/env/directory_specific_environment.rs @@ -101,7 +101,7 @@ impl DirectorySpecificEnvironment { //Start in the current directory, then traverse towards the root with working_dir to see if we are in a subdirectory of a valid directory. while let Some(wdir) = working_dir { if wdir == dir.as_path() { - let toml_doc = std::fs::read_to_string(wdir.join(".nu").as_path())? + let toml_doc = std::fs::read_to_string(wdir.join(".nu-env").as_path())? .parse::()?; let vars_in_current_file = toml_doc @@ -109,15 +109,12 @@ impl DirectorySpecificEnvironment { .ok_or_else(|| { std::io::Error::new( std::io::ErrorKind::InvalidData, - "No [env] section in .nu-file", + "No [env] section in .nu-env", ) })? .as_table() .ok_or_else(|| { - Error::new( - ErrorKind::InvalidData, - "Malformed [env] section in .nu-file", - ) + Error::new(ErrorKind::InvalidData, "Malformed [env] section in .nu-env") })?; let mut keys_in_current_nufile = vec![]; From 16ba2741702a98474861c17211ddd0ef8a1f8c98 Mon Sep 17 00:00:00 2001 From: svartalf Date: Tue, 9 Jun 2020 19:34:05 +0300 Subject: [PATCH 10/12] Bump heim dependency version. (#1954) Most important change is a fix for processes CPU usage calculation (see https://github.com/heim-rs/heim/issues/246) --- Cargo.lock | 16 ++++++++-------- crates/nu_plugin_ps/Cargo.toml | 2 +- crates/nu_plugin_sys/Cargo.toml | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 41dde0fecb..90aa35495d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1357,9 +1357,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "heim" -version = "0.1.0-beta.1" +version = "0.1.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c39a60e3aee8ada013ddfc5d8447d6f81011dac7ddef61a3f3d34b4be982aa79" +checksum = "ea9164f267a5f4325020b8a989c4b0ab06acc0685ccdb22551f59257fdf296ab" dependencies = [ "heim-common", "heim-cpu", @@ -1393,9 +1393,9 @@ dependencies = [ [[package]] name = "heim-cpu" -version = "0.1.0-beta.1" +version = "0.1.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020d170328cadc4d6adcf549c22983a19c35068414609c276c4db607ee295693" +checksum = "8b088c42ce30cf60b485df484e0aa19c31ad8663bb939180ef64ca340d15eca6" dependencies = [ "cfg-if", "futures 0.3.5", @@ -1462,9 +1462,9 @@ dependencies = [ [[package]] name = "heim-net" -version = "0.1.0-beta.1" +version = "0.1.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3108a5d01cfe88042c349c93d760d2cb8d82c2131183ba6af5fc5b8a6c0a5b5" +checksum = "59da1108e732afcda77e1429b5d0ce648b9a31d1f8cf385108b83bea4cf91342" dependencies = [ "bitflags", "cfg-if", @@ -1477,9 +1477,9 @@ dependencies = [ [[package]] name = "heim-process" -version = "0.1.1-beta.1" +version = "0.1.1-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac9b230a6f7c9d746c12a300186d6e8cb31495cdbe3cefd7a15f969327b0d323" +checksum = "190f1085293c8d54060dd77c943da0d5bd1729aa00d2ac68188e26446dc0170d" dependencies = [ "async-trait", "cfg-if", diff --git a/crates/nu_plugin_ps/Cargo.toml b/crates/nu_plugin_ps/Cargo.toml index 8dd370209f..33e2dc55a9 100644 --- a/crates/nu_plugin_ps/Cargo.toml +++ b/crates/nu_plugin_ps/Cargo.toml @@ -19,7 +19,7 @@ futures = { version = "0.3", features = ["compat", "io-compat"] } futures-timer = "3.0.2" [dependencies.heim] -version = "0.1.0-beta.1" +version = "0.1.0-beta.2" default-features = false features = ["process"] diff --git a/crates/nu_plugin_sys/Cargo.toml b/crates/nu_plugin_sys/Cargo.toml index ca53b7dd0f..c2a4d569b4 100644 --- a/crates/nu_plugin_sys/Cargo.toml +++ b/crates/nu_plugin_sys/Cargo.toml @@ -20,7 +20,7 @@ battery = "0.7.5" futures-util = "0.3.5" [dependencies.heim] -version = "0.1.0-beta.1" +version = "0.1.0-beta.2" default-features = false features = ["host", "cpu", "memory", "disk", "net", "sensors"] From e5a18eb3c24d2a26bc9707469192973f4b97102d Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Wed, 10 Jun 2020 05:33:59 +1200 Subject: [PATCH 11/12] Bump to 0.15.0 (#1955) --- Cargo.lock | 38 +++++++++++++------------- Cargo.toml | 38 +++++++++++++------------- crates/nu-build/Cargo.toml | 2 +- crates/nu-cli/Cargo.toml | 18 ++++++------ crates/nu-errors/Cargo.toml | 6 ++-- crates/nu-parser/Cargo.toml | 8 +++--- crates/nu-plugin/Cargo.toml | 12 ++++---- crates/nu-protocol/Cargo.toml | 8 +++--- crates/nu-source/Cargo.toml | 4 +-- crates/nu-test-support/Cargo.toml | 10 +++---- crates/nu-value-ext/Cargo.toml | 12 ++++---- crates/nu_plugin_binaryview/Cargo.toml | 12 ++++---- crates/nu_plugin_fetch/Cargo.toml | 12 ++++---- crates/nu_plugin_inc/Cargo.toml | 14 +++++----- crates/nu_plugin_match/Cargo.toml | 12 ++++---- crates/nu_plugin_post/Cargo.toml | 12 ++++---- crates/nu_plugin_ps/Cargo.toml | 12 ++++---- crates/nu_plugin_start/Cargo.toml | 14 +++++----- crates/nu_plugin_sys/Cargo.toml | 12 ++++---- crates/nu_plugin_textview/Cargo.toml | 12 ++++---- crates/nu_plugin_tree/Cargo.toml | 12 ++++---- docs/commands/to-toml.md | 2 +- 22 files changed, 141 insertions(+), 141 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 90aa35495d..579a31fef4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2175,7 +2175,7 @@ dependencies = [ [[package]] name = "nu" -version = "0.14.1" +version = "0.15.0" dependencies = [ "clap", "crossterm", @@ -2212,7 +2212,7 @@ dependencies = [ [[package]] name = "nu-build" -version = "0.14.1" +version = "0.15.0" dependencies = [ "lazy_static 1.4.0", "serde 1.0.110", @@ -2222,7 +2222,7 @@ dependencies = [ [[package]] name = "nu-cli" -version = "0.14.1" +version = "0.15.0" dependencies = [ "ansi_term 0.12.1", "app_dirs", @@ -2313,7 +2313,7 @@ dependencies = [ [[package]] name = "nu-errors" -version = "0.14.1" +version = "0.15.0" dependencies = [ "ansi_term 0.12.1", "bigdecimal", @@ -2333,7 +2333,7 @@ dependencies = [ [[package]] name = "nu-parser" -version = "0.14.1" +version = "0.15.0" dependencies = [ "bigdecimal", "codespan-reporting", @@ -2352,7 +2352,7 @@ dependencies = [ [[package]] name = "nu-plugin" -version = "0.14.1" +version = "0.15.0" dependencies = [ "bigdecimal", "indexmap", @@ -2368,7 +2368,7 @@ dependencies = [ [[package]] name = "nu-protocol" -version = "0.14.1" +version = "0.15.0" dependencies = [ "ansi_term 0.12.1", "bigdecimal", @@ -2397,7 +2397,7 @@ dependencies = [ [[package]] name = "nu-source" -version = "0.14.1" +version = "0.15.0" dependencies = [ "codespan-reporting", "derive-new", @@ -2410,7 +2410,7 @@ dependencies = [ [[package]] name = "nu-test-support" -version = "0.14.1" +version = "0.15.0" dependencies = [ "directories 2.0.2", "dunce", @@ -2426,7 +2426,7 @@ dependencies = [ [[package]] name = "nu-value-ext" -version = "0.14.1" +version = "0.15.0" dependencies = [ "indexmap", "itertools", @@ -2440,7 +2440,7 @@ dependencies = [ [[package]] name = "nu_plugin_binaryview" -version = "0.14.1" +version = "0.15.0" dependencies = [ "ansi_term 0.12.1", "crossterm", @@ -2457,7 +2457,7 @@ dependencies = [ [[package]] name = "nu_plugin_fetch" -version = "0.14.1" +version = "0.15.0" dependencies = [ "base64 0.12.1", "futures 0.3.5", @@ -2472,7 +2472,7 @@ dependencies = [ [[package]] name = "nu_plugin_inc" -version = "0.14.1" +version = "0.15.0" dependencies = [ "nu-build", "nu-errors", @@ -2485,7 +2485,7 @@ dependencies = [ [[package]] name = "nu_plugin_match" -version = "0.14.1" +version = "0.15.0" dependencies = [ "futures 0.3.5", "nu-build", @@ -2498,7 +2498,7 @@ dependencies = [ [[package]] name = "nu_plugin_post" -version = "0.14.1" +version = "0.15.0" dependencies = [ "base64 0.12.1", "futures 0.3.5", @@ -2515,7 +2515,7 @@ dependencies = [ [[package]] name = "nu_plugin_ps" -version = "0.14.1" +version = "0.15.0" dependencies = [ "futures 0.3.5", "futures-timer 3.0.2", @@ -2543,7 +2543,7 @@ dependencies = [ [[package]] name = "nu_plugin_sys" -version = "0.14.1" +version = "0.15.0" dependencies = [ "battery", "futures 0.3.5", @@ -2558,7 +2558,7 @@ dependencies = [ [[package]] name = "nu_plugin_textview" -version = "0.14.1" +version = "0.15.0" dependencies = [ "ansi_term 0.12.1", "crossterm", @@ -2573,7 +2573,7 @@ dependencies = [ [[package]] name = "nu_plugin_tree" -version = "0.14.1" +version = "0.15.0" dependencies = [ "derive-new", "nu-build", diff --git a/Cargo.toml b/Cargo.toml index 6a273e027f..ff63dfbd5e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu" -version = "0.14.1" +version = "0.15.0" authors = ["The Nu Project Contributors"] description = "A new type of shell" license = "MIT" @@ -18,23 +18,23 @@ members = ["crates/*/"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -nu-cli = { version = "0.14.1", path = "./crates/nu-cli" } -nu-source = { version = "0.14.1", path = "./crates/nu-source" } -nu-plugin = { version = "0.14.1", path = "./crates/nu-plugin" } -nu-protocol = { version = "0.14.1", path = "./crates/nu-protocol" } -nu-errors = { version = "0.14.1", path = "./crates/nu-errors" } -nu-parser = { version = "0.14.1", path = "./crates/nu-parser" } -nu-value-ext = { version = "0.14.1", path = "./crates/nu-value-ext" } -nu_plugin_binaryview = { version = "0.14.1", path = "./crates/nu_plugin_binaryview", optional=true } -nu_plugin_fetch = { version = "0.14.1", path = "./crates/nu_plugin_fetch", optional=true } -nu_plugin_inc = { version = "0.14.1", path = "./crates/nu_plugin_inc", optional=true } -nu_plugin_match = { version = "0.14.1", path = "./crates/nu_plugin_match", optional=true } -nu_plugin_post = { version = "0.14.1", path = "./crates/nu_plugin_post", optional=true } -nu_plugin_ps = { version = "0.14.1", path = "./crates/nu_plugin_ps", optional=true } +nu-cli = { version = "0.15.0", path = "./crates/nu-cli" } +nu-source = { version = "0.15.0", path = "./crates/nu-source" } +nu-plugin = { version = "0.15.0", path = "./crates/nu-plugin" } +nu-protocol = { version = "0.15.0", path = "./crates/nu-protocol" } +nu-errors = { version = "0.15.0", path = "./crates/nu-errors" } +nu-parser = { version = "0.15.0", path = "./crates/nu-parser" } +nu-value-ext = { version = "0.15.0", path = "./crates/nu-value-ext" } +nu_plugin_binaryview = { version = "0.15.0", path = "./crates/nu_plugin_binaryview", optional=true } +nu_plugin_fetch = { version = "0.15.0", path = "./crates/nu_plugin_fetch", optional=true } +nu_plugin_inc = { version = "0.15.0", path = "./crates/nu_plugin_inc", optional=true } +nu_plugin_match = { version = "0.15.0", path = "./crates/nu_plugin_match", optional=true } +nu_plugin_post = { version = "0.15.0", path = "./crates/nu_plugin_post", optional=true } +nu_plugin_ps = { version = "0.15.0", path = "./crates/nu_plugin_ps", optional=true } nu_plugin_start = { version = "0.1.0", path = "./crates/nu_plugin_start", optional=true } -nu_plugin_sys = { version = "0.14.1", path = "./crates/nu_plugin_sys", optional=true } -nu_plugin_textview = { version = "0.14.1", path = "./crates/nu_plugin_textview", optional=true } -nu_plugin_tree = { version = "0.14.1", path = "./crates/nu_plugin_tree", optional=true } +nu_plugin_sys = { version = "0.15.0", path = "./crates/nu_plugin_sys", optional=true } +nu_plugin_textview = { version = "0.15.0", path = "./crates/nu_plugin_textview", optional=true } +nu_plugin_tree = { version = "0.15.0", path = "./crates/nu_plugin_tree", optional=true } crossterm = { version = "0.17.5", optional = true } semver = { version = "0.10.0", optional = true } @@ -49,12 +49,12 @@ log = "0.4.8" pretty_env_logger = "0.4.0" [dev-dependencies] -nu-test-support = { version = "0.14.1", path = "./crates/nu-test-support" } +nu-test-support = { version = "0.15.0", path = "./crates/nu-test-support" } [build-dependencies] toml = "0.5.6" serde = { version = "1.0.110", features = ["derive"] } -nu-build = { version = "0.14.1", path = "./crates/nu-build" } +nu-build = { version = "0.15.0", path = "./crates/nu-build" } [features] default = ["sys", "ps", "textview", "inc"] diff --git a/crates/nu-build/Cargo.toml b/crates/nu-build/Cargo.toml index e9f15cc1d1..6bb0963f27 100644 --- a/crates/nu-build/Cargo.toml +++ b/crates/nu-build/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu-build" -version = "0.14.1" +version = "0.15.0" authors = ["The Nu Project Contributors"] edition = "2018" description = "Core build system for nushell" diff --git a/crates/nu-cli/Cargo.toml b/crates/nu-cli/Cargo.toml index 2156eb1581..18652b40f7 100644 --- a/crates/nu-cli/Cargo.toml +++ b/crates/nu-cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu-cli" -version = "0.14.1" +version = "0.15.0" authors = ["The Nu Project Contributors"] description = "CLI for nushell" edition = "2018" @@ -10,13 +10,13 @@ license = "MIT" doctest = false [dependencies] -nu-source = { version = "0.14.1", path = "../nu-source" } -nu-plugin = { version = "0.14.1", path = "../nu-plugin" } -nu-protocol = { version = "0.14.1", path = "../nu-protocol" } -nu-errors = { version = "0.14.1", path = "../nu-errors" } -nu-parser = { version = "0.14.1", path = "../nu-parser" } -nu-value-ext = { version = "0.14.1", path = "../nu-value-ext" } -nu-test-support = { version = "0.14.1", path = "../nu-test-support" } +nu-source = { version = "0.15.0", path = "../nu-source" } +nu-plugin = { version = "0.15.0", path = "../nu-plugin" } +nu-protocol = { version = "0.15.0", path = "../nu-protocol" } +nu-errors = { version = "0.15.0", path = "../nu-errors" } +nu-parser = { version = "0.15.0", path = "../nu-parser" } +nu-value-ext = { version = "0.15.0", path = "../nu-value-ext" } +nu-test-support = { version = "0.15.0", path = "../nu-test-support" } ansi_term = "0.12.1" app_dirs = "1.2.1" @@ -101,7 +101,7 @@ version = "0.23.1" features = ["bundled", "blob"] [build-dependencies] -nu-build = { version = "0.14.1", path = "../nu-build" } +nu-build = { version = "0.15.0", path = "../nu-build" } [dev-dependencies] quickcheck = "0.9" diff --git a/crates/nu-errors/Cargo.toml b/crates/nu-errors/Cargo.toml index 9701cbe681..88881c3215 100644 --- a/crates/nu-errors/Cargo.toml +++ b/crates/nu-errors/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu-errors" -version = "0.14.1" +version = "0.15.0" authors = ["The Nu Project Contributors"] edition = "2018" description = "Core error subsystem for Nushell" @@ -10,7 +10,7 @@ license = "MIT" doctest = false [dependencies] -nu-source = { path = "../nu-source", version = "0.14.1" } +nu-source = { path = "../nu-source", version = "0.15.0" } ansi_term = "0.12.1" bigdecimal = { version = "0.1.2", features = ["serde"] } @@ -28,4 +28,4 @@ serde_json = "1.0.53" glob = "0.3.0" [build-dependencies] -nu-build = { version = "0.14.1", path = "../nu-build" } +nu-build = { version = "0.15.0", path = "../nu-build" } diff --git a/crates/nu-parser/Cargo.toml b/crates/nu-parser/Cargo.toml index f983372dd2..144b759a8a 100644 --- a/crates/nu-parser/Cargo.toml +++ b/crates/nu-parser/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu-parser" -version = "0.14.1" +version = "0.15.0" authors = ["The Nu Project Contributors"] edition = "2018" description = "Nushell parser" @@ -20,9 +20,9 @@ codespan-reporting = "0.9.4" log = "0.4.8" shellexpand = "2.0.0" -nu-source = { version = "0.14.1", path = "../nu-source" } -nu-protocol = { version = "0.14.1", path = "../nu-protocol" } -nu-errors = { version = "0.14.1", path = "../nu-errors" } +nu-source = { version = "0.15.0", path = "../nu-source" } +nu-protocol = { version = "0.15.0", path = "../nu-protocol" } +nu-errors = { version = "0.15.0", path = "../nu-errors" } [features] stable = [] diff --git a/crates/nu-plugin/Cargo.toml b/crates/nu-plugin/Cargo.toml index 1a134b6c15..91228ddcda 100644 --- a/crates/nu-plugin/Cargo.toml +++ b/crates/nu-plugin/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu-plugin" -version = "0.14.1" +version = "0.15.0" authors = ["The Nu Project Contributors"] edition = "2018" description = "Nushell Plugin" @@ -10,10 +10,10 @@ license = "MIT" doctest = false [dependencies] -nu-protocol = { path = "../nu-protocol", version = "0.14.1" } -nu-source = { path = "../nu-source", version = "0.14.1" } -nu-errors = { path = "../nu-errors", version = "0.14.1" } -nu-value-ext = { path = "../nu-value-ext", version = "0.14.1" } +nu-protocol = { path = "../nu-protocol", version = "0.15.0" } +nu-source = { path = "../nu-source", version = "0.15.0" } +nu-errors = { path = "../nu-errors", version = "0.15.0" } +nu-value-ext = { path = "../nu-value-ext", version = "0.15.0" } indexmap = { version = "1.3.2", features = ["serde-1"] } serde = { version = "1.0.110", features = ["derive"] } @@ -22,4 +22,4 @@ serde_json = "1.0.53" bigdecimal = { version = "0.1.2", features = ["serde"] } [build-dependencies] -nu-build = { version = "0.14.1", path = "../nu-build" } +nu-build = { version = "0.15.0", path = "../nu-build" } diff --git a/crates/nu-protocol/Cargo.toml b/crates/nu-protocol/Cargo.toml index 30dae97404..e145d2ad0e 100644 --- a/crates/nu-protocol/Cargo.toml +++ b/crates/nu-protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu-protocol" -version = "0.14.1" +version = "0.15.0" authors = ["The Nu Project Contributors"] edition = "2018" description = "Core values and protocols for Nushell" @@ -10,8 +10,8 @@ license = "MIT" doctest = false [dependencies] -nu-source = { path = "../nu-source", version = "0.14.1" } -nu-errors = { path = "../nu-errors", version = "0.14.1" } +nu-source = { path = "../nu-source", version = "0.15.0" } +nu-errors = { path = "../nu-errors", version = "0.15.0" } serde = { version = "1.0.110", features = ["derive"] } indexmap = { version = "1.3.2", features = ["serde-1"] } @@ -37,4 +37,4 @@ toml = "0.5.6" serde_json = "1.0.53" [build-dependencies] -nu-build = { version = "0.14.1", path = "../nu-build" } +nu-build = { version = "0.15.0", path = "../nu-build" } diff --git a/crates/nu-source/Cargo.toml b/crates/nu-source/Cargo.toml index fde1479939..6083cb799d 100644 --- a/crates/nu-source/Cargo.toml +++ b/crates/nu-source/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu-source" -version = "0.14.1" +version = "0.15.0" authors = ["The Nu Project Contributors"] edition = "2018" description = "A source string characterizer for Nushell" @@ -18,4 +18,4 @@ termcolor = "1.1.0" pretty = "0.5.2" [build-dependencies] -nu-build = { version = "0.14.1", path = "../nu-build" } +nu-build = { version = "0.15.0", path = "../nu-build" } diff --git a/crates/nu-test-support/Cargo.toml b/crates/nu-test-support/Cargo.toml index bc572931bd..0525e2cdd0 100644 --- a/crates/nu-test-support/Cargo.toml +++ b/crates/nu-test-support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu-test-support" -version = "0.14.1" +version = "0.15.0" authors = ["The Nu Project Contributors"] edition = "2018" description = "A source string characterizer for Nushell" @@ -10,9 +10,9 @@ license = "MIT" doctest = false [dependencies] -nu-parser = { path = "../nu-parser", version = "0.14.1" } -nu-source = { path = "../nu-source", version = "0.14.1" } -nu-protocol = { path = "../nu-protocol", version = "0.14.1" } +nu-parser = { path = "../nu-parser", version = "0.15.0" } +nu-source = { path = "../nu-source", version = "0.15.0" } +nu-protocol = { path = "../nu-protocol", version = "0.15.0" } directories = "2.0.2" dunce = "1.0.0" @@ -22,4 +22,4 @@ tempfile = "3.1.0" indexmap = { version = "1.3.2", features = ["serde-1"] } [build-dependencies] -nu-build = { version = "0.14.1", path = "../nu-build" } +nu-build = { version = "0.15.0", path = "../nu-build" } diff --git a/crates/nu-value-ext/Cargo.toml b/crates/nu-value-ext/Cargo.toml index 429f6772d9..5a8655fc2f 100644 --- a/crates/nu-value-ext/Cargo.toml +++ b/crates/nu-value-ext/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu-value-ext" -version = "0.14.1" +version = "0.15.0" authors = ["The Nu Project Contributors"] edition = "2018" description = "Extension traits for values in Nushell" @@ -10,14 +10,14 @@ license = "MIT" doctest = false [dependencies] -nu-source = { path = "../nu-source", version = "0.14.1" } -nu-errors = { path = "../nu-errors", version = "0.14.1" } -nu-parser = { path = "../nu-parser", version = "0.14.1" } -nu-protocol = { path = "../nu-protocol", version = "0.14.1" } +nu-source = { path = "../nu-source", version = "0.15.0" } +nu-errors = { path = "../nu-errors", version = "0.15.0" } +nu-parser = { path = "../nu-parser", version = "0.15.0" } +nu-protocol = { path = "../nu-protocol", version = "0.15.0" } num-traits = "0.2.11" itertools = "0.9.0" indexmap = { version = "1.3.2", features = ["serde-1"] } [build-dependencies] -nu-build = { version = "0.14.1", path = "../nu-build" } +nu-build = { version = "0.15.0", path = "../nu-build" } diff --git a/crates/nu_plugin_binaryview/Cargo.toml b/crates/nu_plugin_binaryview/Cargo.toml index 4d1eb39892..69166178e4 100644 --- a/crates/nu_plugin_binaryview/Cargo.toml +++ b/crates/nu_plugin_binaryview/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu_plugin_binaryview" -version = "0.14.1" +version = "0.15.0" authors = ["The Nu Project Contributors"] edition = "2018" description = "A binary viewer plugin for Nushell" @@ -12,14 +12,14 @@ doctest = false [dependencies] ansi_term = "0.12.1" crossterm = { version = "0.17.5" } -nu-plugin = { path = "../nu-plugin", version = "0.14.1" } -nu-protocol = { path = "../nu-protocol", version = "0.14.1" } -nu-source = { path = "../nu-source", version = "0.14.1" } -nu-errors = { path = "../nu-errors", version = "0.14.1" } +nu-plugin = { path = "../nu-plugin", version = "0.15.0" } +nu-protocol = { path = "../nu-protocol", version = "0.15.0" } +nu-source = { path = "../nu-source", version = "0.15.0" } +nu-errors = { path = "../nu-errors", version = "0.15.0" } pretty-hex = "0.1.1" image = { version = "0.22.4", default_features = false, features = ["png_codec", "jpeg"] } rawkey = "0.1.2" neso = "0.5.0" [build-dependencies] -nu-build = { version = "0.14.1", path = "../nu-build" } +nu-build = { version = "0.15.0", path = "../nu-build" } diff --git a/crates/nu_plugin_fetch/Cargo.toml b/crates/nu_plugin_fetch/Cargo.toml index 0ed9d6ecdb..add0713506 100644 --- a/crates/nu_plugin_fetch/Cargo.toml +++ b/crates/nu_plugin_fetch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu_plugin_fetch" -version = "0.14.1" +version = "0.15.0" authors = ["The Nu Project Contributors"] edition = "2018" description = "A URL fetch plugin for Nushell" @@ -10,14 +10,14 @@ license = "MIT" doctest = false [dependencies] -nu-plugin = { path = "../nu-plugin", version = "0.14.1" } -nu-protocol = { path = "../nu-protocol", version = "0.14.1" } -nu-source = { path = "../nu-source", version = "0.14.1" } -nu-errors = { path = "../nu-errors", version = "0.14.1" } +nu-plugin = { path = "../nu-plugin", version = "0.15.0" } +nu-protocol = { path = "../nu-protocol", version = "0.15.0" } +nu-source = { path = "../nu-source", version = "0.15.0" } +nu-errors = { path = "../nu-errors", version = "0.15.0" } futures = { version = "0.3", features = ["compat", "io-compat"] } surf = "1.0.3" url = "2.1.1" base64 = "0.12.1" [build-dependencies] -nu-build = { version = "0.14.1", path = "../nu-build" } +nu-build = { version = "0.15.0", path = "../nu-build" } diff --git a/crates/nu_plugin_inc/Cargo.toml b/crates/nu_plugin_inc/Cargo.toml index c83b6afc2f..21d37bd9d1 100644 --- a/crates/nu_plugin_inc/Cargo.toml +++ b/crates/nu_plugin_inc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu_plugin_inc" -version = "0.14.1" +version = "0.15.0" authors = ["The Nu Project Contributors"] edition = "2018" description = "A version incrementer plugin for Nushell" @@ -10,13 +10,13 @@ license = "MIT" doctest = false [dependencies] -nu-plugin = { path = "../nu-plugin", version = "0.14.1" } -nu-protocol = { path = "../nu-protocol", version = "0.14.1" } -nu-source = { path = "../nu-source", version = "0.14.1" } -nu-errors = { path = "../nu-errors", version = "0.14.1" } -nu-value-ext = { path = "../nu-value-ext", version = "0.14.1" } +nu-plugin = { path = "../nu-plugin", version = "0.15.0" } +nu-protocol = { path = "../nu-protocol", version = "0.15.0" } +nu-source = { path = "../nu-source", version = "0.15.0" } +nu-errors = { path = "../nu-errors", version = "0.15.0" } +nu-value-ext = { path = "../nu-value-ext", version = "0.15.0" } semver = "0.10.0" [build-dependencies] -nu-build = { version = "0.14.1", path = "../nu-build" } +nu-build = { version = "0.15.0", path = "../nu-build" } diff --git a/crates/nu_plugin_match/Cargo.toml b/crates/nu_plugin_match/Cargo.toml index 91de975553..6b26204efa 100644 --- a/crates/nu_plugin_match/Cargo.toml +++ b/crates/nu_plugin_match/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu_plugin_match" -version = "0.14.1" +version = "0.15.0" authors = ["The Nu Project Contributors"] edition = "2018" description = "A regex match plugin for Nushell" @@ -10,12 +10,12 @@ license = "MIT" doctest = false [dependencies] -nu-plugin = { path = "../nu-plugin", version = "0.14.1" } -nu-protocol = { path = "../nu-protocol", version = "0.14.1" } -nu-source = { path = "../nu-source", version = "0.14.1" } -nu-errors = { path = "../nu-errors", version = "0.14.1" } +nu-plugin = { path = "../nu-plugin", version = "0.15.0" } +nu-protocol = { path = "../nu-protocol", version = "0.15.0" } +nu-source = { path = "../nu-source", version = "0.15.0" } +nu-errors = { path = "../nu-errors", version = "0.15.0" } futures = { version = "0.3", features = ["compat", "io-compat"] } regex = "1" [build-dependencies] -nu-build = { version = "0.14.1", path = "../nu-build" } +nu-build = { version = "0.15.0", path = "../nu-build" } diff --git a/crates/nu_plugin_post/Cargo.toml b/crates/nu_plugin_post/Cargo.toml index dc014da1d5..4f2897a321 100644 --- a/crates/nu_plugin_post/Cargo.toml +++ b/crates/nu_plugin_post/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu_plugin_post" -version = "0.14.1" +version = "0.15.0" authors = ["The Nu Project Contributors"] edition = "2018" description = "An HTTP post plugin for Nushell" @@ -10,10 +10,10 @@ license = "MIT" doctest = false [dependencies] -nu-plugin = { path = "../nu-plugin", version = "0.14.1" } -nu-protocol = { path = "../nu-protocol", version = "0.14.1" } -nu-source = { path = "../nu-source", version = "0.14.1" } -nu-errors = { path = "../nu-errors", version = "0.14.1" } +nu-plugin = { path = "../nu-plugin", version = "0.15.0" } +nu-protocol = { path = "../nu-protocol", version = "0.15.0" } +nu-source = { path = "../nu-source", version = "0.15.0" } +nu-errors = { path = "../nu-errors", version = "0.15.0" } futures = { version = "0.3", features = ["compat", "io-compat"] } surf = "1.0.3" url = "2.1.1" @@ -22,4 +22,4 @@ base64 = "0.12.1" num-traits = "0.2.11" [build-dependencies] -nu-build = { version = "0.14.1", path = "../nu-build" } +nu-build = { version = "0.15.0", path = "../nu-build" } diff --git a/crates/nu_plugin_ps/Cargo.toml b/crates/nu_plugin_ps/Cargo.toml index 33e2dc55a9..33c560ebec 100644 --- a/crates/nu_plugin_ps/Cargo.toml +++ b/crates/nu_plugin_ps/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu_plugin_ps" -version = "0.14.1" +version = "0.15.0" authors = ["The Nu Project Contributors"] edition = "2018" description = "A process list plugin for Nushell" @@ -10,10 +10,10 @@ license = "MIT" doctest = false [dependencies] -nu-plugin = { path = "../nu-plugin", version = "0.14.1" } -nu-protocol = { path = "../nu-protocol", version = "0.14.1" } -nu-source = { path = "../nu-source", version = "0.14.1" } -nu-errors = { path = "../nu-errors", version = "0.14.1" } +nu-plugin = { path = "../nu-plugin", version = "0.15.0" } +nu-protocol = { path = "../nu-protocol", version = "0.15.0" } +nu-source = { path = "../nu-source", version = "0.15.0" } +nu-errors = { path = "../nu-errors", version = "0.15.0" } futures = { version = "0.3", features = ["compat", "io-compat"] } futures-timer = "3.0.2" @@ -24,4 +24,4 @@ default-features = false features = ["process"] [build-dependencies] -nu-build = { version = "0.14.1", path = "../nu-build" } +nu-build = { version = "0.15.0", path = "../nu-build" } diff --git a/crates/nu_plugin_start/Cargo.toml b/crates/nu_plugin_start/Cargo.toml index 1e7eaa8694..3e8b30119d 100644 --- a/crates/nu_plugin_start/Cargo.toml +++ b/crates/nu_plugin_start/Cargo.toml @@ -10,15 +10,15 @@ license = "MIT" doctest = false [dependencies] -nu-plugin = { path = "../nu-plugin", version = "0.14.1" } -nu-protocol = { path = "../nu-protocol", version = "0.14.1" } -nu-source = { path = "../nu-source", version = "0.14.1" } -nu-errors = { path = "../nu-errors", version = "0.14.1" } +nu-plugin = { path = "../nu-plugin", version = "0.15.0" } +nu-protocol = { path = "../nu-protocol", version = "0.15.0" } +nu-source = { path = "../nu-source", version = "0.15.0" } +nu-errors = { path = "../nu-errors", version = "0.15.0" } url = "2.1.1" open = "1.4.0" glob = "0.3.0" [build-dependencies] -nu-build = { version = "0.14.1", path = "../nu-build" } -nu-errors = { version = "0.14.1", path = "../nu-errors" } -nu-source = { version = "0.14.1", path = "../nu-source" } \ No newline at end of file +nu-build = { version = "0.15.0", path = "../nu-build" } +nu-errors = { version = "0.15.0", path = "../nu-errors" } +nu-source = { version = "0.15.0", path = "../nu-source" } \ No newline at end of file diff --git a/crates/nu_plugin_sys/Cargo.toml b/crates/nu_plugin_sys/Cargo.toml index c2a4d569b4..60812363c6 100644 --- a/crates/nu_plugin_sys/Cargo.toml +++ b/crates/nu_plugin_sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu_plugin_sys" -version = "0.14.1" +version = "0.15.0" authors = ["The Nu Project Contributors"] edition = "2018" description = "A system info plugin for Nushell" @@ -10,10 +10,10 @@ license = "MIT" doctest = false [dependencies] -nu-plugin = { path = "../nu-plugin", version = "0.14.1" } -nu-protocol = { path = "../nu-protocol", version = "0.14.1" } -nu-source = { path = "../nu-source", version = "0.14.1" } -nu-errors = { path = "../nu-errors", version = "0.14.1" } +nu-plugin = { path = "../nu-plugin", version = "0.15.0" } +nu-protocol = { path = "../nu-protocol", version = "0.15.0" } +nu-source = { path = "../nu-source", version = "0.15.0" } +nu-errors = { path = "../nu-errors", version = "0.15.0" } futures = { version = "0.3", features = ["compat", "io-compat"] } battery = "0.7.5" @@ -26,4 +26,4 @@ default-features = false features = ["host", "cpu", "memory", "disk", "net", "sensors"] [build-dependencies] -nu-build = { version = "0.14.1", path = "../nu-build" } +nu-build = { version = "0.15.0", path = "../nu-build" } diff --git a/crates/nu_plugin_textview/Cargo.toml b/crates/nu_plugin_textview/Cargo.toml index 0b56bac878..5284b994ad 100644 --- a/crates/nu_plugin_textview/Cargo.toml +++ b/crates/nu_plugin_textview/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu_plugin_textview" -version = "0.14.1" +version = "0.15.0" authors = ["The Nu Project Contributors"] edition = "2018" description = "Text viewer plugin for Nushell" @@ -10,10 +10,10 @@ license = "MIT" doctest = false [dependencies] -nu-plugin = { path = "../nu-plugin", version = "0.14.1" } -nu-protocol = { path = "../nu-protocol", version = "0.14.1" } -nu-source = { path = "../nu-source", version = "0.14.1" } -nu-errors = { path = "../nu-errors", version = "0.14.1" } +nu-plugin = { path = "../nu-plugin", version = "0.15.0" } +nu-protocol = { path = "../nu-protocol", version = "0.15.0" } +nu-source = { path = "../nu-source", version = "0.15.0" } +nu-errors = { path = "../nu-errors", version = "0.15.0" } crossterm = "0.17.5" syntect = { version = "4.2", default-features = false, features = ["default-fancy"]} @@ -21,4 +21,4 @@ ansi_term = "0.12.1" url = "2.1.1" [build-dependencies] -nu-build = { version = "0.14.1", path = "../nu-build" } +nu-build = { version = "0.15.0", path = "../nu-build" } diff --git a/crates/nu_plugin_tree/Cargo.toml b/crates/nu_plugin_tree/Cargo.toml index db2669959a..00beda0973 100644 --- a/crates/nu_plugin_tree/Cargo.toml +++ b/crates/nu_plugin_tree/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu_plugin_tree" -version = "0.14.1" +version = "0.15.0" authors = ["The Nu Project Contributors"] edition = "2018" description = "Tree viewer plugin for Nushell" @@ -10,12 +10,12 @@ license = "MIT" doctest = false [dependencies] -nu-plugin = { path = "../nu-plugin", version = "0.14.1" } -nu-protocol = { path = "../nu-protocol", version = "0.14.1" } -nu-source = { path = "../nu-source", version = "0.14.1" } -nu-errors = { path = "../nu-errors", version = "0.14.1" } +nu-plugin = { path = "../nu-plugin", version = "0.15.0" } +nu-protocol = { path = "../nu-protocol", version = "0.15.0" } +nu-source = { path = "../nu-source", version = "0.15.0" } +nu-errors = { path = "../nu-errors", version = "0.15.0" } ptree = {version = "0.2" } derive-new = "0.5.8" [build-dependencies] -nu-build = { version = "0.14.1", path = "../nu-build" } +nu-build = { version = "0.15.0", path = "../nu-build" } diff --git a/docs/commands/to-toml.md b/docs/commands/to-toml.md index 85c4873e69..d61e1be445 100644 --- a/docs/commands/to-toml.md +++ b/docs/commands/to-toml.md @@ -83,7 +83,7 @@ version = "0.4.6" [dependencies.cursive] default-features = false features = ["pancurses-backend"] -version = "0.14.1" +version = "0.15.0" [dependencies.futures-preview] features = ["compat", "io-compat"] From a3e1a3f2662262734a6cbfee043ecdafcef2a421 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Tue, 9 Jun 2020 13:39:15 -0700 Subject: [PATCH 12/12] Bump start plugin to 0.15.0 (#1956) --- Cargo.lock | 2 +- Cargo.toml | 2 +- crates/nu_plugin_start/Cargo.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 579a31fef4..1c29147fef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2529,7 +2529,7 @@ dependencies = [ [[package]] name = "nu_plugin_start" -version = "0.1.0" +version = "0.15.0" dependencies = [ "glob", "nu-build", diff --git a/Cargo.toml b/Cargo.toml index ff63dfbd5e..75a4b99ddc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ nu_plugin_inc = { version = "0.15.0", path = "./crates/nu_plugin_inc", optional= nu_plugin_match = { version = "0.15.0", path = "./crates/nu_plugin_match", optional=true } nu_plugin_post = { version = "0.15.0", path = "./crates/nu_plugin_post", optional=true } nu_plugin_ps = { version = "0.15.0", path = "./crates/nu_plugin_ps", optional=true } -nu_plugin_start = { version = "0.1.0", path = "./crates/nu_plugin_start", optional=true } +nu_plugin_start = { version = "0.15.0", path = "./crates/nu_plugin_start", optional=true } nu_plugin_sys = { version = "0.15.0", path = "./crates/nu_plugin_sys", optional=true } nu_plugin_textview = { version = "0.15.0", path = "./crates/nu_plugin_textview", optional=true } nu_plugin_tree = { version = "0.15.0", path = "./crates/nu_plugin_tree", optional=true } diff --git a/crates/nu_plugin_start/Cargo.toml b/crates/nu_plugin_start/Cargo.toml index 3e8b30119d..269e610d9d 100644 --- a/crates/nu_plugin_start/Cargo.toml +++ b/crates/nu_plugin_start/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nu_plugin_start" -version = "0.1.0" +version = "0.15.0" authors = ["The Nu Project Contributors"] edition = "2018" description = "A plugin to open files/URLs directly from Nushell"