]>
Commit | Line | Data |
---|---|---|
d620665f | 1 | use std::io::Result; |
2f579cf4 | 2 | use super::available_commands; |
d620665f RBR |
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 | ||
2f579cf4 | 17 | fn execute(&self, _: Option<&String>) -> Result<()> { |
2f579cf4 RBR |
18 | let commands = available_commands(); |
19 | println!("Usage:"); | |
20 | println!(""); | |
21 | for command in commands { | |
5f81d796 | 22 | print!("blog {} ", command.command()); |
2f579cf4 RBR |
23 | println!("{}", command.help()); |
24 | } | |
d620665f RBR |
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 | } |