nu-parser + nu-protocol: switch to metric for KB, MB, GB, add KiB, MiB, GiB units (#3035)

fixes inconsistency with formatting/rendering which uses standard Rust byte_unit
https://en.wikipedia.org/wiki/Byte#Multiple-byte_units
This commit is contained in:
Saeed Rasooli
2021-02-10 06:01:12 +03:30
committed by GitHub
parent 3443ca40c5
commit b403fb1275
7 changed files with 128 additions and 17 deletions

View File

@ -31,11 +31,18 @@ impl WholeStreamCommand for IntoInt {
}
fn examples(&self) -> Vec<Example> {
vec![Example {
description: "Convert filesize to integer",
example: "into-int 1kb | each { = $it / 1024 }",
result: Some(vec![UntaggedValue::int(1).into()]),
}]
vec![
Example {
description: "Convert filesize to integer",
example: "into-int 1kb | each { = $it / 1000 }",
result: Some(vec![UntaggedValue::int(1).into()]),
},
Example {
description: "Convert filesize to integer",
example: "into-int 1kib | each { = $it / 1024 }",
result: Some(vec![UntaggedValue::int(1).into()]),
},
]
}
}