refactor: remove helpers the new output and prompts left unused

Drop writeDownload, terminal.Require, terminal.Confirm, terminal.Row,
terminal.Record and Pulls.FindOpenByHead, which no command calls anymore,
and point their tests at the code that replaced them.

Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
bircni committed 2026-10-12 10:00:05 +02:00
1 parent eff6efe759
commit 50a604f169
8 files changed
+34 -118

No files matched your search

+3 -3
View File
@@ -56,12 +56,12 @@ func TestPromptPolicy(t *testing.T) {
}
prompt := &fakePrompt{}
value := "supplied"
asked, err := Require(context.Background(), &value, "title", Streams{}, Policy{}, prompt)
asked, err := RequireInput(context.Background(), &value, "title", "title", nil, Streams{}, Policy{}, prompt)
require.NoError(t, err)
require.False(t, asked)
require.Zero(t, prompt.inputs)
value = ""
_, err = Require(context.Background(), &value, "title", Streams{}, Policy{}, prompt)
_, err = RequireInput(context.Background(), &value, "title", "title", nil, Streams{}, Policy{}, prompt)
require.ErrorContains(t, err, "--title")
}
@@ -141,7 +141,7 @@ func TestConfirmActionPassesTheDefault(t *testing.T) {
prompt := &askingPrompt{accept: true}
streams := Streams{InTTY: true, ErrTTY: true}
require.NoError(t, ConfirmAction(context.Background(), Confirmation{Prompt: "Create pull request?", DefaultYes: true}, false, streams, Policy{Enabled: true}, prompt))
require.NoError(t, Confirm(context.Background(), "Delete branch?", false, streams, Policy{Enabled: true}, prompt))
require.NoError(t, ConfirmAction(context.Background(), Confirmation{Prompt: "Delete branch?"}, false, streams, Policy{Enabled: true}, prompt))
require.Equal(t, []bool{true, false}, prompt.defaults)
require.Equal(t, []string{"Create pull request?", "Delete branch?"}, prompt.titles)
}