blob: 283562a72bd7b536a21dc5d7e4fa7fc217405e18 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
use crate::options::{flags, OptionsError};
use crate::options::parser::MatchedFlags;
use crate::output::file_name::{Options, Classify};
impl Options {
pub fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
let classify = Classify::deduce(matches)?;
let icons = matches.has(&flags::ICONS)?;
Ok(Self { classify, icons })
}
}
impl Classify {
fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
let flagged = matches.has(&flags::CLASSIFY)?;
if flagged { Ok(Self::AddFileIndicators) }
else { Ok(Self::JustFilenames) }
}
}
|