Skip to content

Commit e71ba4e

Browse files
authored
Merge pull request #11231 from gitbutlerapp/sc-but-branch-improvements
sc-but-branch-improvements
2 parents 36cc4e4 + 9e19cd8 commit e71ba4e

File tree

10 files changed

+2164
-72
lines changed

10 files changed

+2164
-72
lines changed

Cargo.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/but/Cargo.toml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,20 @@ gitbutler-command-context.workspace = true
5050
gitbutler-reference.workspace = true
5151
gitbutler-oplog.workspace = true
5252

53+
git2.workspace = true
54+
async-openai.workspace = true
5355
posthog-rs = { version = "0.3.7" }
5456
serde.workspace = true
5557
tokio = { workspace = true, features = ["rt-multi-thread", "io-std"] }
5658
strum = { version = "0.27", features = ["derive"] }
57-
clap = { workspace = true, features = ["env", "wrap_help", "color", "error-context", "usage", "suggestions" ] }
59+
clap = { workspace = true, features = [
60+
"env",
61+
"wrap_help",
62+
"color",
63+
"error-context",
64+
"usage",
65+
"suggestions",
66+
] }
5867
clap_complete = "4.5.60"
5968
chrono.workspace = true
6069
bstr.workspace = true
@@ -76,7 +85,12 @@ tracing-forest.workspace = true
7685
ratatui = "0.29.0"
7786
crossterm = "0.29.0"
7887
cli-prompts = "0.1.0"
79-
minus = { version = "5.6.1", default-features = false, features = ["static_output", "search"] }
88+
minus = { version = "5.6.1", default-features = false, features = [
89+
"static_output",
90+
"search",
91+
] }
92+
unicode-width = "0.1"
93+
term_size = "0.3"
8094

8195
[dev-dependencies]
8296
but-core = { workspace = true, features = ["testing"] }

crates/but/src/args.rs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,68 @@ For examples see `but rub --help`."
209209
},
210210
}
211211

212+
impl Subcommands {
213+
pub fn to_metrics_command(&self) -> CommandName {
214+
use CommandName::*;
215+
match self {
216+
Subcommands::Log => Log,
217+
Subcommands::Status { .. } => Status,
218+
Subcommands::Stf { .. } => Stf,
219+
Subcommands::Rub { .. } => Rub,
220+
Subcommands::Base(base::Platform { cmd }) => match cmd {
221+
base::Subcommands::Update => BaseUpdate,
222+
base::Subcommands::Check => BaseCheck,
223+
},
224+
Subcommands::Branch(branch::Platform { cmd }) => match cmd {
225+
None | Some(branch::Subcommands::List { .. }) => BranchList,
226+
Some(branch::Subcommands::New { .. }) => BranchNew,
227+
Some(branch::Subcommands::Delete { .. }) => BranchDelete,
228+
Some(branch::Subcommands::Unapply { .. }) => BranchUnapply,
229+
Some(branch::Subcommands::Apply { .. }) => BranchApply,
230+
Some(branch::Subcommands::Show { .. }) => BranchShow,
231+
},
232+
Subcommands::Worktree(crate::worktree::Platform { cmd: _ }) => Worktree,
233+
Subcommands::Mark { .. } => Mark,
234+
Subcommands::Unmark => Unmark,
235+
Subcommands::Gui => Gui,
236+
Subcommands::Commit { .. } => Commit,
237+
Subcommands::Push(_) => Push,
238+
Subcommands::New { .. } => New,
239+
Subcommands::Describe { .. } => Describe,
240+
Subcommands::Oplog { .. } => Oplog,
241+
Subcommands::Restore { .. } => Restore,
242+
Subcommands::Undo => Undo,
243+
Subcommands::Snapshot { .. } => Snapshot,
244+
Subcommands::Claude(claude::Platform { cmd }) => match cmd {
245+
claude::Subcommands::PreTool => ClaudePreTool,
246+
claude::Subcommands::PostTool => ClaudePostTool,
247+
claude::Subcommands::Stop => ClaudeStop,
248+
claude::Subcommands::Last { .. }
249+
| claude::Subcommands::PermissionPromptMcp { .. } => Unknown,
250+
},
251+
Subcommands::Cursor(cursor::Platform { cmd }) => match cmd {
252+
cursor::Subcommands::AfterEdit => CursorAfterEdit,
253+
cursor::Subcommands::Stop { .. } => CursorStop,
254+
},
255+
Subcommands::Forge(forge::integration::Platform { cmd }) => match cmd {
256+
forge::integration::Subcommands::Auth => ForgeAuth,
257+
forge::integration::Subcommands::Forget { .. } => ForgeForget,
258+
forge::integration::Subcommands::ListUsers => ForgeListUsers,
259+
},
260+
Subcommands::Review(forge::review::Platform { cmd }) => match cmd {
261+
forge::review::Subcommands::Publish { .. } => PublishReview,
262+
forge::review::Subcommands::Template { .. } => ReviewTemplate,
263+
},
264+
Subcommands::Completions { .. } => Completions,
265+
Subcommands::Absorb { .. } => Absorb,
266+
Subcommands::Metrics { .. }
267+
| Subcommands::Actions(_)
268+
| Subcommands::Mcp { .. }
269+
| Subcommands::Init { .. } => Unknown,
270+
}
271+
}
272+
}
273+
212274
#[derive(Debug, Clone, Copy, clap::ValueEnum, Default)]
213275
pub enum CommandName {
214276
Log,
@@ -231,6 +293,7 @@ pub enum CommandName {
231293
BranchNew,
232294
BranchDelete,
233295
BranchList,
296+
BranchShow,
234297
BranchUnapply,
235298
BranchApply,
236299
ClaudePreTool,

0 commit comments

Comments
 (0)