mirror of
https://github.com/nushell/nushell
synced 2024-11-10 07:04:13 +00:00
added num-format to allow bytes to be formatted with commas. (#2681)
This commit is contained in:
parent
cb78bf8fd6
commit
bc6c884a14
3 changed files with 5 additions and 2 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -3012,6 +3012,7 @@ dependencies = [
|
|||
"nu-test-support",
|
||||
"nu-value-ext",
|
||||
"num-bigint 0.3.0",
|
||||
"num-format",
|
||||
"num-traits 0.2.12",
|
||||
"parking_lot 0.11.0",
|
||||
"query_interface",
|
||||
|
|
|
@ -23,6 +23,7 @@ indexmap = {version = "1.6.0", features = ["serde-1"]}
|
|||
log = "0.4.11"
|
||||
num-bigint = {version = "0.3.0", features = ["serde"]}
|
||||
num-traits = "0.2.12"
|
||||
num-format = "0.4.0"
|
||||
parking_lot = "0.11.0"
|
||||
query_interface = "0.3.5"
|
||||
serde = {version = "1.0.115", features = ["derive"]}
|
||||
|
|
|
@ -6,6 +6,7 @@ use nu_protocol::RangeInclusion;
|
|||
use nu_protocol::{format_primitive, ColumnPath, Dictionary, Primitive, UntaggedValue, Value};
|
||||
use nu_source::{b, DebugDocBuilder, PrettyDebug, Tag};
|
||||
use num_bigint::BigInt;
|
||||
use num_format::{Locale, ToFormattedString};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::cmp::Ordering;
|
||||
use std::fmt::Debug;
|
||||
|
@ -192,8 +193,8 @@ impl PrettyDebug for FormatInlineShape {
|
|||
|
||||
match byte.get_unit() {
|
||||
byte_unit::ByteUnit::B => {
|
||||
(b::primitive(format!("{}", byte.get_value())) + b::space() + b::kind("B"))
|
||||
.group()
|
||||
let locale_byte = byte.get_value() as u64;
|
||||
(b::primitive(locale_byte.to_formatted_string(&Locale::en))).group()
|
||||
}
|
||||
_ => b::primitive(byte.format(1)),
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue