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