1use colored::*;
14
15pub enum HelpOptions {
16 DontPrintCommandSection,
17 PrintCommandSection,
18 PrintCommandSectionWithExternalCommandHint,
19}
20
21pub fn help_template(command_help: HelpOptions) -> String {
22 let mut template = format!(
23 "{{about}}\n\n\
24 {} {{usage}}\n\n\
25 {}\n\
26 {{options}}",
27 "Usage:".bright_green().bold(),
28 "Options:".bright_green().bold(),
29 );
30
31 match command_help {
32 HelpOptions::PrintCommandSection
33 | HelpOptions::PrintCommandSectionWithExternalCommandHint => {
34 template.push_str(&format!(
35 "\n\n\
36 {}\n\
37 {{subcommands}}",
38 "Commands:".bright_green().bold(),
39 ));
40
41 if let HelpOptions::PrintCommandSectionWithExternalCommandHint = command_help {
42 template.push_str(&format!(
43 "\n\
44 {}{}",
45 " ... ".bold(),
46 "See external installed commands with --list"
47 ));
48 }
49 }
50 HelpOptions::DontPrintCommandSection => {}
51 }
52
53 template
54}