mirror of
https://github.com/nushell/nushell.git
synced 2025-08-02 05:53:34 +02:00
Move command changes. Refactorings. (#2683)
Continuing on anchoring and improvements on Nu's overall internal commands (#2635). `move column` sub command has been turned into the command `move` since we use it to move exclusively columns. Examples added as well. Fixed it to carry along any anchor locations that might be in place if table to be moved originates from other sources.
This commit is contained in:
committed by
GitHub
parent
bc6c884a14
commit
b6d19cc9fa
@ -21,6 +21,7 @@ getset = "0.1.1"
|
||||
glob = "0.3.0"
|
||||
indexmap = {version = "1.6.0", features = ["serde-1"]}
|
||||
num-bigint = {version = "0.3.0", features = ["serde"]}
|
||||
bigdecimal = {version = "0.2.0", features = ["serde"]}
|
||||
tempfile = "3.1.0"
|
||||
|
||||
[build-dependencies]
|
||||
|
@ -1,16 +1,21 @@
|
||||
use bigdecimal::BigDecimal;
|
||||
use chrono::{DateTime, NaiveDate, Utc};
|
||||
use indexmap::IndexMap;
|
||||
use nu_errors::ShellError;
|
||||
use nu_protocol::{ColumnPath, PathMember, Primitive, UntaggedValue, Value};
|
||||
use nu_source::{Span, SpannedItem, Tagged, TaggedItem};
|
||||
use nu_protocol::{PathMember, Primitive, UntaggedValue, Value};
|
||||
use nu_source::{Span, TaggedItem};
|
||||
use num_bigint::BigInt;
|
||||
|
||||
pub fn int(s: impl Into<BigInt>) -> Value {
|
||||
UntaggedValue::int(s).into_untagged_value()
|
||||
}
|
||||
|
||||
pub fn decimal_from_float(f: f64, span: Span) -> Value {
|
||||
UntaggedValue::decimal_from_float(f, span).into_untagged_value()
|
||||
pub fn decimal(s: BigDecimal) -> Value {
|
||||
UntaggedValue::Primitive(Primitive::Decimal(s)).into_untagged_value()
|
||||
}
|
||||
|
||||
pub fn decimal_from_float(f: f64) -> Value {
|
||||
UntaggedValue::decimal_from_float(f, Span::unknown()).into_untagged_value()
|
||||
}
|
||||
|
||||
pub fn string(input: impl Into<String>) -> Value {
|
||||
@ -42,9 +47,8 @@ pub fn date(input: impl Into<String>) -> Value {
|
||||
.into_untagged_value()
|
||||
}
|
||||
|
||||
pub fn column_path(paths: &str) -> Result<Tagged<ColumnPath>, ShellError> {
|
||||
let paths = paths.to_string().spanned_unknown();
|
||||
Ok(ColumnPath::build(&paths).tagged_unknown())
|
||||
pub fn column_path(paths: &str) -> Value {
|
||||
UntaggedValue::column_path(paths, Span::unknown()).into_untagged_value()
|
||||
}
|
||||
|
||||
pub fn error_callback(
|
||||
|
Reference in New Issue
Block a user