github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/pkg/modinstaller/install_opts.go (about)

     1  package modinstaller
     2  
     3  import (
     4  	"github.com/spf13/cobra"
     5  	"github.com/spf13/viper"
     6  	"github.com/turbot/steampipe/pkg/constants"
     7  	"github.com/turbot/steampipe/pkg/steampipeconfig/modconfig"
     8  )
     9  
    10  type InstallOpts struct {
    11  	WorkspaceMod *modconfig.Mod
    12  	Command      string
    13  	ModArgs      []string
    14  	DryRun       bool
    15  	Force        bool
    16  }
    17  
    18  func NewInstallOpts(workspaceMod *modconfig.Mod, modsToInstall ...string) *InstallOpts {
    19  	cmdName := viper.Get(constants.ConfigKeyActiveCommand).(*cobra.Command).Name()
    20  	opts := &InstallOpts{
    21  		WorkspaceMod: workspaceMod,
    22  		DryRun:       viper.GetBool(constants.ArgDryRun),
    23  		Force:        viper.GetBool(constants.ArgForce),
    24  		ModArgs:      modsToInstall,
    25  		Command:      cmdName,
    26  	}
    27  	return opts
    28  }