X Tutup
Skip to content

Commit 47eef41

Browse files
committed
more iostreams passing
1 parent 893fe09 commit 47eef41

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

pkg/cmd/pr/view/view.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package view
33
import (
44
"errors"
55
"fmt"
6-
"io"
76
"net/http"
87
"sort"
98
"strings"
@@ -112,11 +111,13 @@ func viewRun(opts *ViewOptions) error {
112111
return printHumanPrPreview(opts.IO, pr)
113112
}
114113

115-
cs := opts.IO.ColorScheme()
116-
return printRawPrPreview(opts.IO.Out, cs, pr)
114+
return printRawPrPreview(opts.IO, pr)
117115
}
118116

119-
func printRawPrPreview(out io.Writer, cs *iostreams.ColorScheme, pr *api.PullRequest) error {
117+
func printRawPrPreview(io *iostreams.IOStreams, pr *api.PullRequest) error {
118+
out := io.Out
119+
cs := io.ColorScheme()
120+
120121
reviewers := prReviewerList(*pr, cs)
121122
assignees := prAssigneeList(*pr)
122123
labels := prLabelList(*pr)

pkg/cmd/repo/garden/garden.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bytes"
55
"errors"
66
"fmt"
7-
"io"
87
"math/rand"
98
"net/http"
109
"os"
@@ -214,7 +213,7 @@ func gardenRun(opts *GardenOptions) error {
214213
geo.Width = 0
215214
}
216215
clear(opts.IO)
217-
drawGarden(cs, out, garden, player)
216+
drawGarden(opts.IO, garden, player)
218217

219218
// thanks stackoverflow https://stackoverflow.com/a/17278776
220219
_ = exec.Command("stty", sttyFileArg, "/dev/tty", "cbreak", "min", "1").Run()
@@ -424,7 +423,10 @@ func plantGarden(commits []*Commit, geo *Geometry) [][]*Cell {
424423
return garden
425424
}
426425

427-
func drawGarden(cs *iostreams.ColorScheme, out io.Writer, garden [][]*Cell, player *Player) {
426+
func drawGarden(io *iostreams.IOStreams, garden [][]*Cell, player *Player) {
427+
out := io.Out
428+
cs := io.ColorScheme()
429+
428430
fmt.Fprint(out, "\033[?25l") // hide cursor. it needs to be restored at command exit.
429431
sl := ""
430432
for y, gardenRow := range garden {

0 commit comments

Comments
 (0)
X Tutup