Add --to-float to str plugin (#1872)

This commit is contained in:
k-brk
2020-05-25 00:11:49 +02:00
committed by GitHub
parent fb09d7d1a1
commit 8a99d112fc
9 changed files with 86 additions and 5 deletions

View File

@ -172,6 +172,7 @@ pub fn expect_return_value_at(
}
pub mod value {
use bigdecimal::BigDecimal;
use nu_errors::ShellError;
use nu_protocol::{Primitive, TaggedDictBuilder, UntaggedValue, Value};
use nu_source::Tag;
@ -186,6 +187,10 @@ pub mod value {
UntaggedValue::Primitive(Primitive::Int(i.into())).into_untagged_value()
}
pub fn decimal(f: impl Into<BigDecimal>) -> Value {
UntaggedValue::Primitive(Primitive::Decimal(f.into())).into_untagged_value()
}
pub fn string(input: impl Into<String>) -> Value {
UntaggedValue::string(input.into()).into_untagged_value()
}