refactor(prompt): rename CLI confirmer package to confirm
- commit
- 9725a6d912ca3a3cf8fcfc7771abffd5da6391fb
- author
- brice · · 2026-07-03 09:13 UTC
- parent
- 206ab7a
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
4 files · +8 -8
M internal/app/run.go +3 -3
| @@ -24,8 +24,8 @@ import ( | |||
| 24 | 24 | "github.com/bnema/vev/internal/adapters/term" | |
| 25 | 25 | "github.com/bnema/vev/internal/ports" | |
| 26 | 26 | "github.com/bnema/vev/internal/usecase/client" | |
| 27 | + | "github.com/bnema/vev/internal/usecase/confirm" | |
| 27 | 28 | "github.com/bnema/vev/internal/usecase/daemon" | |
| 28 | - | "github.com/bnema/vev/internal/usecase/prompt" | |
| 29 | 29 | ) | |
| 30 | 30 | ||
| 31 | 31 | // cmdKind identifies which sub-command the CLI parsed. | |
| @@ -254,14 +254,14 @@ func runAttach(ctx context.Context, intent uint8, name, remoteTarget string) err | |||
| 254 | 254 | } | |
| 255 | 255 | ||
| 256 | 256 | return runLocalAttachWithRecovery(ctx, intent, name, attachRecoveryDeps{ | |
| 257 | - | confirmer: prompt.NewConfirmer(os.Stdin, os.Stderr), | |
| 257 | + | confirmer: confirm.NewConfirmer(os.Stdin, os.Stderr), | |
| 258 | 258 | attach: attachLocalDaemon, | |
| 259 | 259 | killDaemon: requestDaemonStop, | |
| 260 | 260 | }) | |
| 261 | 261 | } | |
| 262 | 262 | ||
| 263 | 263 | type attachRecoveryDeps struct { | |
| 264 | - | confirmer prompt.Confirmer | |
| 264 | + | confirmer confirm.Confirmer | |
| 265 | 265 | attach func(context.Context, uint8, string) error | |
| 266 | 266 | killDaemon func(context.Context) error | |
| 267 | 267 | } | |
| @@ -24,8 +24,8 @@ import ( | |||||
| 24 | "github.com/bnema/vev/internal/adapters/term" | 24 | "github.com/bnema/vev/internal/adapters/term" | ||
| 25 | "github.com/bnema/vev/internal/ports" | 25 | "github.com/bnema/vev/internal/ports" | ||
| 26 | "github.com/bnema/vev/internal/usecase/client" | 26 | "github.com/bnema/vev/internal/usecase/client" | ||
| 27 | + | "github.com/bnema/vev/internal/usecase/confirm" | |||
| 27 | "github.com/bnema/vev/internal/usecase/daemon" | 28 | "github.com/bnema/vev/internal/usecase/daemon" | ||
| 28 | - | "github.com/bnema/vev/internal/usecase/prompt" | |||
| 29 | ) | 29 | ) | ||
| 30 | 30 | ||||
| 31 | // cmdKind identifies which sub-command the CLI parsed. | 31 | // cmdKind identifies which sub-command the CLI parsed. | ||
| @@ -254,14 +254,14 @@ func runAttach(ctx context.Context, intent uint8, name, remoteTarget string) err | |||||
| 254 | } | 254 | } | ||
| 255 | 255 | ||||
| 256 | return runLocalAttachWithRecovery(ctx, intent, name, attachRecoveryDeps{ | 256 | return runLocalAttachWithRecovery(ctx, intent, name, attachRecoveryDeps{ | ||
| 257 | - | confirmer: prompt.NewConfirmer(os.Stdin, os.Stderr), | 257 | + | confirmer: confirm.NewConfirmer(os.Stdin, os.Stderr), |
| 258 | attach: attachLocalDaemon, | 258 | attach: attachLocalDaemon, | ||
| 259 | killDaemon: requestDaemonStop, | 259 | killDaemon: requestDaemonStop, | ||
| 260 | }) | 260 | }) | ||
| 261 | } | 261 | } | ||
| 262 | 262 | ||||
| 263 | type attachRecoveryDeps struct { | 263 | type attachRecoveryDeps struct { | ||
| 264 | - | confirmer prompt.Confirmer | 264 | + | confirmer confirm.Confirmer |
| 265 | attach func(context.Context, uint8, string) error | 265 | attach func(context.Context, uint8, string) error | ||
| 266 | killDaemon func(context.Context) error | 266 | killDaemon func(context.Context) error | ||
| 267 | } | 267 | } | ||
M internal/app/run_test.go +3 -3
| @@ -9,7 +9,7 @@ import ( | |||
| 9 | 9 | ||
| 10 | 10 | "github.com/bnema/vev/internal/ports" | |
| 11 | 11 | "github.com/bnema/vev/internal/usecase/client" | |
| 12 | - | "github.com/bnema/vev/internal/usecase/prompt" | |
| 12 | + | "github.com/bnema/vev/internal/usecase/confirm" | |
| 13 | 13 | ) | |
| 14 | 14 | ||
| 15 | 15 | func TestParseArgs(t *testing.T) { | |
| @@ -103,7 +103,7 @@ func TestRunLocalAttachPromptsAndRestartsOnProtocolMismatch(t *testing.T) { | |||
| 103 | 103 | killCalls := 0 | |
| 104 | 104 | ||
| 105 | 105 | err := runLocalAttachWithRecovery(context.Background(), ports.IntentEphemeral, "", attachRecoveryDeps{ | |
| 106 | - | confirmer: prompt.NewConfirmer(answers, &prompts), | |
| 106 | + | confirmer: confirm.NewConfirmer(answers, &prompts), | |
| 107 | 107 | attach: func(context.Context, uint8, string) error { | |
| 108 | 108 | attachCalls++ | |
| 109 | 109 | if attachCalls == 1 { | |
| @@ -137,7 +137,7 @@ func TestRunLocalAttachDeclineKeepsOriginalError(t *testing.T) { | |||
| 137 | 137 | killCalls := 0 | |
| 138 | 138 | ||
| 139 | 139 | err := runLocalAttachWithRecovery(context.Background(), ports.IntentEphemeral, "", attachRecoveryDeps{ | |
| 140 | - | confirmer: prompt.NewConfirmer(answers, &bytes.Buffer{}), | |
| 140 | + | confirmer: confirm.NewConfirmer(answers, &bytes.Buffer{}), | |
| 141 | 141 | attach: func(context.Context, uint8, string) error { | |
| 142 | 142 | attachCalls++ | |
| 143 | 143 | return wantErr | |
| @@ -9,7 +9,7 @@ import ( | |||||
| 9 | 9 | ||||
| 10 | "github.com/bnema/vev/internal/ports" | 10 | "github.com/bnema/vev/internal/ports" | ||
| 11 | "github.com/bnema/vev/internal/usecase/client" | 11 | "github.com/bnema/vev/internal/usecase/client" | ||
| 12 | - | "github.com/bnema/vev/internal/usecase/prompt" | 12 | + | "github.com/bnema/vev/internal/usecase/confirm" |
| 13 | ) | 13 | ) | ||
| 14 | 14 | ||||
| 15 | func TestParseArgs(t *testing.T) { | 15 | func TestParseArgs(t *testing.T) { | ||
| @@ -103,7 +103,7 @@ func TestRunLocalAttachPromptsAndRestartsOnProtocolMismatch(t *testing.T) { | |||||
| 103 | killCalls := 0 | 103 | killCalls := 0 | ||
| 104 | 104 | ||||
| 105 | err := runLocalAttachWithRecovery(context.Background(), ports.IntentEphemeral, "", attachRecoveryDeps{ | 105 | err := runLocalAttachWithRecovery(context.Background(), ports.IntentEphemeral, "", attachRecoveryDeps{ | ||
| 106 | - | confirmer: prompt.NewConfirmer(answers, &prompts), | 106 | + | confirmer: confirm.NewConfirmer(answers, &prompts), |
| 107 | attach: func(context.Context, uint8, string) error { | 107 | attach: func(context.Context, uint8, string) error { | ||
| 108 | attachCalls++ | 108 | attachCalls++ | ||
| 109 | if attachCalls == 1 { | 109 | if attachCalls == 1 { | ||
| @@ -137,7 +137,7 @@ func TestRunLocalAttachDeclineKeepsOriginalError(t *testing.T) { | |||||
| 137 | killCalls := 0 | 137 | killCalls := 0 | ||
| 138 | 138 | ||||
| 139 | err := runLocalAttachWithRecovery(context.Background(), ports.IntentEphemeral, "", attachRecoveryDeps{ | 139 | err := runLocalAttachWithRecovery(context.Background(), ports.IntentEphemeral, "", attachRecoveryDeps{ | ||
| 140 | - | confirmer: prompt.NewConfirmer(answers, &bytes.Buffer{}), | 140 | + | confirmer: confirm.NewConfirmer(answers, &bytes.Buffer{}), |
| 141 | attach: func(context.Context, uint8, string) error { | 141 | attach: func(context.Context, uint8, string) error { | ||
| 142 | attachCalls++ | 142 | attachCalls++ | ||
| 143 | return wantErr | 143 | return wantErr | ||
R internal/usecase/prompt/confirm.go → internal/usecase/confirm/confirm.go +1 -1 renamed, 98% similar
| @@ -1,4 +1,4 @@ | |||
| 1 | - | package prompt | |
| 1 | + | package confirm | |
| 2 | 2 | ||
| 3 | 3 | import ( | |
| 4 | 4 | "bufio" | |
| @@ -1,4 +1,4 @@ | |||||
| 1 | - | package prompt | 1 | + | package confirm |
| 2 | 2 | ||||
| 3 | import ( | 3 | import ( | ||
| 4 | "bufio" | 4 | "bufio" | ||
R internal/usecase/prompt/confirm_test.go → internal/usecase/confirm/confirm_test.go +1 -1 renamed, 98% similar
| @@ -1,4 +1,4 @@ | |||
| 1 | - | package prompt | |
| 1 | + | package confirm | |
| 2 | 2 | ||
| 3 | 3 | import ( | |
| 4 | 4 | "bytes" | |
| @@ -1,4 +1,4 @@ | |||||
| 1 | - | package prompt | 1 | + | package confirm |
| 2 | 2 | ||||
| 3 | import ( | 3 | import ( | ||
| 4 | "bytes" | 4 | "bytes" | ||