Skip to main content

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