summaryrefslogtreecommitdiffstats
path: root/src/options.rs
diff options
context:
space:
mode:
authorSebastian Thiel <sthiel@thoughtworks.com>2019-06-04 20:42:15 +0530
committerSebastian Thiel <sthiel@thoughtworks.com>2019-06-04 20:42:15 +0530
commita1ecbf0a1a68ca7bb9f4e372e89b66ac3a945264 (patch)
treec1ca24667caa36da2c577335cc7293f19249c930 /src/options.rs
parent9d430a23d950edabfbeca55ba4805c48dfde99a3 (diff)
Add support for static byte units
Diffstat (limited to 'src/options.rs')
-rw-r--r--src/options.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/options.rs b/src/options.rs
index c3041bd..819aa01 100644
--- a/src/options.rs
+++ b/src/options.rs
@@ -7,7 +7,11 @@ arg_enum! {
pub enum ByteFormat {
Metric,
Binary,
- Bytes
+ Bytes,
+ GB,
+ GiB,
+ MB,
+ MiB
}
}
@@ -17,6 +21,10 @@ impl From<ByteFormat> for LibraryByteFormat {
ByteFormat::Metric => LibraryByteFormat::Metric,
ByteFormat::Binary => LibraryByteFormat::Binary,
ByteFormat::Bytes => LibraryByteFormat::Bytes,
+ ByteFormat::GB => LibraryByteFormat::GB,
+ ByteFormat::GiB => LibraryByteFormat::GiB,
+ ByteFormat::MB => LibraryByteFormat::MB,
+ ByteFormat::MiB => LibraryByteFormat::MiB,
}
}
}
@@ -37,6 +45,10 @@ pub struct Args {
/// 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
#[structopt(short = "f", long = "format")]
pub format: Option<ByteFormat>,