]> git.r.bdr.sh - rbdr/blog/blame - src/command/status/mod.rs
Add blog status, correctly shift
[rbdr/blog] / src / command / status / mod.rs
CommitLineData
5f81d796 1mod configuration_status;
0e276d03 2mod blog_status;
5f81d796
RBR
3
4use std::io::Result;
a9c6be41 5use crate::configuration::Configuration;
5f81d796
RBR
6
7pub struct Status;
8
9impl Status {
10 pub fn new() -> Self {
11 Status
12 }
13}
14
15impl super::Command for Status {
16 fn before_dependencies(&self) -> Vec<Box<dyn super::Command>> {
17 vec![]
18 }
19
a9c6be41 20 fn execute(&self, _: Option<&String>, configuration: &Configuration, _: &String) -> Result<()> {
5f81d796
RBR
21 let status_providers = available_status_providers();
22 for status_provider in status_providers {
0e276d03 23 println!("{}\n----\n", status_provider(configuration));
5f81d796
RBR
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
a9c6be41 41fn available_status_providers() -> Vec<fn(&Configuration) -> String> {
5f81d796
RBR
42 vec![
43 configuration_status::status,
0e276d03 44 blog_status::status,
5f81d796
RBR
45 ]
46}