summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2023-03-12 08:17:26 +0100
committerSebastian Thiel <sebastian.thiel@icloud.com>2023-03-12 08:17:26 +0100
commitd0e85fec1586a8937928472e361837ef21e40b14 (patch)
tree1dd34d3b03bbf2eae2409d826407303f8c3e210e
parent22f54dd7c0e83b55e0acc2fb1a10ab487bdeb9fb (diff)
feat: improve CLI help provided with the `--format` flag.
It's now possible to see what possible values are without reading a swath of text. Now the default is shown as well which is more important now that it changes depending on the platform.
-rw-r--r--src/options.rs13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/options.rs b/src/options.rs
index ab48980..6711795 100644
--- a/src/options.rs
+++ b/src/options.rs
@@ -27,7 +27,7 @@ impl From<ByteFormat> for LibraryByteFormat {
}
fn dft_format() -> ByteFormat {
- if std::env::consts::OS == "macos" {
+ if cfg!(target_vendor = "apple") {
ByteFormat::Metric
} else {
ByteFormat::Binary
@@ -47,22 +47,13 @@ pub struct Args {
#[clap(short = 't', long = "threads", default_value_t = 0)]
pub threads: usize,
- /// The format with which to print byte counts:
- /// metric - uses 1000 as base (default),
- /// binary - uses 1024 as base,
- /// bytes - plain bytes without any formatting,
- /// GB - only gigabytes,
- /// GiB - only gibibytes,
- /// MB - only megabytes,
- /// MiB - only mebibytes
+ /// The format with which to print byte counts.
#[clap(
short = 'f',
long,
value_enum,
default_value_t = dft_format(),
ignore_case = true,
- hide_default_value = true,
- hide_possible_values = true
)]
pub format: ByteFormat,