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:
Andrés N. Robalino
2020-10-20 04:07:13 -05:00
committed by GitHub
parent bc6c884a14
commit b6d19cc9fa
49 changed files with 516 additions and 625 deletions

View File

@ -24,3 +24,12 @@ macro_rules! outln {
macro_rules! errln {
($($tokens:tt)*) => { eprintln!($($tokens)*) }
}
#[macro_export]
macro_rules! row {
($( $key: expr => $val: expr ),*) => {{
let mut map = ::indexmap::IndexMap::new();
$( map.insert($key, $val); )*
::nu_protocol::UntaggedValue::row(map).into_untagged_value()
}}
}

View File

@ -169,8 +169,8 @@ impl UntaggedValue {
}
/// Helper for creating column-path values
pub fn column_path(s: &str) -> UntaggedValue {
let s = s.to_string().spanned_unknown();
pub fn column_path(s: &str, span: Span) -> UntaggedValue {
let s = s.to_string().spanned(span);
UntaggedValue::Primitive(Primitive::ColumnPath(ColumnPath::build(&s)))
}
@ -196,8 +196,8 @@ impl UntaggedValue {
}
/// Helper for creating decimal values
pub fn decimal(s: BigDecimal) -> UntaggedValue {
UntaggedValue::Primitive(Primitive::Decimal(s))
pub fn decimal(s: impl Into<BigDecimal>) -> UntaggedValue {
UntaggedValue::Primitive(Primitive::Decimal(s.into()))
}
/// Helper for creating decimal values