aboutsummaryrefslogtreecommitdiff
path: root/src/config/mod.rs
blob: 98ba9fb3203dd3203a24d4cdb71148365f45c18e (plain)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
mod parse;

use std::path::Path;

pub struct Config {
    groups: Vec<Group>,
}

pub struct Group {
    includes: Vec<IncludeAction>,
    links: Vec<LinkAction>,
    copies: Vec<CopyAction>,
}

pub struct IncludeAction {
    group: String,
}

pub struct LinkAction {
    source: String,
    target: String,
}

pub struct CopyAction {
    source: String,
    target: String,
}

pub fn parse(content: &str) -> std::io::Result<Config> {
    todo!()
}

pub fn parse_path(path: impl AsRef<Path>) -> std::io::Result<Config> {
    todo!()
}

pub fn format(content: &str) -> std::io::Result<String> {
    todo!()
}

pub fn format_path(path: impl AsRef<Path>) -> std::io::Result<String> {
    todo!()
}

pub fn format_inplace(path: impl AsRef<Path>) -> std::io::Result<()> {
    todo!()
}

impl Config {
    pub fn groups(&self) -> impl Iterator<Item = &Group> {
        std::iter::empty()
    }

    pub fn group(&self, name: &str) -> Option<&Group> {
        todo!()
    }
}

impl Group {
    pub fn groups(&self) -> impl Iterator<Item = &IncludeAction> {
        std::iter::empty()
    }

    pub fn links(&self) -> impl Iterator<Item = &LinkAction> {
        std::iter::empty()
    }

    pub fn copies(&self) -> impl Iterator<Item = &CopyAction> {
        std::iter::empty()
    }
}

impl IncludeAction {
    pub fn name(&self) -> &str {
        todo!()
    }
}

impl LinkAction {
    pub fn source(&self) -> &str {
        todo!()
    }

    pub fn dest(&self) -> &str {
        todo!()
    }
}

impl CopyAction {
    pub fn source(&self) -> &str {
        todo!()
    }

    pub fn dest(&self) -> &str {
        todo!()
    }
}