changed to-float to to-decimal (#1926)

* changed to-float to to-decimal

* changed to-float to to-decimal
This commit is contained in:
Rohan Rout 2020-06-02 02:32:57 +05:30 committed by GitHub
parent ac22319a5d
commit ae72593831
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 12 deletions

View file

@ -292,7 +292,7 @@ pub fn create_default_context(
whole_stream_command(Trim),
whole_stream_command(Echo),
whole_stream_command(Str),
whole_stream_command(StrToFloat),
whole_stream_command(StrToDecimal),
whole_stream_command(StrToInteger),
whole_stream_command(StrDowncase),
whole_stream_command(StrUpcase),

View file

@ -230,7 +230,7 @@ pub(crate) use split::SplitRow;
pub(crate) use split_by::SplitBy;
pub(crate) use str_::{
Str, StrCapitalize, StrDowncase, StrFindReplace, StrSet, StrSubstring, StrToDatetime,
StrToFloat, StrToInteger, StrTrim, StrUpcase,
StrToDecimal, StrToInteger, StrTrim, StrUpcase,
};
pub(crate) use sum::Sum;
#[allow(unused_imports)]

View file

@ -5,7 +5,7 @@ mod find_replace;
mod set;
mod substring;
mod to_datetime;
mod to_float;
mod to_decimal;
mod to_integer;
mod trim;
mod upcase;
@ -17,7 +17,7 @@ pub use find_replace::SubCommand as StrFindReplace;
pub use set::SubCommand as StrSet;
pub use substring::SubCommand as StrSubstring;
pub use to_datetime::SubCommand as StrToDatetime;
pub use to_float::SubCommand as StrToFloat;
pub use to_decimal::SubCommand as StrToDecimal;
pub use to_integer::SubCommand as StrToInteger;
pub use trim::SubCommand as StrTrim;
pub use upcase::SubCommand as StrUpcase;

View file

@ -21,18 +21,18 @@ pub struct SubCommand;
#[async_trait]
impl WholeStreamCommand for SubCommand {
fn name(&self) -> &str {
"str to-float"
"str to-decimal"
}
fn signature(&self) -> Signature {
Signature::build("str to-float").rest(
Signature::build("str to-decimal").rest(
SyntaxShape::ColumnPath,
"optionally convert text into float by column paths",
"optionally convert text into decimal by column paths",
)
}
fn usage(&self) -> &str {
"converts text into float"
"converts text into decimal"
}
async fn run(
@ -45,8 +45,8 @@ impl WholeStreamCommand for SubCommand {
fn examples(&self) -> Vec<Example> {
vec![Example {
description: "Convert to float",
example: "echo '3.1415' | str to-float",
description: "Convert to decimal",
example: "echo '3.1415' | str to-decimal",
result: None,
}]
}

View file

@ -101,13 +101,13 @@ fn converts_to_int() {
}
#[test]
fn converts_to_float() {
fn converts_to_decimal() {
let actual = nu!(
cwd: "tests/fixtures/formats", pipeline(
r#"
echo "3.1, 0.0415"
| split row ","
| str to-float
| str to-decimal
| sum
"#
));