]> git.r.bdr.sh - rbdr/blog/blob - src/command/help.rs
Add release
[rbdr/blog] / src / command / help.rs
1 use std::io::Result;
2 use super::available_commands;
3 use crate::configuration::Configuration;
4
5 pub struct Help;
6
7 impl Help {
8 pub fn new() -> Self {
9 Help
10 }
11 }
12
13 impl super::Command for Help {
14 fn before_dependencies(&self) -> Vec<Box<dyn super::Command>> {
15 vec![]
16 }
17
18 fn execute(&self, _: Option<&String>, _: &Configuration, _: &String) -> Result<()> {
19 let commands = available_commands();
20 println!("Usage:");
21 println!("");
22 for command in commands {
23 print!("blog {} ", command.command());
24 println!("{}", command.help());
25 }
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 }