]> git.r.bdr.sh - rbdr/blog/blame - src/command/help.rs
Add blog status, correctly shift
[rbdr/blog] / src / command / help.rs
CommitLineData
d620665f 1use std::io::Result;
2f579cf4 2use super::available_commands;
a9c6be41 3use crate::configuration::Configuration;
d620665f
RBR
4
5pub struct Help;
6
7impl Help {
8 pub fn new() -> Self {
9 Help
10 }
11}
12
13impl super::Command for Help {
14 fn before_dependencies(&self) -> Vec<Box<dyn super::Command>> {
15 vec![]
16 }
17
a9c6be41 18 fn execute(&self, _: Option<&String>, _: &Configuration, _: &String) -> Result<()> {
2f579cf4
RBR
19 let commands = available_commands();
20 println!("Usage:");
21 println!("");
22 for command in commands {
5f81d796 23 print!("blog {} ", command.command());
2f579cf4
RBR
24 println!("{}", command.help());
25 }
d620665f
RBR
26 return Ok(())
27 }
28
29 fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {
30 vec![]
31 }
32
33 fn command(&self) -> &'static str {
34 "help"
35 }
36
37 fn help(&self) -> &'static str {
38 "\t\t\t\tPrints this help"
39 }
40}