Newer
Older
import (
"os"
"fmt"
"orus.io/cloudcrane/beaver/runner"
)
DryRun bool `short:"d" long:"dry-run" description:"if set only prints commands but do not run them"`
}
PositionnalArgs struct {
Namespace string `required:"yes" positional-arg-name:"namespace"`
} `positional-args:"yes"`
}
// NewBuildCmd ...
func NewBuildCmd() *BuildCmd {
cmd := BuildCmd{}
return &cmd
}
// Execute ...
func (cmd *BuildCmd) Execute([]string) error {
Logger.Info().Str("namespace", cmd.PositionnalArgs.Namespace).Msg("starting beaver")
tmpDir, err := os.MkdirTemp(os.TempDir(), "beaver-")
if err != nil {
return fmt.Errorf("failed to create temp dir: %w", err)
}
config := runner.NewCmdConfig(Logger, ".", cmd.PositionnalArgs.Namespace, cmd.Args.DryRun)
if err := config.Initialize(tmpDir); err != nil {
Logger.Err(err).Msg("failed to prepare config")
}
r := runner.NewRunner(config)