Skip to content

Commit

Permalink
feat: use metric byte format only on MacOS. (#85)
Browse files Browse the repository at this point in the history
That way, on linux the binary format is used by default which is more common
on that platform.
  • Loading branch information
Byron committed Mar 12, 2023
2 parents 658c676 + b474b81 commit 22f54dd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ impl From<ByteFormat> for LibraryByteFormat {
}
}

fn dft_format() -> ByteFormat {
if std::env::consts::OS == "macos" {
ByteFormat::Metric
} else {
ByteFormat::Binary
}
}

/// A tool to learn about disk usage, fast!
#[derive(Debug, clap::Parser)]
#[clap(name = "dua", version)]
Expand All @@ -51,7 +59,7 @@ pub struct Args {
short = 'f',
long,
value_enum,
default_value_t = ByteFormat::Metric,
default_value_t = dft_format(),
ignore_case = true,
hide_default_value = true,
hide_possible_values = true
Expand Down

0 comments on commit 22f54dd

Please sign in to comment.