Files
steampipe/pkg/modinstaller/install_opts.go
Puskar Basu 3bdd2eedde Improve error message when running steampipe check/dashboard outside a mod and refactor default mod creation. Closes #3215
Rationalise default mod creation 
Fix nil ref exception for mod commands when using legacy `requires` block

---------

Co-authored-by: kai <kai@turbot.com>
2023-04-20 12:02:50 +01:00

29 lines
731 B
Go

package modinstaller
import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/turbot/steampipe/pkg/constants"
"github.com/turbot/steampipe/pkg/steampipeconfig/modconfig"
)
type InstallOpts struct {
WorkspaceMod *modconfig.Mod
Command string
ModArgs []string
DryRun bool
Force bool
}
func NewInstallOpts(workspaceMod *modconfig.Mod, modsToInstall ...string) *InstallOpts {
cmdName := viper.Get(constants.ConfigKeyActiveCommand).(*cobra.Command).Name()
opts := &InstallOpts{
WorkspaceMod: workspaceMod,
DryRun: viper.GetBool(constants.ArgDryRun),
Force: viper.GetBool(constants.ArgForce),
ModArgs: modsToInstall,
Command: cmdName,
}
return opts
}