From 9ab7f12bf4985bea677a81b2272c375415210471 Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Wed, 13 May 2026 18:20:33 +0200 Subject: [PATCH] gofmt Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com> --- internal/config/config.go | 4 ++-- internal/config/keybindings.go | 4 ++-- internal/intercept/broker.go | 6 +++--- internal/keys/global.go | 4 ++-- internal/ui/diff/model.go | 8 ++++---- internal/ui/intercept/model.go | 27 +++++++++++++-------------- internal/ui/intercept/update.go | 2 +- internal/ui/plugins/view.go | 2 +- 8 files changed, 28 insertions(+), 29 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index 8dc2e32..f41b0a2 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -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 { diff --git a/internal/config/keybindings.go b/internal/config/keybindings.go index de05aea..41849de 100644 --- a/internal/config/keybindings.go +++ b/internal/config/keybindings.go @@ -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"` diff --git a/internal/intercept/broker.go b/internal/intercept/broker.go index 755f384..a5076a6 100644 --- a/internal/intercept/broker.go +++ b/internal/intercept/broker.go @@ -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 { diff --git a/internal/keys/global.go b/internal/keys/global.go index b7ce6f0..b6ad90e 100644 --- a/internal/keys/global.go +++ b/internal/keys/global.go @@ -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"), diff --git a/internal/ui/diff/model.go b/internal/ui/diff/model.go index 4b2e54a..cdfa55e 100644 --- a/internal/ui/diff/model.go +++ b/internal/ui/diff/model.go @@ -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-- } diff --git a/internal/ui/intercept/model.go b/internal/ui/intercept/model.go index 4d75466..a1fd6fb 100644 --- a/internal/ui/intercept/model.go +++ b/internal/ui/intercept/model.go @@ -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() } - diff --git a/internal/ui/intercept/update.go b/internal/ui/intercept/update.go index 990039d..5141509 100644 --- a/internal/ui/intercept/update.go +++ b/internal/ui/intercept/update.go @@ -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) { diff --git a/internal/ui/plugins/view.go b/internal/ui/plugins/view.go index 364cf54..fd74a1b 100644 --- a/internal/ui/plugins/view.go +++ b/internal/ui/plugins/view.go @@ -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"