From ecca01d0c7db8f014b3eead2cc9b16df5134c60b Mon Sep 17 00:00:00 2001 From: ibrahim dursun Date: Tue, 25 Feb 2025 09:30:16 +0000 Subject: [PATCH] feat(rebase): support `--insert-before` fixes #18 --- internal/ui/operations/rebase/rebase_operation.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/ui/operations/rebase/rebase_operation.go b/internal/ui/operations/rebase/rebase_operation.go index 55236dc..2f09c20 100644 --- a/internal/ui/operations/rebase/rebase_operation.go +++ b/internal/ui/operations/rebase/rebase_operation.go @@ -33,6 +33,7 @@ var ( } targetToFlags = map[Target]string{ TargetAfter: "--insert-after", + TargetBefore: "--insert-before", TargetDestination: "--destination", } ) @@ -47,10 +48,11 @@ type Operation struct { var ( Revision = key.NewBinding(key.WithKeys("r"), key.WithHelp("r", "change source to revision")) - Branch = key.NewBinding(key.WithKeys("b"), key.WithHelp("b", "change source to branch")) + Branch = key.NewBinding(key.WithKeys("B"), key.WithHelp("B", "change source to branch")) SourceKey = key.NewBinding(key.WithKeys("s"), key.WithHelp("s", "change source to descendants")) Destination = key.NewBinding(key.WithKeys("d"), key.WithHelp("d", "change target to destination")) After = key.NewBinding(key.WithKeys("a"), key.WithHelp("a", "change target to after")) + Before = key.NewBinding(key.WithKeys("b"), key.WithHelp("b", "change target to before")) Apply = key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "apply")) Cancel = key.NewBinding(key.WithKeys("esc"), key.WithHelp("esc", "cancel")) ) @@ -67,6 +69,8 @@ func (r *Operation) HandleKey(msg tea.KeyMsg) tea.Cmd { r.Target = TargetDestination case key.Matches(msg, After): r.Target = TargetAfter + case key.Matches(msg, Before): + r.Target = TargetBefore case key.Matches(msg, Apply): source := sourceToFlags[r.Source] target := targetToFlags[r.Target] @@ -88,6 +92,7 @@ func (r *Operation) ShortHelp() []key.Binding { SourceKey, Destination, After, + Before, } }