mirror of
https://github.com/mudler/luet.git
synced 2025-09-03 08:14:46 +00:00
Define context for scoped operation across core types
It holds necessary state plus additional information relative to the context which we are being run to (e.g. if we are in a terminal or not). Besides in the future we can use it also as a contextual logger to provide more smart logging capabilities. This also replace the general global configuration instance that previously was share between the core components.
This commit is contained in:
@@ -18,8 +18,7 @@ package backend
|
||||
import (
|
||||
"os/exec"
|
||||
|
||||
"github.com/mudler/luet/pkg/config"
|
||||
. "github.com/mudler/luet/pkg/logger"
|
||||
"github.com/mudler/luet/pkg/api/core/types"
|
||||
|
||||
"github.com/google/go-containerregistry/pkg/crane"
|
||||
"github.com/pkg/errors"
|
||||
@@ -44,17 +43,17 @@ type Options struct {
|
||||
BackendArgs []string
|
||||
}
|
||||
|
||||
func runCommand(cmd *exec.Cmd) error {
|
||||
func runCommand(ctx *types.Context, cmd *exec.Cmd) error {
|
||||
output := ""
|
||||
buffered := !config.LuetCfg.GetGeneral().ShowBuildOutput
|
||||
writer := NewBackendWriter(buffered)
|
||||
buffered := !ctx.Config.GetGeneral().ShowBuildOutput
|
||||
writer := NewBackendWriter(buffered, ctx)
|
||||
|
||||
cmd.Stdout = writer
|
||||
cmd.Stderr = writer
|
||||
|
||||
if buffered {
|
||||
Spinner(32)
|
||||
defer SpinnerStop()
|
||||
ctx.Spinner()
|
||||
defer ctx.SpinnerStop()
|
||||
}
|
||||
|
||||
err := cmd.Start()
|
||||
|
Reference in New Issue
Block a user