]> git.r.bdr.sh - rbdr/blog/blob - src/command/status/mod.rs
Add deb generator
[rbdr/blog] / src / command / status / mod.rs
1 mod configuration_status;
2 mod blog_status;
3
4 use std::io::Result;
5 use crate::configuration::Configuration;
6
7 pub struct Status;
8
9 impl Status {
10 pub fn new() -> Self {
11 Status
12 }
13 }
14
15 impl super::Command for Status {
16 fn before_dependencies(&self) -> Vec<Box<dyn super::Command>> {
17 vec![]
18 }
19
20 fn execute(&self, _: Option<&String>, configuration: &Configuration, _: &String) -> Result<()> {
21 let status_providers = available_status_providers();
22 for status_provider in status_providers {
23 println!("{}\n----\n", status_provider(configuration));
24 }
25 return Ok(())
26 }
27
28 fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {
29 vec![]
30 }
31
32 fn command(&self) -> &'static str {
33 "status"
34 }
35
36 fn help(&self) -> &'static str {
37 "\t\t\t\tPrints the status of your blog"
38 }
39 }
40
41 fn available_status_providers() -> Vec<fn(&Configuration) -> String> {
42 vec![
43 configuration_status::status,
44 blog_status::status,
45 ]
46 }