Skip to content

Commit 9dffc05

Browse files
committed
refactor: interface in consumer side
1 parent 2ca1238 commit 9dffc05

3 files changed

Lines changed: 8 additions & 9 deletions

File tree

internal/tooling/git/git.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ import (
66
"strings"
77
)
88

9-
// Provider abstracts git operations for testability.
10-
type Provider interface {
11-
BranchStatus(ctx context.Context, dir string) (branch string, dirty bool, err error)
12-
}
13-
149
// ExecProvider is the real implementation that shells out to git.
1510
type ExecProvider struct{}
1611

internal/tooling/render/renderer.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
// StatusLine writes a formatted statusline to a writer.
1515
type StatusLine struct {
1616
out io.Writer
17-
git git.Provider
17+
git provider
1818
options Options
1919
}
2020

@@ -25,7 +25,12 @@ type Options struct {
2525
WithUsageStats bool
2626
}
2727

28-
func newRenderer(out io.Writer, g git.Provider, opts Options) *StatusLine {
28+
// provider abstracts git operations for testability.
29+
type provider interface {
30+
BranchStatus(ctx context.Context, dir string) (branch string, dirty bool, err error)
31+
}
32+
33+
func newRenderer(out io.Writer, g provider, opts Options) *StatusLine {
2934
return &StatusLine{out: out, git: g, options: opts}
3035
}
3136

internal/tooling/render/renderer_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"strings"
88
"testing"
99

10-
"github.com/jgfranco17/delphi-cli/internal/tooling/git"
1110
"github.com/jgfranco17/delphi-cli/internal/tooling/model"
1211
"github.com/stretchr/testify/assert"
1312
"github.com/stretchr/testify/require"
@@ -23,7 +22,7 @@ func (m *mockGitProvider) BranchStatus(_ context.Context, _ string) (string, boo
2322
return m.branch, m.dirty, m.err
2423
}
2524

26-
var _ git.Provider = (*mockGitProvider)(nil)
25+
var _ provider = (*mockGitProvider)(nil)
2726

2827
func newTestInput() *model.AgentInput {
2928
return &model.AgentInput{

0 commit comments

Comments
 (0)