mirror of
https://github.com/turbot/steampipe.git
synced 2026-05-11 00:02:37 -04:00
Rationalise default mod creation Fix nil ref exception for mod commands when using legacy `requires` block --------- Co-authored-by: kai <kai@turbot.com>
29 lines
731 B
Go
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
|
|
}
|