chore(cli): avoid app shadow lint warnings
- commit
- f7c186f1184000ff001c11f7b8d9ee7c189ca865
- author
- brice · · 2026-06-25 12:02 UTC
- parent
- 89e934d
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +48 -48
M internal/cli/cmd/sessions.go +33 -33
| @@ -39,29 +39,29 @@ func init() { | |||
| 39 | 39 | } | |
| 40 | 40 | ||
| 41 | 41 | func runSessions(_ *cobra.Command, _ []string) error { | |
| 42 | - | app := GetApp() | |
| 43 | - | if app == nil { | |
| 42 | + | cliApp := GetApp() | |
| 43 | + | if cliApp == nil { | |
| 44 | 44 | return fmt.Errorf("app not initialized") | |
| 45 | 45 | } | |
| 46 | 46 | ||
| 47 | - | if app.ListSessionsUC == nil { | |
| 47 | + | if cliApp.ListSessionsUC == nil { | |
| 48 | 48 | return fmt.Errorf("session management not available") | |
| 49 | 49 | } | |
| 50 | 50 | ||
| 51 | 51 | // Get current session ID (empty if not running as browser) | |
| 52 | 52 | var currentSessionID entity.SessionID | |
| 53 | - | if active, err := app.SessionUC.GetActiveSession(app.Ctx()); err == nil && active != nil { | |
| 53 | + | if active, err := cliApp.SessionUC.GetActiveSession(cliApp.Ctx()); err == nil && active != nil { | |
| 54 | 54 | currentSessionID = active.ID | |
| 55 | 55 | } | |
| 56 | 56 | ||
| 57 | 57 | // Run interactive TUI | |
| 58 | - | m := model.NewSessionsModel(app.Ctx(), app.Theme, model.SessionsModelConfig{ | |
| 59 | - | ListSessionsUC: app.ListSessionsUC, | |
| 60 | - | RestoreUC: app.RestoreUC, | |
| 61 | - | DeleteSessionUC: app.DeleteSessionUC, | |
| 62 | - | SessionSpawner: app.SessionSpawner, | |
| 58 | + | m := model.NewSessionsModel(cliApp.Ctx(), cliApp.Theme, model.SessionsModelConfig{ | |
| 59 | + | ListSessionsUC: cliApp.ListSessionsUC, | |
| 60 | + | RestoreUC: cliApp.RestoreUC, | |
| 61 | + | DeleteSessionUC: cliApp.DeleteSessionUC, | |
| 62 | + | SessionSpawner: cliApp.SessionSpawner, | |
| 63 | 63 | CurrentSession: currentSessionID, | |
| 64 | - | MaxExitedSessions: app.Config.Session.MaxExitedSessions, | |
| 64 | + | MaxExitedSessions: cliApp.Config.Session.MaxExitedSessions, | |
| 65 | 65 | }) | |
| 66 | 66 | ||
| 67 | 67 | p := tea.NewProgram(m, tea.WithAltScreen()) | |
| @@ -89,13 +89,13 @@ func init() { | |||
| 89 | 89 | } | |
| 90 | 90 | ||
| 91 | 91 | func runSessionsList(_ *cobra.Command, _ []string) error { | |
| 92 | - | app := GetApp() | |
| 93 | - | if app == nil { | |
| 92 | + | cliApp := GetApp() | |
| 93 | + | if cliApp == nil { | |
| 94 | 94 | return fmt.Errorf("app not initialized") | |
| 95 | 95 | } | |
| 96 | - | renderer := styles.NewSessionsCLIRenderer(app.Theme) | |
| 96 | + | renderer := styles.NewSessionsCLIRenderer(cliApp.Theme) | |
| 97 | 97 | ||
| 98 | - | if app.ListSessionsUC == nil { | |
| 98 | + | if cliApp.ListSessionsUC == nil { | |
| 99 | 99 | err := fmt.Errorf("session management not available") | |
| 100 | 100 | fmt.Fprintln(os.Stderr, renderer.RenderError(err)) | |
| 101 | 101 | return wrapPrintedError(err) | |
| @@ -103,11 +103,11 @@ func runSessionsList(_ *cobra.Command, _ []string) error { | |||
| 103 | 103 | ||
| 104 | 104 | // Get current session ID (empty if not running as browser) | |
| 105 | 105 | var currentSessionID entity.SessionID | |
| 106 | - | if active, err := app.SessionUC.GetActiveSession(app.Ctx()); err == nil && active != nil { | |
| 106 | + | if active, err := cliApp.SessionUC.GetActiveSession(cliApp.Ctx()); err == nil && active != nil { | |
| 107 | 107 | currentSessionID = active.ID | |
| 108 | 108 | } | |
| 109 | 109 | ||
| 110 | - | output, err := app.ListSessionsUC.Execute(app.Ctx(), currentSessionID, sessionsLimit) | |
| 110 | + | output, err := cliApp.ListSessionsUC.Execute(cliApp.Ctx(), currentSessionID, sessionsLimit) | |
| 111 | 111 | if err != nil { | |
| 112 | 112 | wrappedErr := fmt.Errorf("list sessions: %w", err) | |
| 113 | 113 | fmt.Fprintln(os.Stderr, renderer.RenderError(wrappedErr)) | |
| @@ -151,13 +151,13 @@ func init() { | |||
| 151 | 151 | } | |
| 152 | 152 | ||
| 153 | 153 | func runSessionsRestore(_ *cobra.Command, args []string) error { | |
| 154 | - | app := GetApp() | |
| 155 | - | if app == nil { | |
| 154 | + | cliApp := GetApp() | |
| 155 | + | if cliApp == nil { | |
| 156 | 156 | return fmt.Errorf("app not initialized") | |
| 157 | 157 | } | |
| 158 | - | renderer := styles.NewSessionsCLIRenderer(app.Theme) | |
| 158 | + | renderer := styles.NewSessionsCLIRenderer(cliApp.Theme) | |
| 159 | 159 | ||
| 160 | - | if app.RestoreUC == nil || app.ListSessionsUC == nil { | |
| 160 | + | if cliApp.RestoreUC == nil || cliApp.ListSessionsUC == nil { | |
| 161 | 161 | err := fmt.Errorf("session restoration not available") | |
| 162 | 162 | fmt.Fprintln(os.Stderr, renderer.RenderError(err)) | |
| 163 | 163 | return wrapPrintedError(err) | |
| @@ -173,7 +173,7 @@ func runSessionsRestore(_ *cobra.Command, args []string) error { | |||
| 173 | 173 | sessionID := sessionInfo.Session.ID | |
| 174 | 174 | ||
| 175 | 175 | // Validate the session has restorable state | |
| 176 | - | _, err = app.RestoreUC.Execute(app.Ctx(), usecase.RestoreInput{SessionID: sessionID}) | |
| 176 | + | _, err = cliApp.RestoreUC.Execute(cliApp.Ctx(), usecase.RestoreInput{SessionID: sessionID}) | |
| 177 | 177 | if err != nil { | |
| 178 | 178 | wrappedErr := fmt.Errorf("restore session: %w", err) | |
| 179 | 179 | fmt.Fprintln(os.Stderr, renderer.RenderError(wrappedErr)) | |
| @@ -181,12 +181,12 @@ func runSessionsRestore(_ *cobra.Command, args []string) error { | |||
| 181 | 181 | } | |
| 182 | 182 | ||
| 183 | 183 | // Spawn a new dumber instance with the session | |
| 184 | - | if app.SessionSpawner == nil { | |
| 184 | + | if cliApp.SessionSpawner == nil { | |
| 185 | 185 | err := fmt.Errorf("session spawner not available") | |
| 186 | 186 | fmt.Fprintln(os.Stderr, renderer.RenderError(err)) | |
| 187 | 187 | return wrapPrintedError(err) | |
| 188 | 188 | } | |
| 189 | - | if err := app.SessionSpawner.SpawnWithSession(sessionID); err != nil { | |
| 189 | + | if err := cliApp.SessionSpawner.SpawnWithSession(sessionID); err != nil { | |
| 190 | 190 | wrappedErr := fmt.Errorf("spawn browser: %w", err) | |
| 191 | 191 | fmt.Fprintln(os.Stderr, renderer.RenderError(wrappedErr)) | |
| 192 | 192 | return wrapPrintedError(wrappedErr) | |
| @@ -219,13 +219,13 @@ func init() { | |||
| 219 | 219 | } | |
| 220 | 220 | ||
| 221 | 221 | func runSessionsDelete(_ *cobra.Command, args []string) error { | |
| 222 | - | app := GetApp() | |
| 223 | - | if app == nil { | |
| 222 | + | cliApp := GetApp() | |
| 223 | + | if cliApp == nil { | |
| 224 | 224 | return fmt.Errorf("app not initialized") | |
| 225 | 225 | } | |
| 226 | - | renderer := styles.NewSessionsCLIRenderer(app.Theme) | |
| 226 | + | renderer := styles.NewSessionsCLIRenderer(cliApp.Theme) | |
| 227 | 227 | ||
| 228 | - | if app.DeleteSessionUC == nil || app.ListSessionsUC == nil { | |
| 228 | + | if cliApp.DeleteSessionUC == nil || cliApp.ListSessionsUC == nil { | |
| 229 | 229 | err := fmt.Errorf("session management not available") | |
| 230 | 230 | fmt.Fprintln(os.Stderr, renderer.RenderError(err)) | |
| 231 | 231 | return wrapPrintedError(err) | |
| @@ -240,12 +240,12 @@ func runSessionsDelete(_ *cobra.Command, args []string) error { | |||
| 240 | 240 | ||
| 241 | 241 | // Get current session ID | |
| 242 | 242 | var currentSessionID entity.SessionID | |
| 243 | - | if active, activeErr := app.SessionUC.GetActiveSession(app.Ctx()); activeErr == nil && active != nil { | |
| 243 | + | if active, activeErr := cliApp.SessionUC.GetActiveSession(cliApp.Ctx()); activeErr == nil && active != nil { | |
| 244 | 244 | currentSessionID = active.ID | |
| 245 | 245 | } | |
| 246 | 246 | ||
| 247 | 247 | // Delete using use case (handles validation internally) | |
| 248 | - | if err := app.DeleteSessionUC.Execute(app.Ctx(), usecase.DeleteSessionInput{ | |
| 248 | + | if err := cliApp.DeleteSessionUC.Execute(cliApp.Ctx(), usecase.DeleteSessionInput{ | |
| 249 | 249 | SessionID: sessionInfo.Session.ID, | |
| 250 | 250 | CurrentSessionID: currentSessionID, | |
| 251 | 251 | }); err != nil { | |
| @@ -261,19 +261,19 @@ func runSessionsDelete(_ *cobra.Command, args []string) error { | |||
| 261 | 261 | // findSessionByIDOrSuffix finds a session by exact ID or unique suffix. | |
| 262 | 262 | // Users typically identify sessions by the last few characters (e.g., "dee5"). | |
| 263 | 263 | func findSessionByIDOrSuffix(idOrSuffix string) (*entity.SessionInfo, error) { | |
| 264 | - | app := GetApp() | |
| 265 | - | if app == nil || app.ListSessionsUC == nil { | |
| 264 | + | cliApp := GetApp() | |
| 265 | + | if cliApp == nil || cliApp.ListSessionsUC == nil { | |
| 266 | 266 | return nil, fmt.Errorf("app not initialized") | |
| 267 | 267 | } | |
| 268 | 268 | ||
| 269 | 269 | // Get current session ID (empty if not running as browser) | |
| 270 | 270 | var currentSessionID entity.SessionID | |
| 271 | - | if active, err := app.SessionUC.GetActiveSession(app.Ctx()); err == nil && active != nil { | |
| 271 | + | if active, err := cliApp.SessionUC.GetActiveSession(cliApp.Ctx()); err == nil && active != nil { | |
| 272 | 272 | currentSessionID = active.ID | |
| 273 | 273 | } | |
| 274 | 274 | ||
| 275 | 275 | // List all sessions | |
| 276 | - | output, err := app.ListSessionsUC.Execute(app.Ctx(), currentSessionID, defaultSessionsLimit*5) | |
| 276 | + | output, err := cliApp.ListSessionsUC.Execute(cliApp.Ctx(), currentSessionID, defaultSessionsLimit*5) | |
| 277 | 277 | if err != nil { | |
| 278 | 278 | return nil, fmt.Errorf("list sessions: %w", err) | |
| 279 | 279 | } | |
| @@ -39,29 +39,29 @@ func init() { | |||||
| 39 | } | 39 | } | ||
| 40 | 40 | ||||
| 41 | func runSessions(_ *cobra.Command, _ []string) error { | 41 | func runSessions(_ *cobra.Command, _ []string) error { | ||
| 42 | - | app := GetApp() | 42 | + | cliApp := GetApp() |
| 43 | - | if app == nil { | 43 | + | if cliApp == nil { |
| 44 | return fmt.Errorf("app not initialized") | 44 | return fmt.Errorf("app not initialized") | ||
| 45 | } | 45 | } | ||
| 46 | 46 | ||||
| 47 | - | if app.ListSessionsUC == nil { | 47 | + | if cliApp.ListSessionsUC == nil { |
| 48 | return fmt.Errorf("session management not available") | 48 | return fmt.Errorf("session management not available") | ||
| 49 | } | 49 | } | ||
| 50 | 50 | ||||
| 51 | // Get current session ID (empty if not running as browser) | 51 | // Get current session ID (empty if not running as browser) | ||
| 52 | var currentSessionID entity.SessionID | 52 | var currentSessionID entity.SessionID | ||
| 53 | - | if active, err := app.SessionUC.GetActiveSession(app.Ctx()); err == nil && active != nil { | 53 | + | if active, err := cliApp.SessionUC.GetActiveSession(cliApp.Ctx()); err == nil && active != nil { |
| 54 | currentSessionID = active.ID | 54 | currentSessionID = active.ID | ||
| 55 | } | 55 | } | ||
| 56 | 56 | ||||
| 57 | // Run interactive TUI | 57 | // Run interactive TUI | ||
| 58 | - | m := model.NewSessionsModel(app.Ctx(), app.Theme, model.SessionsModelConfig{ | 58 | + | m := model.NewSessionsModel(cliApp.Ctx(), cliApp.Theme, model.SessionsModelConfig{ |
| 59 | - | ListSessionsUC: app.ListSessionsUC, | 59 | + | ListSessionsUC: cliApp.ListSessionsUC, |
| 60 | - | RestoreUC: app.RestoreUC, | 60 | + | RestoreUC: cliApp.RestoreUC, |
| 61 | - | DeleteSessionUC: app.DeleteSessionUC, | 61 | + | DeleteSessionUC: cliApp.DeleteSessionUC, |
| 62 | - | SessionSpawner: app.SessionSpawner, | 62 | + | SessionSpawner: cliApp.SessionSpawner, |
| 63 | CurrentSession: currentSessionID, | 63 | CurrentSession: currentSessionID, | ||
| 64 | - | MaxExitedSessions: app.Config.Session.MaxExitedSessions, | 64 | + | MaxExitedSessions: cliApp.Config.Session.MaxExitedSessions, |
| 65 | }) | 65 | }) | ||
| 66 | 66 | ||||
| 67 | p := tea.NewProgram(m, tea.WithAltScreen()) | 67 | p := tea.NewProgram(m, tea.WithAltScreen()) | ||
| @@ -89,13 +89,13 @@ func init() { | |||||
| 89 | } | 89 | } | ||
| 90 | 90 | ||||
| 91 | func runSessionsList(_ *cobra.Command, _ []string) error { | 91 | func runSessionsList(_ *cobra.Command, _ []string) error { | ||
| 92 | - | app := GetApp() | 92 | + | cliApp := GetApp() |
| 93 | - | if app == nil { | 93 | + | if cliApp == nil { |
| 94 | return fmt.Errorf("app not initialized") | 94 | return fmt.Errorf("app not initialized") | ||
| 95 | } | 95 | } | ||
| 96 | - | renderer := styles.NewSessionsCLIRenderer(app.Theme) | 96 | + | renderer := styles.NewSessionsCLIRenderer(cliApp.Theme) |
| 97 | 97 | ||||
| 98 | - | if app.ListSessionsUC == nil { | 98 | + | if cliApp.ListSessionsUC == nil { |
| 99 | err := fmt.Errorf("session management not available") | 99 | err := fmt.Errorf("session management not available") | ||
| 100 | fmt.Fprintln(os.Stderr, renderer.RenderError(err)) | 100 | fmt.Fprintln(os.Stderr, renderer.RenderError(err)) | ||
| 101 | return wrapPrintedError(err) | 101 | return wrapPrintedError(err) | ||
| @@ -103,11 +103,11 @@ func runSessionsList(_ *cobra.Command, _ []string) error { | |||||
| 103 | 103 | ||||
| 104 | // Get current session ID (empty if not running as browser) | 104 | // Get current session ID (empty if not running as browser) | ||
| 105 | var currentSessionID entity.SessionID | 105 | var currentSessionID entity.SessionID | ||
| 106 | - | if active, err := app.SessionUC.GetActiveSession(app.Ctx()); err == nil && active != nil { | 106 | + | if active, err := cliApp.SessionUC.GetActiveSession(cliApp.Ctx()); err == nil && active != nil { |
| 107 | currentSessionID = active.ID | 107 | currentSessionID = active.ID | ||
| 108 | } | 108 | } | ||
| 109 | 109 | ||||
| 110 | - | output, err := app.ListSessionsUC.Execute(app.Ctx(), currentSessionID, sessionsLimit) | 110 | + | output, err := cliApp.ListSessionsUC.Execute(cliApp.Ctx(), currentSessionID, sessionsLimit) |
| 111 | if err != nil { | 111 | if err != nil { | ||
| 112 | wrappedErr := fmt.Errorf("list sessions: %w", err) | 112 | wrappedErr := fmt.Errorf("list sessions: %w", err) | ||
| 113 | fmt.Fprintln(os.Stderr, renderer.RenderError(wrappedErr)) | 113 | fmt.Fprintln(os.Stderr, renderer.RenderError(wrappedErr)) | ||
| @@ -151,13 +151,13 @@ func init() { | |||||
| 151 | } | 151 | } | ||
| 152 | 152 | ||||
| 153 | func runSessionsRestore(_ *cobra.Command, args []string) error { | 153 | func runSessionsRestore(_ *cobra.Command, args []string) error { | ||
| 154 | - | app := GetApp() | 154 | + | cliApp := GetApp() |
| 155 | - | if app == nil { | 155 | + | if cliApp == nil { |
| 156 | return fmt.Errorf("app not initialized") | 156 | return fmt.Errorf("app not initialized") | ||
| 157 | } | 157 | } | ||
| 158 | - | renderer := styles.NewSessionsCLIRenderer(app.Theme) | 158 | + | renderer := styles.NewSessionsCLIRenderer(cliApp.Theme) |
| 159 | 159 | ||||
| 160 | - | if app.RestoreUC == nil || app.ListSessionsUC == nil { | 160 | + | if cliApp.RestoreUC == nil || cliApp.ListSessionsUC == nil { |
| 161 | err := fmt.Errorf("session restoration not available") | 161 | err := fmt.Errorf("session restoration not available") | ||
| 162 | fmt.Fprintln(os.Stderr, renderer.RenderError(err)) | 162 | fmt.Fprintln(os.Stderr, renderer.RenderError(err)) | ||
| 163 | return wrapPrintedError(err) | 163 | return wrapPrintedError(err) | ||
| @@ -173,7 +173,7 @@ func runSessionsRestore(_ *cobra.Command, args []string) error { | |||||
| 173 | sessionID := sessionInfo.Session.ID | 173 | sessionID := sessionInfo.Session.ID | ||
| 174 | 174 | ||||
| 175 | // Validate the session has restorable state | 175 | // Validate the session has restorable state | ||
| 176 | - | _, err = app.RestoreUC.Execute(app.Ctx(), usecase.RestoreInput{SessionID: sessionID}) | 176 | + | _, err = cliApp.RestoreUC.Execute(cliApp.Ctx(), usecase.RestoreInput{SessionID: sessionID}) |
| 177 | if err != nil { | 177 | if err != nil { | ||
| 178 | wrappedErr := fmt.Errorf("restore session: %w", err) | 178 | wrappedErr := fmt.Errorf("restore session: %w", err) | ||
| 179 | fmt.Fprintln(os.Stderr, renderer.RenderError(wrappedErr)) | 179 | fmt.Fprintln(os.Stderr, renderer.RenderError(wrappedErr)) | ||
| @@ -181,12 +181,12 @@ func runSessionsRestore(_ *cobra.Command, args []string) error { | |||||
| 181 | } | 181 | } | ||
| 182 | 182 | ||||
| 183 | // Spawn a new dumber instance with the session | 183 | // Spawn a new dumber instance with the session | ||
| 184 | - | if app.SessionSpawner == nil { | 184 | + | if cliApp.SessionSpawner == nil { |
| 185 | err := fmt.Errorf("session spawner not available") | 185 | err := fmt.Errorf("session spawner not available") | ||
| 186 | fmt.Fprintln(os.Stderr, renderer.RenderError(err)) | 186 | fmt.Fprintln(os.Stderr, renderer.RenderError(err)) | ||
| 187 | return wrapPrintedError(err) | 187 | return wrapPrintedError(err) | ||
| 188 | } | 188 | } | ||
| 189 | - | if err := app.SessionSpawner.SpawnWithSession(sessionID); err != nil { | 189 | + | if err := cliApp.SessionSpawner.SpawnWithSession(sessionID); err != nil { |
| 190 | wrappedErr := fmt.Errorf("spawn browser: %w", err) | 190 | wrappedErr := fmt.Errorf("spawn browser: %w", err) | ||
| 191 | fmt.Fprintln(os.Stderr, renderer.RenderError(wrappedErr)) | 191 | fmt.Fprintln(os.Stderr, renderer.RenderError(wrappedErr)) | ||
| 192 | return wrapPrintedError(wrappedErr) | 192 | return wrapPrintedError(wrappedErr) | ||
| @@ -219,13 +219,13 @@ func init() { | |||||
| 219 | } | 219 | } | ||
| 220 | 220 | ||||
| 221 | func runSessionsDelete(_ *cobra.Command, args []string) error { | 221 | func runSessionsDelete(_ *cobra.Command, args []string) error { | ||
| 222 | - | app := GetApp() | 222 | + | cliApp := GetApp() |
| 223 | - | if app == nil { | 223 | + | if cliApp == nil { |
| 224 | return fmt.Errorf("app not initialized") | 224 | return fmt.Errorf("app not initialized") | ||
| 225 | } | 225 | } | ||
| 226 | - | renderer := styles.NewSessionsCLIRenderer(app.Theme) | 226 | + | renderer := styles.NewSessionsCLIRenderer(cliApp.Theme) |
| 227 | 227 | ||||
| 228 | - | if app.DeleteSessionUC == nil || app.ListSessionsUC == nil { | 228 | + | if cliApp.DeleteSessionUC == nil || cliApp.ListSessionsUC == nil { |
| 229 | err := fmt.Errorf("session management not available") | 229 | err := fmt.Errorf("session management not available") | ||
| 230 | fmt.Fprintln(os.Stderr, renderer.RenderError(err)) | 230 | fmt.Fprintln(os.Stderr, renderer.RenderError(err)) | ||
| 231 | return wrapPrintedError(err) | 231 | return wrapPrintedError(err) | ||
| @@ -240,12 +240,12 @@ func runSessionsDelete(_ *cobra.Command, args []string) error { | |||||
| 240 | 240 | ||||
| 241 | // Get current session ID | 241 | // Get current session ID | ||
| 242 | var currentSessionID entity.SessionID | 242 | var currentSessionID entity.SessionID | ||
| 243 | - | if active, activeErr := app.SessionUC.GetActiveSession(app.Ctx()); activeErr == nil && active != nil { | 243 | + | if active, activeErr := cliApp.SessionUC.GetActiveSession(cliApp.Ctx()); activeErr == nil && active != nil { |
| 244 | currentSessionID = active.ID | 244 | currentSessionID = active.ID | ||
| 245 | } | 245 | } | ||
| 246 | 246 | ||||
| 247 | // Delete using use case (handles validation internally) | 247 | // Delete using use case (handles validation internally) | ||
| 248 | - | if err := app.DeleteSessionUC.Execute(app.Ctx(), usecase.DeleteSessionInput{ | 248 | + | if err := cliApp.DeleteSessionUC.Execute(cliApp.Ctx(), usecase.DeleteSessionInput{ |
| 249 | SessionID: sessionInfo.Session.ID, | 249 | SessionID: sessionInfo.Session.ID, | ||
| 250 | CurrentSessionID: currentSessionID, | 250 | CurrentSessionID: currentSessionID, | ||
| 251 | }); err != nil { | 251 | }); err != nil { | ||
| @@ -261,19 +261,19 @@ func runSessionsDelete(_ *cobra.Command, args []string) error { | |||||
| 261 | // findSessionByIDOrSuffix finds a session by exact ID or unique suffix. | 261 | // findSessionByIDOrSuffix finds a session by exact ID or unique suffix. | ||
| 262 | // Users typically identify sessions by the last few characters (e.g., "dee5"). | 262 | // Users typically identify sessions by the last few characters (e.g., "dee5"). | ||
| 263 | func findSessionByIDOrSuffix(idOrSuffix string) (*entity.SessionInfo, error) { | 263 | func findSessionByIDOrSuffix(idOrSuffix string) (*entity.SessionInfo, error) { | ||
| 264 | - | app := GetApp() | 264 | + | cliApp := GetApp() |
| 265 | - | if app == nil || app.ListSessionsUC == nil { | 265 | + | if cliApp == nil || cliApp.ListSessionsUC == nil { |
| 266 | return nil, fmt.Errorf("app not initialized") | 266 | return nil, fmt.Errorf("app not initialized") | ||
| 267 | } | 267 | } | ||
| 268 | 268 | ||||
| 269 | // Get current session ID (empty if not running as browser) | 269 | // Get current session ID (empty if not running as browser) | ||
| 270 | var currentSessionID entity.SessionID | 270 | var currentSessionID entity.SessionID | ||
| 271 | - | if active, err := app.SessionUC.GetActiveSession(app.Ctx()); err == nil && active != nil { | 271 | + | if active, err := cliApp.SessionUC.GetActiveSession(cliApp.Ctx()); err == nil && active != nil { |
| 272 | currentSessionID = active.ID | 272 | currentSessionID = active.ID | ||
| 273 | } | 273 | } | ||
| 274 | 274 | ||||
| 275 | // List all sessions | 275 | // List all sessions | ||
| 276 | - | output, err := app.ListSessionsUC.Execute(app.Ctx(), currentSessionID, defaultSessionsLimit*5) | 276 | + | output, err := cliApp.ListSessionsUC.Execute(cliApp.Ctx(), currentSessionID, defaultSessionsLimit*5) |
| 277 | if err != nil { | 277 | if err != nil { | ||
| 278 | return nil, fmt.Errorf("list sessions: %w", err) | 278 | return nil, fmt.Errorf("list sessions: %w", err) | ||
| 279 | } | 279 | } | ||
M internal/cli/cmd/setup.go +8 -8
| @@ -57,12 +57,12 @@ func init() { | |||
| 57 | 57 | } | |
| 58 | 58 | ||
| 59 | 59 | func runSetupInstall(_ *cobra.Command, _ []string) error { | |
| 60 | - | app := GetApp() | |
| 61 | - | if app == nil { | |
| 60 | + | cliApp := GetApp() | |
| 61 | + | if cliApp == nil { | |
| 62 | 62 | return fmt.Errorf("app not initialized") | |
| 63 | 63 | } | |
| 64 | 64 | ||
| 65 | - | theme := app.Theme | |
| 65 | + | theme := cliApp.Theme | |
| 66 | 66 | ||
| 67 | 67 | // Check if installed via package manager | |
| 68 | 68 | switch { | |
| @@ -87,7 +87,7 @@ func runSetupInstall(_ *cobra.Command, _ []string) error { | |||
| 87 | 87 | IconData: assets.LogoSVG, | |
| 88 | 88 | } | |
| 89 | 89 | ||
| 90 | - | result, err := uc.Execute(app.Ctx(), input) | |
| 90 | + | result, err := uc.Execute(cliApp.Ctx(), input) | |
| 91 | 91 | if err != nil { | |
| 92 | 92 | fmt.Printf("%s %s\n", theme.ErrorStyle.Render("\u2717"), err.Error()) | |
| 93 | 93 | return err | |
| @@ -124,16 +124,16 @@ func runSetupInstall(_ *cobra.Command, _ []string) error { | |||
| 124 | 124 | } | |
| 125 | 125 | ||
| 126 | 126 | func runSetupDefault(_ *cobra.Command, _ []string) error { | |
| 127 | - | app := GetApp() | |
| 128 | - | if app == nil { | |
| 127 | + | cliApp := GetApp() | |
| 128 | + | if cliApp == nil { | |
| 129 | 129 | return fmt.Errorf("app not initialized") | |
| 130 | 130 | } | |
| 131 | 131 | ||
| 132 | - | theme := app.Theme | |
| 132 | + | theme := cliApp.Theme | |
| 133 | 133 | adapter := desktop.New() | |
| 134 | 134 | uc := usecase.NewSetDefaultBrowserUseCase(adapter) | |
| 135 | 135 | ||
| 136 | - | result, err := uc.Execute(app.Ctx()) | |
| 136 | + | result, err := uc.Execute(cliApp.Ctx()) | |
| 137 | 137 | if err != nil { | |
| 138 | 138 | errMsg := err.Error() | |
| 139 | 139 | fmt.Printf("%s %s\n", theme.ErrorStyle.Render("\u2717"), errMsg) | |
| @@ -57,12 +57,12 @@ func init() { | |||||
| 57 | } | 57 | } | ||
| 58 | 58 | ||||
| 59 | func runSetupInstall(_ *cobra.Command, _ []string) error { | 59 | func runSetupInstall(_ *cobra.Command, _ []string) error { | ||
| 60 | - | app := GetApp() | 60 | + | cliApp := GetApp() |
| 61 | - | if app == nil { | 61 | + | if cliApp == nil { |
| 62 | return fmt.Errorf("app not initialized") | 62 | return fmt.Errorf("app not initialized") | ||
| 63 | } | 63 | } | ||
| 64 | 64 | ||||
| 65 | - | theme := app.Theme | 65 | + | theme := cliApp.Theme |
| 66 | 66 | ||||
| 67 | // Check if installed via package manager | 67 | // Check if installed via package manager | ||
| 68 | switch { | 68 | switch { | ||
| @@ -87,7 +87,7 @@ func runSetupInstall(_ *cobra.Command, _ []string) error { | |||||
| 87 | IconData: assets.LogoSVG, | 87 | IconData: assets.LogoSVG, | ||
| 88 | } | 88 | } | ||
| 89 | 89 | ||||
| 90 | - | result, err := uc.Execute(app.Ctx(), input) | 90 | + | result, err := uc.Execute(cliApp.Ctx(), input) |
| 91 | if err != nil { | 91 | if err != nil { | ||
| 92 | fmt.Printf("%s %s\n", theme.ErrorStyle.Render("\u2717"), err.Error()) | 92 | fmt.Printf("%s %s\n", theme.ErrorStyle.Render("\u2717"), err.Error()) | ||
| 93 | return err | 93 | return err | ||
| @@ -124,16 +124,16 @@ func runSetupInstall(_ *cobra.Command, _ []string) error { | |||||
| 124 | } | 124 | } | ||
| 125 | 125 | ||||
| 126 | func runSetupDefault(_ *cobra.Command, _ []string) error { | 126 | func runSetupDefault(_ *cobra.Command, _ []string) error { | ||
| 127 | - | app := GetApp() | 127 | + | cliApp := GetApp() |
| 128 | - | if app == nil { | 128 | + | if cliApp == nil { |
| 129 | return fmt.Errorf("app not initialized") | 129 | return fmt.Errorf("app not initialized") | ||
| 130 | } | 130 | } | ||
| 131 | 131 | ||||
| 132 | - | theme := app.Theme | 132 | + | theme := cliApp.Theme |
| 133 | adapter := desktop.New() | 133 | adapter := desktop.New() | ||
| 134 | uc := usecase.NewSetDefaultBrowserUseCase(adapter) | 134 | uc := usecase.NewSetDefaultBrowserUseCase(adapter) | ||
| 135 | 135 | ||||
| 136 | - | result, err := uc.Execute(app.Ctx()) | 136 | + | result, err := uc.Execute(cliApp.Ctx()) |
| 137 | if err != nil { | 137 | if err != nil { | ||
| 138 | errMsg := err.Error() | 138 | errMsg := err.Error() | ||
| 139 | fmt.Printf("%s %s\n", theme.ErrorStyle.Render("\u2717"), errMsg) | 139 | fmt.Printf("%s %s\n", theme.ErrorStyle.Render("\u2717"), errMsg) | ||
M internal/cli/cmd/update.go +7 -7
| @@ -203,12 +203,12 @@ func (updateModel) checkForUpdates() tea.Cmd { | |||
| 203 | 203 | return checkResultMsg{err: fmt.Errorf("failed to create applier: %w", err)} | |
| 204 | 204 | } | |
| 205 | 205 | ||
| 206 | - | app := GetApp() | |
| 207 | - | if app == nil { | |
| 206 | + | cliApp := GetApp() | |
| 207 | + | if cliApp == nil { | |
| 208 | 208 | return checkResultMsg{err: fmt.Errorf("app not initialized")} | |
| 209 | 209 | } | |
| 210 | 210 | ||
| 211 | - | checkUC := usecase.NewCheckUpdateUseCase(checker, applier, app.BuildInfo) | |
| 211 | + | checkUC := usecase.NewCheckUpdateUseCase(checker, applier, cliApp.BuildInfo) | |
| 212 | 212 | result, err := checkUC.Execute(ctx, usecase.CheckUpdateInput{}) | |
| 213 | 213 | ||
| 214 | 214 | return checkResultMsg{output: result, err: err} | |
| @@ -240,15 +240,15 @@ func (m updateModel) downloadUpdate() tea.Cmd { | |||
| 240 | 240 | } | |
| 241 | 241 | ||
| 242 | 242 | func runUpdate(_ *cobra.Command, _ []string) error { | |
| 243 | - | app := GetApp() | |
| 244 | - | if app == nil { | |
| 243 | + | cliApp := GetApp() | |
| 244 | + | if cliApp == nil { | |
| 245 | 245 | return fmt.Errorf("app not initialized") | |
| 246 | 246 | } | |
| 247 | 247 | ||
| 248 | - | renderer := styles.NewUpdateRenderer(app.Theme) | |
| 248 | + | renderer := styles.NewUpdateRenderer(cliApp.Theme) | |
| 249 | 249 | ||
| 250 | 250 | // Create and run the bubbletea program. | |
| 251 | - | m := newUpdateModel(renderer, app.Theme.Accent, updateForce) | |
| 251 | + | m := newUpdateModel(renderer, cliApp.Theme.Accent, updateForce) | |
| 252 | 252 | p := tea.NewProgram(m) | |
| 253 | 253 | ||
| 254 | 254 | finalModel, err := p.Run() | |
| @@ -203,12 +203,12 @@ func (updateModel) checkForUpdates() tea.Cmd { | |||||
| 203 | return checkResultMsg{err: fmt.Errorf("failed to create applier: %w", err)} | 203 | return checkResultMsg{err: fmt.Errorf("failed to create applier: %w", err)} | ||
| 204 | } | 204 | } | ||
| 205 | 205 | ||||
| 206 | - | app := GetApp() | 206 | + | cliApp := GetApp() |
| 207 | - | if app == nil { | 207 | + | if cliApp == nil { |
| 208 | return checkResultMsg{err: fmt.Errorf("app not initialized")} | 208 | return checkResultMsg{err: fmt.Errorf("app not initialized")} | ||
| 209 | } | 209 | } | ||
| 210 | 210 | ||||
| 211 | - | checkUC := usecase.NewCheckUpdateUseCase(checker, applier, app.BuildInfo) | 211 | + | checkUC := usecase.NewCheckUpdateUseCase(checker, applier, cliApp.BuildInfo) |
| 212 | result, err := checkUC.Execute(ctx, usecase.CheckUpdateInput{}) | 212 | result, err := checkUC.Execute(ctx, usecase.CheckUpdateInput{}) | ||
| 213 | 213 | ||||
| 214 | return checkResultMsg{output: result, err: err} | 214 | return checkResultMsg{output: result, err: err} | ||
| @@ -240,15 +240,15 @@ func (m updateModel) downloadUpdate() tea.Cmd { | |||||
| 240 | } | 240 | } | ||
| 241 | 241 | ||||
| 242 | func runUpdate(_ *cobra.Command, _ []string) error { | 242 | func runUpdate(_ *cobra.Command, _ []string) error { | ||
| 243 | - | app := GetApp() | 243 | + | cliApp := GetApp() |
| 244 | - | if app == nil { | 244 | + | if cliApp == nil { |
| 245 | return fmt.Errorf("app not initialized") | 245 | return fmt.Errorf("app not initialized") | ||
| 246 | } | 246 | } | ||
| 247 | 247 | ||||
| 248 | - | renderer := styles.NewUpdateRenderer(app.Theme) | 248 | + | renderer := styles.NewUpdateRenderer(cliApp.Theme) |
| 249 | 249 | ||||
| 250 | // Create and run the bubbletea program. | 250 | // Create and run the bubbletea program. | ||
| 251 | - | m := newUpdateModel(renderer, app.Theme.Accent, updateForce) | 251 | + | m := newUpdateModel(renderer, cliApp.Theme.Accent, updateForce) |
| 252 | p := tea.NewProgram(m) | 252 | p := tea.NewProgram(m) | ||
| 253 | 253 | ||||
| 254 | finalModel, err := p.Run() | 254 | finalModel, err := p.Run() | ||