jotter/cli/
help.rs

1use pallete::{print_fg, printfg, println_fg, Color};
2
3pub fn help() {
4    print_fg!(Color::Cyan, "Jotter");
5    print!(" - ");
6    print_fg!(Color::Yellow, "A very ");
7
8    print_fg!(Color::Red, "(un)secure");
9
10    println_fg!(Color::Yellow, " tool for writing notes\n");
11
12    println_fg!(Color::Green, "Commands:");
13    let commands = vec!["help", "all", "set", "remove", "get"];
14
15    let command_help_messages = vec![
16        "help for using this tool",
17        "list all your notes",
18        "set a label with content (notes set label 'content')",
19        "remove label",
20        "get a label",
21    ];
22
23    let max_command_len = commands
24        .iter()
25        .fold(0, |acc, v| if v.len() > acc { v.len() } else { acc });
26
27    commands
28        .iter()
29        .zip(command_help_messages.iter())
30        .for_each(|(command, help)| {
31            print_fg!(Color::Yellow, "  `{}`", command);
32
33            print!(
34                "{}: ",
35                std::iter::repeat(" ")
36                    .take(max_command_len - command.len())
37                    .collect::<String>()
38            );
39
40            println_fg!(Color::Cyan, "{}", help);
41        })
42    //     println!(
43    //         "Notes - (A very (un)secure tool for writing notes on the cli)
44    // "
45    //     )
46}