aboutsummaryrefslogtreecommitdiff
path: root/src/command/status/mod.rs
blob: ba73184733ac159b7fd008b8f6a47545d0516d2b (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
mod configuration_status;

use std::io::Result;

pub struct Status;

impl Status {
    pub fn new() -> Self {
        Status
    }
}

impl super::Command for Status {
    fn before_dependencies(&self) -> Vec<Box<dyn super::Command>> {
        vec![]
    }

    fn execute(&self, _: Option<&String>) -> Result<()> {
        let status_providers = available_status_providers();
        for status_provider in status_providers {
            println!("{}", status_provider());
        }
        return Ok(())
    }

    fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {
        vec![]
    }

    fn command(&self) -> &'static str {
        "status"
    }

    fn help(&self) -> &'static str {
        "\t\t\t\tPrints the status of your blog"
    }
}

fn available_status_providers() -> Vec<fn() -> String> {
    vec![
        configuration_status::status,
    ]
}