From 834962296e020256d58ed4a560ab3da1a68b63c9 Mon Sep 17 00:00:00 2001 From: crazydi4mond <255249920+crazydi4mond@users.noreply.github.com> Date: Tue, 27 Jan 2026 20:47:53 +0100 Subject: [PATCH] feat: expose uninstall menu in embedded mode - Add uninstall option to embedded mode menu (previously standalone-only) - Remove standaloneMode check for uninstall handling - Consolidate menu options to reduce duplication --- internal/menu/main.go | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/internal/menu/main.go b/internal/menu/main.go index 9bfa508..6cc3d07 100644 --- a/internal/menu/main.go +++ b/internal/menu/main.go @@ -80,25 +80,22 @@ func runMenuLoop(osInfo *osdetect.OSInfo, standaloneMode bool) error { } func buildMenuOptions(standaloneMode bool) []huh.Option[string] { - if standaloneMode { - return []huh.Option[string]{ - huh.NewOption("Create tunnel user", "create"), - huh.NewOption("Update tunnel user", "update"), - huh.NewOption("List tunnel users", "list"), - huh.NewOption("Delete tunnel user", "delete"), - huh.NewOption("Configure sshd hardening", "configure"), - huh.NewOption("Uninstall", "uninstall"), - huh.NewOption("Exit", "exit"), - } - } - return []huh.Option[string]{ + options := []huh.Option[string]{ huh.NewOption("Create tunnel user", "create"), huh.NewOption("Update tunnel user", "update"), huh.NewOption("List tunnel users", "list"), huh.NewOption("Delete tunnel user", "delete"), huh.NewOption("Configure sshd hardening", "configure"), - huh.NewOption("Back to main menu", "back"), + huh.NewOption("Uninstall", "uninstall"), + } + + if standaloneMode { + options = append(options, huh.NewOption("Exit", "exit")) + } else { + options = append(options, huh.NewOption("Back to main menu", "back")) } + + return options } func handleChoice(choice string, osInfo *osdetect.OSInfo, configured, standaloneMode bool) error { @@ -120,10 +117,7 @@ func handleChoice(choice string, osInfo *osdetect.OSInfo, configured, standalone case "configure": return configureInteractive(osInfo) case "uninstall": - if standaloneMode { - return uninstallInteractive() - } - return fmt.Errorf("invalid option") + return uninstallInteractive() } return nil }