]> git.r.bdr.sh - rbdr/blog/blame_incremental - src/command/help.rs
Manually import
[rbdr/blog] / src / command / help.rs
... / ...
CommitLineData
1use std::io::Result;
2use super::available_commands;
3use crate::configuration::Configuration;
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
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}