mirror of
https://github.com/Llewellynvdm/exa.git
synced 2025-01-23 21:58:27 +00:00
Add --bytes to not use prefixes at all
This commit is contained in:
parent
f03a496424
commit
a871a448be
@ -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
|
||||
|
@ -14,6 +14,7 @@ impl Copy for Column { }
|
||||
pub enum SizeFormat {
|
||||
DecimalBytes,
|
||||
BinaryBytes,
|
||||
JustBytes,
|
||||
}
|
||||
|
||||
impl Copy for SizeFormat { }
|
||||
|
@ -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 {
|
||||
|
@ -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))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user