Skip to content

Commit

Permalink
feat(rebase): support --insert-before
Browse files Browse the repository at this point in the history
fixes #18
  • Loading branch information
idursun committed Feb 25, 2025
1 parent 929b44c commit ecca01d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/ui/operations/rebase/rebase_operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ var (
}
targetToFlags = map[Target]string{
TargetAfter: "--insert-after",
TargetBefore: "--insert-before",
TargetDestination: "--destination",
}
)
Expand All @@ -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"))
)
Expand All @@ -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]
Expand All @@ -88,6 +92,7 @@ func (r *Operation) ShortHelp() []key.Binding {
SourceKey,
Destination,
After,
Before,
}
}

Expand Down

0 comments on commit ecca01d

Please sign in to comment.