mirror of
https://github.com/anotherhadi/spilltea.git
synced 2026-05-20 01:32:33 +02:00
gofmt
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
@@ -35,8 +35,8 @@ type Config struct {
|
||||
|
||||
Intercept struct {
|
||||
DefaultInterceptEnabled bool `mapstructure:"default_intercept_enabled"`
|
||||
DefaultCaptureResponse bool `mapstructure:"default_capture_response"`
|
||||
AutoForwardRegex []string `mapstructure:"auto_forward_regex"`
|
||||
DefaultCaptureResponse bool `mapstructure:"default_capture_response"`
|
||||
AutoForwardRegex []string `mapstructure:"auto_forward_regex"`
|
||||
} `mapstructure:"intercept"`
|
||||
|
||||
Replay struct {
|
||||
|
||||
@@ -10,8 +10,8 @@ type GlobalKeys struct {
|
||||
Left string `mapstructure:"left"`
|
||||
Right string `mapstructure:"right"`
|
||||
CycleFocus string `mapstructure:"cycle_focus"`
|
||||
CopyAs string `mapstructure:"copy_as"`
|
||||
Copy string `mapstructure:"copy"`
|
||||
CopyAs string `mapstructure:"copy_as"`
|
||||
Copy string `mapstructure:"copy"`
|
||||
SendToReplay string `mapstructure:"send_to_replay"`
|
||||
ScrollUp string `mapstructure:"scroll_up"`
|
||||
ScrollDown string `mapstructure:"scroll_down"`
|
||||
|
||||
@@ -14,9 +14,9 @@ import (
|
||||
type Decision int
|
||||
|
||||
const (
|
||||
Forward Decision = iota // forward without showing in intercept
|
||||
Drop // drop the flow
|
||||
Intercept // pass to the TUI for user decision
|
||||
Forward Decision = iota // forward without showing in intercept
|
||||
Drop // drop the flow
|
||||
Intercept // pass to the TUI for user decision
|
||||
)
|
||||
|
||||
type PendingRequest struct {
|
||||
|
||||
@@ -15,7 +15,7 @@ type GlobalKeyMap struct {
|
||||
Left key.Binding
|
||||
Right key.Binding
|
||||
CycleFocus key.Binding
|
||||
CopyAs key.Binding
|
||||
CopyAs key.Binding
|
||||
Copy key.Binding
|
||||
Escape key.Binding
|
||||
SendToReplay key.Binding
|
||||
@@ -35,7 +35,7 @@ func newGlobalKeyMap(cfg config.GlobalKeys) GlobalKeyMap {
|
||||
Left: binding(cfg.Left, "scroll left"),
|
||||
Right: binding(cfg.Right, "scroll right"),
|
||||
CycleFocus: binding(cfg.CycleFocus, "cycle focus"),
|
||||
CopyAs: binding(cfg.CopyAs, "copy as..."),
|
||||
CopyAs: binding(cfg.CopyAs, "copy as..."),
|
||||
Copy: binding(cfg.Copy, "copy..."),
|
||||
Escape: key.NewBinding(key.WithKeys("esc"), key.WithHelp("esc", "cancel")),
|
||||
SendToReplay: binding(cfg.SendToReplay, "send to replay"),
|
||||
|
||||
@@ -221,16 +221,16 @@ func lcsAlignedDiff(a, b, aHL, bHL []string) (left, right []diffLine) {
|
||||
for i > 0 || j > 0 {
|
||||
switch {
|
||||
case i > 0 && j > 0 && a[i-1] == b[j-1]:
|
||||
left = append(left, diffLine{text: hlA(i-1), kind: lineUnchanged})
|
||||
right = append(right, diffLine{text: hlB(j-1), kind: lineUnchanged})
|
||||
left = append(left, diffLine{text: hlA(i - 1), kind: lineUnchanged})
|
||||
right = append(right, diffLine{text: hlB(j - 1), kind: lineUnchanged})
|
||||
i--
|
||||
j--
|
||||
case j > 0 && (i == 0 || dp[i][j-1] >= dp[i-1][j]):
|
||||
left = append(left, diffLine{kind: lineAdded})
|
||||
right = append(right, diffLine{text: hlB(j-1), kind: lineAdded})
|
||||
right = append(right, diffLine{text: hlB(j - 1), kind: lineAdded})
|
||||
j--
|
||||
default:
|
||||
left = append(left, diffLine{text: hlA(i-1), kind: lineRemoved})
|
||||
left = append(left, diffLine{text: hlA(i - 1), kind: lineRemoved})
|
||||
right = append(right, diffLine{kind: lineRemoved})
|
||||
i--
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
type panel int
|
||||
|
||||
const (
|
||||
panelRequests panel = iota
|
||||
panelRequests panel = iota
|
||||
panelResponses
|
||||
)
|
||||
|
||||
@@ -28,8 +28,8 @@ type Model struct {
|
||||
responseQueue []*intercept.PendingResponse
|
||||
responseCursor int
|
||||
|
||||
editing bool
|
||||
interceptEnabled bool
|
||||
editing bool
|
||||
interceptEnabled bool
|
||||
pendingEdits map[*intercept.PendingRequest]string
|
||||
pendingResponseEdits map[*intercept.PendingResponse]string
|
||||
|
||||
@@ -37,9 +37,9 @@ type Model struct {
|
||||
responseViewport viewport.Model
|
||||
bodyViewport viewport.Model
|
||||
textarea textarea.Model
|
||||
pager paginator.Model
|
||||
responsePager paginator.Model
|
||||
help help.Model
|
||||
pager paginator.Model
|
||||
responsePager paginator.Model
|
||||
help help.Model
|
||||
|
||||
width int
|
||||
height int
|
||||
@@ -59,13 +59,13 @@ func New(broker *intercept.Broker) Model {
|
||||
broker.SetCaptureResponse(cfg.Intercept.DefaultCaptureResponse)
|
||||
|
||||
return Model{
|
||||
broker: broker,
|
||||
interceptEnabled: cfg.Intercept.DefaultInterceptEnabled,
|
||||
captureResponse: cfg.Intercept.DefaultCaptureResponse,
|
||||
listViewport: lv,
|
||||
responseViewport: rv,
|
||||
bodyViewport: bv,
|
||||
textarea: ta,
|
||||
broker: broker,
|
||||
interceptEnabled: cfg.Intercept.DefaultInterceptEnabled,
|
||||
captureResponse: cfg.Intercept.DefaultCaptureResponse,
|
||||
listViewport: lv,
|
||||
responseViewport: rv,
|
||||
bodyViewport: bv,
|
||||
textarea: ta,
|
||||
pager: p,
|
||||
responsePager: rp,
|
||||
help: newHelp(),
|
||||
@@ -115,4 +115,3 @@ func (m *Model) SetSize(w, h int) {
|
||||
m.height = h
|
||||
m.recalcSizes()
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
tea "charm.land/bubbletea/v2"
|
||||
"github.com/anotherhadi/spilltea/internal/intercept"
|
||||
"github.com/anotherhadi/spilltea/internal/keys"
|
||||
"github.com/anotherhadi/spilltea/internal/util"
|
||||
diffUI "github.com/anotherhadi/spilltea/internal/ui/diff"
|
||||
replayUI "github.com/anotherhadi/spilltea/internal/ui/replay"
|
||||
"github.com/anotherhadi/spilltea/internal/util"
|
||||
)
|
||||
|
||||
func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"charm.land/glamour/v2"
|
||||
tea "charm.land/bubbletea/v2"
|
||||
"charm.land/glamour/v2"
|
||||
"charm.land/lipgloss/v2"
|
||||
"github.com/anotherhadi/spilltea/internal/config"
|
||||
"github.com/anotherhadi/spilltea/internal/icons"
|
||||
|
||||
Reference in New Issue
Block a user