Skip to content

Commit 6f1b202

Browse files
author
Arkadiusz Bielewicz
committed
lsd-rs#533 thousands separator for the --size=bytes option would be very useful | Potential fix for unix musl
1 parent 7ec07b6 commit 6f1b202

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/meta/size.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use crate::color::{ColoredString, Colors, Elem};
22
use crate::flags::{Flags, SizeFlag};
3+
use num_format::ToFormattedString;
34
use std::fs::Metadata;
45
use std::iter::repeat;
5-
use num_format::{ToFormattedString};
66

77
#[derive(Clone, Debug, PartialEq, Eq)]
88
pub enum Unit {
@@ -58,7 +58,7 @@ impl Size {
5858

5959
#[cfg(not(unix))]
6060
fn os_formatted_bytes(&self) -> String {
61-
self.bytes.to_formatted_string(&Locale::en)
61+
self.bytes.to_formatted_string(&num_format::Locale::en)
6262
}
6363

6464
pub fn get_unit(&self, flags: &Flags) -> Unit {
@@ -184,10 +184,10 @@ impl Size {
184184

185185
#[cfg(test)]
186186
mod test {
187-
use std::env;
188187
use super::Size;
189188
use crate::color::{Colors, ThemeOption};
190189
use crate::flags::{Flags, SizeFlag};
190+
use std::env;
191191

192192
#[test]
193193
fn render_byte() {
@@ -367,7 +367,8 @@ mod test {
367367
#[cfg(unix)]
368368
#[test]
369369
fn render_bytes_with_separator() {
370-
env::set_var("LC_ALL", "en");
370+
env::set_var("LC_ALL", "en-US");
371+
env::set_var("LC_NUMERIC", ",");
371372
let size = Size::new(42 * 1024 * 1024); // == 42 megabytes
372373
let mut flags = Flags::default();
373374

0 commit comments

Comments
 (0)