diff --git a/README.md b/README.md index 66b2177..1c3a633 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ exa is a replacement for `ls` written in Rust. - **-1**, **--oneline**: display one entry per line - **-a**, **--all**: show dot files - **-b**, **--binary**: use binary (power of two) file sizes +- **-B**, **--bytes**: list file sizes in bytes, without prefixes - **-d**, **--list-dirs**: list directories as regular files - **-g**, **--group**: show group as well as user - **-h**, **--header**: show a header row diff --git a/src/column.rs b/src/column.rs index 0731494..97e60c9 100644 --- a/src/column.rs +++ b/src/column.rs @@ -14,6 +14,7 @@ impl Copy for Column { } pub enum SizeFormat { DecimalBytes, BinaryBytes, + JustBytes, } impl Copy for SizeFormat { } diff --git a/src/file.rs b/src/file.rs index 64d4793..74018ac 100644 --- a/src/file.rs +++ b/src/file.rs @@ -234,7 +234,8 @@ impl<'a> File<'a> { else { let result = match size_format { SizeFormat::DecimalBytes => decimal_prefix(self.stat.size as f64), - SizeFormat::BinaryBytes => binary_prefix(self.stat.size as f64), + SizeFormat::BinaryBytes => binary_prefix(self.stat.size as f64), + SizeFormat::JustBytes => return Green.bold().paint(self.stat.size.to_string().as_slice()).to_string(), }; match result { diff --git a/src/options.rs b/src/options.rs index 441e1e2..319decb 100644 --- a/src/options.rs +++ b/src/options.rs @@ -49,6 +49,7 @@ impl Options { getopts::optflag("1", "oneline", "display one entry per line"), getopts::optflag("a", "all", "show dot-files"), getopts::optflag("b", "binary", "use binary prefixes in file sizes"), + getopts::optflag("B", "bytes", "list file sizes in bytes, without prefixes"), getopts::optflag("d", "list-dirs", "list directories as regular files"), getopts::optflag("g", "group", "show group as well as user"), getopts::optflag("h", "header", "show a header row at the top"), @@ -117,6 +118,9 @@ impl Options { if matches.opt_present("binary") { columns.push(FileSize(SizeFormat::BinaryBytes)) } + else if matches.opt_present("bytes") { + columns.push(FileSize(SizeFormat::JustBytes)) + } else { columns.push(FileSize(SizeFormat::DecimalBytes)) }