wtg_cli/
help.rs

1use crossterm::style::Stylize;
2
3use crate::constants;
4
5/// Display custom help message when no input is provided
6pub fn display_help() {
7    let version = env!("CARGO_PKG_VERSION");
8
9    println!(
10        r"{title}
11{version}
12
13{tagline}
14
15{usage_header}
16  {cmd} {examples}
17  {cmd} -r {repo_url} {examples}
18
19{what_header}
20  {bullet} Throw anything at me: commits, issues, PRs, files, or tags
21  {bullet} I'll figure out what you mean and show you the juicy details
22  {bullet} Including who to blame and which release shipped it
23  {bullet} Works with local repos OR any GitHub repo (via -r flag)
24
25{examples_header}
26  {dim}# Local repository
27  {cmd} c62bbcc                              {dim2}# Find commit info
28  {cmd} 123                                  {dim2}# Look up issue or PR
29  {cmd} Cargo.toml                           {dim2}# Check file history
30  {cmd} v1.2.3                               {dim2}# Inspect a release tag
31
32  {dim}# Remote repository
33  {cmd} -r owner/repo c62bbcc                {dim2}# Check commit in remote repo
34  {cmd} -r https://github.com/owner/repo 123 {dim2}# Look up remote issue/PR
35
36  {dim}# GitHub URLs (auto-detected)
37  {cmd} https://github.com/owner/repo/commit/abc123
38  {cmd} https://github.com/owner/repo/issues/42
39  {cmd} https://github.com/owner/repo/pull/123
40  {cmd} https://github.com/owner/repo/blob/main/src/file.rs
41",
42        title = format!("{} What The Git?! {}", "🔍", "🔍").green().bold(),
43        version = format!("v{version}").dark_grey(),
44        tagline = constants::DESCRIPTION.to_string().dark_grey().italic(),
45        usage_header = "USAGE".cyan().bold(),
46        cmd = "wtg".cyan(),
47        examples = "<COMMIT|ISSUE|FILE|TAG|URL>".yellow(),
48        repo_url = "<REPO_URL>".yellow(),
49        what_header = "WHAT I DO".cyan().bold(),
50        bullet = "→",
51        examples_header = "EXAMPLES".cyan().bold(),
52        dim = "".dark_grey(),
53        dim2 = "".dark_grey(),
54    );
55}