Update to latest nu version

main
trivernis 3 months ago
parent 95afc8c8e1
commit 5656207624
Signed by: Trivernis
GPG Key ID: 7E6D18B61C8D2F4B

@ -1,6 +1,6 @@
[package] [package]
name = "embed-nu" name = "embed-nu"
version = "0.8.0" version = "0.9.0"
edition = "2021" edition = "2021"
license = "Apache-2.0" license = "Apache-2.0"
repository = "https://github.com/Trivernis/embed-nu" repository = "https://github.com/Trivernis/embed-nu"
@ -10,12 +10,12 @@ authors = ["trivernis <trivernis@proton.me>"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
miette = "5.9.0" miette = "7.1.0"
nu-cmd-lang = "0.80.0" nu-cmd-lang = "0.90.1"
nu-command = "0.80.0" nu-command = "0.90.1"
nu-engine = "0.80.0" nu-engine = "0.90.1"
nu-parser = "0.80.0" nu-parser = "0.90.1"
nu-protocol = "0.80.0" nu-protocol = "0.90.1"
paste = "1.0.12" paste = "1.0.14"
rusty-value = { version = "0.6.0", features = ["derive"] } rusty-value = { version = "0.6.0", features = ["derive"] }
thiserror = "1.0.40" thiserror = "1.0.57"

@ -22,7 +22,6 @@ pub fn bind_core_commands(engine_state: &mut EngineState) -> CrateResult<()> {
Const, Const,
Continue, Continue,
Def, Def,
DefEnv,
Describe, Describe,
Do, Do,
Echo, Echo,
@ -30,7 +29,6 @@ pub fn bind_core_commands(engine_state: &mut EngineState) -> CrateResult<()> {
ExportAlias, ExportAlias,
ExportCommand, ExportCommand,
ExportDef, ExportDef,
ExportDefEnv,
ExportExtern, ExportExtern,
ExportUse, ExportUse,
Extern, Extern,
@ -71,7 +69,6 @@ pub fn bind_debug_commands(engine_state: &mut EngineState) -> CrateResult<()> {
Explain, Explain,
Inspect, Inspect,
Metadata, Metadata,
Profile,
TimeIt, TimeIt,
View, View,
ViewFiles, ViewFiles,
@ -97,7 +94,6 @@ pub fn bind_filter_commands(engine_state: &mut EngineState) -> CrateResult<()> {
DropColumn, DropColumn,
DropNth, DropNth,
Each, Each,
EachWhile,
Empty, Empty,
Enumerate, Enumerate,
Every, Every,
@ -127,12 +123,6 @@ pub fn bind_filter_commands(engine_state: &mut EngineState) -> CrateResult<()> {
Reject, Reject,
Rename, Rename,
Reverse, Reverse,
Roll,
RollDown,
RollUp,
RollLeft,
RollRight,
Rotate,
Select, Select,
Shuffle, Shuffle,
Skip, Skip,
@ -146,7 +136,6 @@ pub fn bind_filter_commands(engine_state: &mut EngineState) -> CrateResult<()> {
UniqBy, UniqBy,
Upsert, Upsert,
Update, Update,
UpdateCells,
Values, Values,
Where, Where,
Window, Window,
@ -224,20 +213,15 @@ pub fn bind_string_commands(engine_state: &mut EngineState) -> CrateResult<()> {
Encode, Encode,
DecodeBase64, DecodeBase64,
EncodeBase64, EncodeBase64,
DecodeHex,
EncodeHex,
DetectColumns, DetectColumns,
Format, Format,
FileSize,
Parse, Parse,
Size,
Split, Split,
SplitChars, SplitChars,
SplitColumn, SplitColumn,
SplitRow, SplitRow,
SplitWords, SplitWords,
Str, Str,
StrCamelCase,
StrCapitalize, StrCapitalize,
StrContains, StrContains,
StrDistance, StrDistance,
@ -246,35 +230,15 @@ pub fn bind_string_commands(engine_state: &mut EngineState) -> CrateResult<()> {
StrJoin, StrJoin,
StrReplace, StrReplace,
StrIndexOf, StrIndexOf,
StrKebabCase,
StrLength, StrLength,
StrPascalCase,
StrReverse, StrReverse,
StrScreamingSnakeCase,
StrSnakeCase,
StrStartsWith, StrStartsWith,
StrSubstring, StrSubstring,
StrTrim, StrTrim,
StrTitleCase,
StrUpcase StrUpcase
} }
} }
pub fn bind_bit_commands(engine_state: &mut EngineState) -> CrateResult<()> {
bind_commands! {
engine_state,
Bits,
BitsAnd,
BitsNot,
BitsOr,
BitsXor,
BitsRotateLeft,
BitsRotateRight,
BitsShiftLeft,
BitsShiftRight,
}
}
pub fn bind_byte_commands(engine_state: &mut EngineState) -> CrateResult<()> { pub fn bind_byte_commands(engine_state: &mut EngineState) -> CrateResult<()> {
bind_commands! { bind_commands! {
engine_state, engine_state,
@ -297,10 +261,10 @@ pub fn bind_file_system_commands(engine_state: &mut EngineState) -> CrateResult<
bind_commands! { bind_commands! {
engine_state, engine_state,
Cd, Cd,
Cp, UCp,
Ls, Ls,
Mkdir, Mkdir,
Mv, UMv,
Open, Open,
Rm, Rm,
Save, Save,
@ -314,8 +278,6 @@ pub fn bind_platform_commands(engine_state: &mut EngineState) -> CrateResult<()>
bind_commands! { bind_commands! {
engine_state, engine_state,
Ansi, Ansi,
AnsiGradient,
AnsiStrip,
Clear, Clear,
Du, Du,
Input, Input,
@ -357,14 +319,12 @@ pub fn bind_format_commands(engine_state: &mut EngineState) -> CrateResult<()> {
FromSsv, FromSsv,
FromToml, FromToml,
FromTsv, FromTsv,
FromUrl,
FromXlsx, FromXlsx,
FromXml, FromXml,
FromYaml, FromYaml,
FromYml, FromYml,
To, To,
ToCsv, ToCsv,
ToHtml,
ToJson, ToJson,
ToMd, ToMd,
ToNuon, ToNuon,
@ -384,7 +344,6 @@ pub fn bind_viewer_commands(engine_state: &mut EngineState) -> CrateResult<()> {
engine_state, engine_state,
Griddle, Griddle,
Table, Table,
Explore,
} }
} }
@ -392,12 +351,10 @@ pub fn bind_conversion_commands(engine_state: &mut EngineState) -> CrateResult<(
bind_commands! { bind_commands! {
engine_state, engine_state,
Fill, Fill,
Fmt,
Into, Into,
IntoBool, IntoBool,
IntoBinary, IntoBinary,
IntoDatetime, IntoDatetime,
IntoDecimal,
IntoDuration, IntoDuration,
IntoFilesize, IntoFilesize,
IntoInt, IntoInt,
@ -437,23 +394,6 @@ pub fn bind_math_commands(engine_state: &mut EngineState) -> CrateResult<()> {
MathStddev, MathStddev,
MathSum, MathSum,
MathVariance, MathVariance,
MathSin,
MathCos,
MathTan,
MathSinH,
MathCosH,
MathTanH,
MathArcSin,
MathArcCos,
MathArcTan,
MathArcSinH,
MathArcCosH,
MathArcTanH,
MathPi,
MathTau,
MathEuler,
MathExp,
MathLn,
MathLog, MathLog,
} }
} }
@ -483,9 +423,7 @@ pub fn bind_random_commands(engine_state: &mut EngineState) -> CrateResult<()> {
Random, Random,
RandomBool, RandomBool,
RandomChars, RandomChars,
RandomDecimal,
RandomDice, RandomDice,
RandomInteger,
RandomUuid, RandomUuid,
} }
} }

@ -54,7 +54,6 @@ impl ContextBuilder {
path, path,
system, system,
string, string,
bit,
byte, byte,
file_system, file_system,
platform, platform,

@ -12,7 +12,7 @@ pub enum CrateError {
#[error("Parse Error {0:?}")] #[error("Parse Error {0:?}")]
#[diagnostic()] #[diagnostic()]
NuParseErrors(#[related] Vec<ParseError>), NuParseErrors(Vec<ParseError>),
#[error("Could not find the function {0}")] #[error("Could not find the function {0}")]
#[diagnostic()] #[diagnostic()]

@ -1,5 +1,5 @@
use nu_protocol::{ use nu_protocol::{
ast::{Expr, Expression}, ast::{Expr, Expression, RecordItem},
Span, Value, Span, Value,
}; };
@ -42,16 +42,13 @@ impl ValueIntoExpression for Value {
Value::Duration { val, .. } => Expr::Int(val), Value::Duration { val, .. } => Expr::Int(val),
Value::Date { val, .. } => Expr::DateTime(val), Value::Date { val, .. } => Expr::DateTime(val),
Value::String { val, .. } => Expr::String(val), Value::String { val, .. } => Expr::String(val),
Value::Record { Value::Record { val, .. } => {
mut cols, mut vals, .. let entries = val
} => { .into_iter()
let mut entries = Vec::new(); .map(|(col, val)| {
RecordItem::Pair(col.into_expression(), val.into_expression())
for _ in 0..cols.len() { })
let col = cols.remove(0).into_expression(); .collect();
let val = vals.remove(0).into_expression();
entries.push((col, val));
}
Expr::Record(entries) Expr::Record(entries)
} }
@ -61,7 +58,7 @@ impl ValueIntoExpression for Value {
} }
Value::Block { val, .. } => Expr::Block(val), Value::Block { val, .. } => Expr::Block(val),
Value::Nothing { .. } => Expr::Nothing, Value::Nothing { .. } => Expr::Nothing,
Value::Error { error } => Expr::String(error.to_string()), Value::Error { error, .. } => Expr::String(error.to_string()),
Value::Binary { val, .. } => Expr::Binary(val), Value::Binary { val, .. } => Expr::Binary(val),
Value::CellPath { val, .. } => Expr::CellPath(val), Value::CellPath { val, .. } => Expr::CellPath(val),
_ => Expr::Nothing, _ => Expr::Nothing,

@ -1,4 +1,4 @@
use nu_protocol::{Span, Value}; use nu_protocol::{Record, Span, Value};
use rusty_value::{Fields, HashableValue, RustyValue}; use rusty_value::{Fields, HashableValue, RustyValue};
use crate::utils::NewEmpty; use crate::utils::NewEmpty;
@ -48,7 +48,7 @@ impl RustyIntoValue for Vec<Value> {
fn into_value(self) -> Value { fn into_value(self) -> Value {
Value::List { Value::List {
vals: self, vals: self,
span: Span::empty(), internal_span: Span::empty(),
} }
} }
} }
@ -61,7 +61,7 @@ impl RustyIntoValue for rusty_value::Value {
if let Fields::Unit = &s.fields { if let Fields::Unit = &s.fields {
Value::String { Value::String {
val: s.name, val: s.name,
span: Span::empty(), internal_span: Span::empty(),
} }
} else { } else {
s.fields.into_value() s.fields.into_value()
@ -71,7 +71,7 @@ impl RustyIntoValue for rusty_value::Value {
if let Fields::Unit = &e.fields { if let Fields::Unit = &e.fields {
Value::String { Value::String {
val: e.variant, val: e.variant,
span: Span::empty(), internal_span: Span::empty(),
} }
} else { } else {
e.fields.into_value() e.fields.into_value()
@ -86,9 +86,8 @@ impl RustyIntoValue for rusty_value::Value {
vals.push(val.into_value()); vals.push(val.into_value());
} }
Value::Record { Value::Record {
cols, val: Record::from_raw_cols_vals_unchecked(cols, vals),
vals, internal_span: Span::empty(),
span: Span::empty(),
} }
} }
rusty_value::Value::List(l) => { rusty_value::Value::List(l) => {
@ -96,11 +95,11 @@ impl RustyIntoValue for rusty_value::Value {
Value::List { Value::List {
vals, vals,
span: Span::empty(), internal_span: Span::empty(),
} }
} }
rusty_value::Value::None => Value::Nothing { rusty_value::Value::None => Value::Nothing {
span: Span::empty(), internal_span: Span::empty(),
}, },
} }
} }
@ -113,15 +112,15 @@ impl RustyIntoValue for rusty_value::Primitive {
rusty_value::Primitive::Float(f) => f.into_value(), rusty_value::Primitive::Float(f) => f.into_value(),
rusty_value::Primitive::String(val) => Value::String { rusty_value::Primitive::String(val) => Value::String {
val, val,
span: Span::empty(), internal_span: Span::empty(),
}, },
rusty_value::Primitive::Char(val) => Value::String { rusty_value::Primitive::Char(val) => Value::String {
val: val.to_string(), val: val.to_string(),
span: Span::empty(), internal_span: Span::empty(),
}, },
rusty_value::Primitive::Bool(val) => Value::Bool { rusty_value::Primitive::Bool(val) => Value::Bool {
val, val,
span: Span::empty(), internal_span: Span::empty(),
}, },
rusty_value::Primitive::OsString(osstr) => osstr.to_string_lossy().into_value(), rusty_value::Primitive::OsString(osstr) => osstr.to_string_lossy().into_value(),
} }
@ -140,9 +139,8 @@ impl RustyIntoValue for rusty_value::Fields {
vals.push(v.into_value()); vals.push(v.into_value());
} }
Value::Record { Value::Record {
cols, val: Record::from_raw_cols_vals_unchecked(cols, vals),
vals, internal_span: Span::empty(),
span: Span::empty(),
} }
} }
rusty_value::Fields::Unnamed(unnamed) => { rusty_value::Fields::Unnamed(unnamed) => {
@ -158,12 +156,12 @@ impl RustyIntoValue for rusty_value::Fields {
} else { } else {
Value::List { Value::List {
vals, vals,
span: Span::empty(), internal_span: Span::empty(),
} }
} }
} }
rusty_value::Fields::Unit => Value::Nothing { rusty_value::Fields::Unit => Value::Nothing {
span: Span::empty(), internal_span: Span::empty(),
}, },
} }
} }
@ -187,7 +185,7 @@ impl RustyIntoValue for rusty_value::Integer {
}; };
Value::Int { Value::Int {
val, val,
span: Span::empty(), internal_span: Span::empty(),
} }
} }
} }
@ -201,7 +199,7 @@ impl RustyIntoValue for rusty_value::Float {
}; };
Value::Float { Value::Float {
val, val,
span: Span::empty(), internal_span: Span::empty(),
} }
} }
} }

@ -18,7 +18,7 @@ fn it_evals_strings() {
#[test] #[test]
fn it_reports_parse_errors() { fn it_reports_parse_errors() {
let mut ctx = get_context(); let mut ctx = get_context();
let eval_result = ctx.eval_raw(r#"let a = 1 | 2 | 3"#, PipelineData::empty()); let eval_result = ctx.eval_raw(r#"let a = 1 || 2"#, PipelineData::empty());
assert!(eval_result.is_err()); assert!(eval_result.is_err());
} }

Loading…
Cancel
Save