mirror of
https://github.com/Llewellynvdm/exa.git
synced 2025-01-28 08:08:26 +00:00
Add Default instances in Options
This commit is contained in:
parent
5ffff841e0
commit
8e7efed3f5
@ -343,6 +343,12 @@ pub enum SizeFormat {
|
|||||||
JustBytes,
|
JustBytes,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for SizeFormat {
|
||||||
|
fn default() -> SizeFormat {
|
||||||
|
SizeFormat::DecimalBytes
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl SizeFormat {
|
impl SizeFormat {
|
||||||
pub fn deduce(matches: &getopts::Matches) -> Result<SizeFormat, Misfire> {
|
pub fn deduce(matches: &getopts::Matches) -> Result<SizeFormat, Misfire> {
|
||||||
let binary = matches.opt_present("binary");
|
let binary = matches.opt_present("binary");
|
||||||
@ -381,6 +387,12 @@ pub struct TimeTypes {
|
|||||||
created: bool,
|
created: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for TimeTypes {
|
||||||
|
fn default() -> TimeTypes {
|
||||||
|
TimeTypes { accessed: false, modified: true, created: false }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl TimeTypes {
|
impl TimeTypes {
|
||||||
|
|
||||||
/// Find which field to use based on a user-supplied word.
|
/// Find which field to use based on a user-supplied word.
|
||||||
@ -413,7 +425,7 @@ impl TimeTypes {
|
|||||||
Ok(TimeTypes { accessed: accessed, modified: modified, created: created })
|
Ok(TimeTypes { accessed: accessed, modified: modified, created: created })
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Ok(TimeTypes { accessed: false, modified: true, created: false })
|
Ok(TimeTypes::default())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -504,7 +516,7 @@ impl RecurseOptions {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(PartialEq, Copy, Clone, Debug)]
|
#[derive(PartialEq, Copy, Clone, Debug, Default)]
|
||||||
pub struct Columns {
|
pub struct Columns {
|
||||||
size_format: SizeFormat,
|
size_format: SizeFormat,
|
||||||
time_types: TimeTypes,
|
time_types: TimeTypes,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user