1use crossterm::style::Stylize;
2
3use crate::constants;
4
5pub 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_with_r}
18
19{options_header}
20 {opt_r} GitHub repository (e.g., owner/repo)
21 {opt_fetch} Fetch missing refs from remote when not found locally
22
23{what_header}
24 {bullet} Throw anything at me: commits, issues, PRs, files, or tags
25 {bullet} I'll figure out what you mean and show you the juicy details
26 {bullet} Including who to blame and which release shipped it
27 {bullet} Works with local repos OR any GitHub repo (via -r flag)
28
29{examples_header}
30 {dim}# Local repository
31 {cmd} c62bbcc {dim2}# Find commit info
32 {cmd} 123 {dim2}# Look up issue or PR
33 {cmd} Cargo.toml {dim2}# Check file history
34 {cmd} v1.2.3 {dim2}# Inspect a release tag
35
36 {dim}# Remote repository
37 {cmd} -r owner/repo c62bbcc {dim2}# Check commit in remote repo
38 {cmd} -r https://github.com/owner/repo 123 {dim2}# Look up remote issue/PR
39
40 {dim}# GitHub URLs (auto-detected)
41 {cmd} https://github.com/owner/repo/commit/abc123
42 {cmd} https://github.com/owner/repo/issues/42
43 {cmd} https://github.com/owner/repo/pull/123
44 {cmd} https://github.com/owner/repo/blob/main/src/file.rs
45",
46 title = format!("{} What The Git?! {}", "🔍", "🔍").green().bold(),
47 version = format!("v{version}").dark_grey(),
48 tagline = constants::DESCRIPTION.to_string().dark_grey().italic(),
49 usage_header = "USAGE".cyan().bold(),
50 cmd = "wtg".cyan(),
51 examples = "<COMMIT|ISSUE|FILE|TAG|URL>".yellow(),
52 examples_with_r = "<COMMIT|ISSUE|FILE|TAG>".yellow(),
53 repo_url = "<REPO_URL>".yellow(),
54 options_header = "OPTIONS".cyan().bold(),
55 opt_r = "-r, --repo".green(),
56 opt_fetch = " --fetch".green(),
57 what_header = "WHAT I DO".cyan().bold(),
58 bullet = "→",
59 examples_header = "EXAMPLES".cyan().bold(),
60 dim = "".dark_grey(),
61 dim2 = "".dark_grey(),
62 );
63}