From 14bdd6096924b072705dec1ba4a575bfeefce47a Mon Sep 17 00:00:00 2001 From: Joshua Herring Date: Thu, 14 May 2026 02:25:38 -0400 Subject: [PATCH] replace if-else chaining with switch --- main.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 8c0e5d4..6f1c50c 100644 --- a/main.go +++ b/main.go @@ -134,7 +134,8 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { if msg.String() == "enter" { m.choice = m.list.Index() m.state = stateForm - if m.choice == 0 { + switch m.choice { + case 0: m.form = huh.NewForm( huh.NewGroup( huh.NewInput().Title("Remote Command").Key("remote_command").Value(&m.RemoteCommand), @@ -143,7 +144,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { huh.NewInput().Title("Host").Key("host").Value(&m.Host), ), ) - } else if m.choice == 1 { + case 1: m.form = huh.NewForm( huh.NewGroup( huh.NewInput().Title("Local Filepath").Key("local_filepath").Value(&m.LocalFilepath), @@ -153,7 +154,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { huh.NewInput().Title("Host").Key("host").Value(&m.Host), ), ) - } else { + default: m.form = huh.NewForm( huh.NewGroup( huh.NewInput().Title("Cloudflare API Token").Key("cloudflare_api_token").Value(&m.CloudflareAPIToken),