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