Skip to content

Commit

Permalink
cli: Inject the OS StepWriter to the installer
Browse files Browse the repository at this point in the history
  • Loading branch information
livingsilver94 committed Nov 24, 2023
1 parent b2ee447 commit 3c5723c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion cli/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"strings"

"github.com/livingsilver94/backee/installer"
"github.com/livingsilver94/backee/installer/stepwriter"
"github.com/livingsilver94/backee/repo"
"github.com/livingsilver94/backee/repo/solver"
"github.com/livingsilver94/backee/service"
Expand Down Expand Up @@ -110,7 +111,7 @@ func (in *install) installer(rep repo.FS, fileList **os.File) installer.Installe
installer.WithVarSolvers(map[service.VarKind]repo.VarSolver{"keepassxc": kee}),
)
}
return installer.New(rep, opts...)
return installer.New(rep, stepwriter.OS{}, opts...)
}

// envVars returns a map of environment variables.
Expand Down
2 changes: 1 addition & 1 deletion cli/privilege.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package cli
import (
"os"

_ "github.com/livingsilver94/backee/installer"
_ "github.com/livingsilver94/backee/installer/stepwriter"
priv "github.com/livingsilver94/backee/privilege"
)

Expand Down
9 changes: 5 additions & 4 deletions installer/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@ import (

type Installer struct {
repository repo.Repo
variables repo.Variables
list List
writer StepWriter

variables repo.Variables
list List
}

func New(repository repo.Repo, options ...Option) Installer {
func New(repository repo.Repo, sw StepWriter, options ...Option) Installer {
i := Installer{
repository: repository,
writer: sw,
variables: repo.NewVariables(),
list: NewList(),
writer: nil, // TODO: pass a real writer.
}
i.variables.RegisterSolver(service.Datadir, solver.NewDatadir(repository))
for _, option := range options {
Expand Down

0 comments on commit 3c5723c

Please sign in to comment.