Skip to content

Commit 521da05

Browse files
authored
Merge pull request #11147 from gitbutlerapp/sc-fix-but-help2
fix but help
2 parents fe1552d + 9f2063c commit 521da05

File tree

3 files changed

+106
-37
lines changed

3 files changed

+106
-37
lines changed

crates/but/src/args.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub struct Args {
2828
#[derive(Debug, clap::Subcommand)]
2929
pub enum Subcommands {
3030
/// Show commits on active branches in your workspace.
31+
#[clap(hide = true)]
3132
Log,
3233
/// Overview of the uncommitted changes in the repository.
3334
#[clap(alias = "st")]
@@ -154,6 +155,7 @@ For examples see `but rub --help`."
154155
message: Option<String>,
155156
},
156157
/// Starts up the MCP server.
158+
#[clap(hide = true)]
157159
Mcp {
158160
/// Starts the internal MCP server which has more granular tools.
159161
#[clap(long, short = 'i', hide = true)]
@@ -181,11 +183,13 @@ For examples see `but rub --help`."
181183
/// Command for creating and publishing code reviews to a forge.
182184
Review(forge::review::Platform),
183185
/// Generate shell completion scripts for the specified or inferred shell.
186+
#[clap(hide = true)]
184187
Completions {
185188
/// The shell to generate completions for, or the one extracted from the `SHELL` environment variable.
186189
#[clap(value_enum)]
187190
shell: Option<clap_complete::Shell>,
188191
},
192+
/// Automatically absorb uncomitted changes to an existing commit
189193
Absorb {
190194
/// If the CliID is an uncommitted change - the change will be absorbed
191195
/// If the CliID is a stack - anything assigned to the stack will be absorbed accordingly

crates/but/src/lib.rs

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,12 +494,19 @@ fn print_grouped_help() -> std::io::Result<()> {
494494

495495
// Define command groupings and their order (excluding MISC)
496496
let groups = [
497-
("Inspection".yellow(), vec!["status", "log"]),
497+
("Inspection".yellow(), vec!["status"]),
498498
(
499499
"Branching and Committing".yellow(),
500-
vec!["commit", "push", "new", "branch", "base", "mark", "unmark"],
500+
vec!["commit", "new", "branch", "base", "mark", "unmark"],
501+
),
502+
(
503+
"Server Interactions".yellow(),
504+
vec!["push", "review", "forge"],
505+
),
506+
(
507+
"Editing Commits".yellow(),
508+
vec!["rub", "describe", "absorb"],
501509
),
502-
("Editing Commits".yellow(), vec!["rub", "describe"]),
503510
(
504511
"Operation History".yellow(),
505512
vec!["oplog", "undo", "restore", "snapshot"],
@@ -515,6 +522,24 @@ fn print_grouped_help() -> std::io::Result<()> {
515522
writeln!(stdout, "Usage: but [OPTIONS] <COMMAND>")?;
516523
writeln!(stdout, " but [OPTIONS] [RUB-SOURCE] [RUB-TARGET]")?;
517524
writeln!(stdout)?;
525+
writeln!(
526+
stdout,
527+
"The GitButler CLI can be used to do nearly anything the desktop client can do (and more)."
528+
)?;
529+
writeln!(
530+
stdout,
531+
"It is a drop in replacement for most of the Git commands you would normally use, but Git"
532+
)?;
533+
writeln!(
534+
stdout,
535+
"commands (blame, log, etc) can also be used, as GitButler is fully Git compatible."
536+
)?;
537+
writeln!(stdout)?;
538+
writeln!(
539+
stdout,
540+
"Checkout the full docs here: https://docs.gitbutler.com/cli-overview"
541+
)?;
542+
writeln!(stdout)?;
518543

519544
// Keep track of which commands we've already printed
520545
let mut printed_commands = HashSet::new();
@@ -567,6 +592,24 @@ fn print_grouped_help() -> std::io::Result<()> {
567592
writeln!(stdout)?;
568593
}
569594

595+
// Add command completion instructions
596+
writeln!(
597+
stdout,
598+
"To add command completion, add this to your shell rc: (for example ~/.zshrc)"
599+
)?;
600+
writeln!(stdout, " eval \"$(but completions zsh)\"")?;
601+
writeln!(stdout)?;
602+
603+
writeln!(
604+
stdout,
605+
"To use the GitButler CLI with coding agents (Claude Code hooks, Cursor hooks, MCP), see:"
606+
)?;
607+
writeln!(
608+
stdout,
609+
" https://docs.gitbutler.com/features/ai-integration/ai-overview"
610+
)?;
611+
writeln!(stdout)?;
612+
570613
writeln!(stdout, "{}:", "Options".yellow())?;
571614
// Truncate long option descriptions if needed
572615
let option_descriptions = [

crates/but/tests/but/snapshots/no-arg.stdout.term.svg

Lines changed: 56 additions & 34 deletions
Loading

0 commit comments

Comments
 (0)