diff options
author | Helmut K. C. Tessarek <tessarek@evermeet.cx> | 2023-03-11 23:41:55 -0500 |
---|---|---|
committer | Helmut K. C. Tessarek <tessarek@evermeet.cx> | 2023-03-11 23:41:55 -0500 |
commit | 3ccf204a18c784a7af7b6255173b332e0083c047 (patch) | |
tree | 58f280aff5ccabd7eeba2105ae0cadcfb33d4f44 | |
parent | 658c676be779655165e5c5462873c8e828e710f2 (diff) |
use binary format by default (except on macOS)
-rw-r--r-- | src/options.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/options.rs b/src/options.rs index e618f78..6b79278 100644 --- a/src/options.rs +++ b/src/options.rs @@ -1,5 +1,5 @@ use dua::ByteFormat as LibraryByteFormat; -use std::path::PathBuf; +use std::{env, path::PathBuf}; #[derive(PartialEq, Eq, Debug, Clone, Copy, clap::ValueEnum)] pub enum ByteFormat { @@ -26,6 +26,14 @@ impl From<ByteFormat> for LibraryByteFormat { } } +fn dft_format() -> ByteFormat { + if env::consts::OS != "macos" { + ByteFormat::Binary + } else { + ByteFormat::Metric + } +} + /// A tool to learn about disk usage, fast! #[derive(Debug, clap::Parser)] #[clap(name = "dua", version)] @@ -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 |