1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
use dev_prefix::*;
pub use core::prefix::*;

pub use std::rc::Rc;

/// settings for what to format
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct FmtSettings {
    pub long: bool,
    pub recurse: u8,
    pub path: bool,
    pub parts: bool,
    pub partof: bool,
    pub loc_path: bool,
    pub text: bool,
    pub color: bool,
}

impl FmtSettings {
    pub fn is_empty(&self) -> bool {
        !self.long && !self.path && !self.parts && !self.partof && !self.loc_path && !self.text
    }
}

/// structure which contains all the information necessary to
/// format an artifact for cmdline, html, or anything else
/// purposely doesn't contain items that are *always* displayed
/// such as completed or tested
#[derive(Debug, Default)]
pub struct FmtArtifact {
    pub long: bool,
    pub path: Option<PathBuf>,
    pub parts: Option<Vec<FmtArtifact>>,
    pub partof: Option<Vec<FmtArtifact>>,
    pub loc: Option<Loc>,
    // pub loc_path: Option<PathBuf>,
    // pub loc_line_col: (usize, usize),
    // pub loc_valid: Option<bool>,
    pub text: Option<String>,
    pub name: ArtNameRc,
}


#[derive(Debug, PartialEq, Eq)]
pub struct PercentSearch {
    pub lt: bool,
    pub perc: i8,
}

impl Default for PercentSearch {
    fn default() -> PercentSearch {
        PercentSearch {
            lt: false,
            perc: -127,
        }
    }
}

#[derive(Debug, Default, PartialEq, Eq)]
pub struct SearchSettings {
    pub use_regex: bool,
    pub name: bool,
    pub path: bool,
    pub parts: bool,
    pub partof: bool,
    pub loc: bool,
    pub text: bool,
    pub completed: PercentSearch,
    pub tested: PercentSearch,
}