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