diff --git a/cmd/command/run.go b/cmd/command/run.go index 0890004..91da106 100644 --- a/cmd/command/run.go +++ b/cmd/command/run.go @@ -40,6 +40,8 @@ func NewRunCommand(config *specs.SshComposeConfig) *cobra.Command { var envs []string var renderEnvs []string var varsFiles []string + var enabledGroups []string + var disabledGroups []string var cmd = &cobra.Command{ Use: "run ", @@ -115,6 +117,9 @@ func NewRunCommand(config *specs.SshComposeConfig) *cobra.Command { " on project " + pname) } + command.SetDisableGroups(disabledGroups) + command.SetEnableGroups(enabledGroups) + err = ApplyCommand(command, composer, env.GetProjectByName(pname), envs, varsFiles, @@ -128,6 +133,10 @@ func NewRunCommand(config *specs.SshComposeConfig) *cobra.Command { } var flags = cmd.Flags() + flags.StringSliceVar(&disabledGroups, "disable-group", []string{}, + "Skip selected group from deploy.") + flags.StringSliceVar(&enabledGroups, "enable-group", []string{}, + "Apply only selected groups.") flags.StringArrayVar(&renderEnvs, "render-env", []string{}, "Append render engine environments in the format key=value.") flags.StringArrayVar(&envs, "env", []string{}, diff --git a/pkg/specs/command.go b/pkg/specs/command.go index 0e2bf74..e078099 100644 --- a/pkg/specs/command.go +++ b/pkg/specs/command.go @@ -10,17 +10,19 @@ import ( "gopkg.in/yaml.v3" ) -func (c *SshCCommand) GetName() string { return c.Name } -func (c *SshCCommand) GetDescription() string { return c.Description } -func (c *SshCCommand) GetProject() string { return c.Project } -func (c *SshCCommand) GetEnvs() SshCEnvVars { return c.Envs } -func (c *SshCCommand) GetEnableFlags() []string { return c.EnableFlags } -func (c *SshCCommand) GetDisableFlags() []string { return c.DisableFlags } -func (c *SshCCommand) GetEnableGroups() []string { return c.EnableGroups } -func (c *SshCCommand) GetDisableGroups() []string { return c.DisableFlags } -func (c *SshCCommand) GetVarFiles() []string { return c.VarFiles } -func (c *SshCCommand) GetSkipSync() bool { return c.SkipSync } -func (c *SshCCommand) GetDestroy() bool { return c.Destroy } +func (c *SshCCommand) GetName() string { return c.Name } +func (c *SshCCommand) GetDescription() string { return c.Description } +func (c *SshCCommand) GetProject() string { return c.Project } +func (c *SshCCommand) GetEnvs() SshCEnvVars { return c.Envs } +func (c *SshCCommand) GetEnableFlags() []string { return c.EnableFlags } +func (c *SshCCommand) GetDisableFlags() []string { return c.DisableFlags } +func (c *SshCCommand) GetEnableGroups() []string { return c.EnableGroups } +func (c *SshCCommand) GetDisableGroups() []string { return c.DisableFlags } +func (c *SshCCommand) GetVarFiles() []string { return c.VarFiles } +func (c *SshCCommand) GetSkipSync() bool { return c.SkipSync } +func (c *SshCCommand) GetDestroy() bool { return c.Destroy } +func (c *SshCCommand) SetEnableGroups(list []string) { c.EnableGroups = list } +func (c *SshCCommand) SetDisableGroups(list []string) { c.DisableGroups = list } func CommandFromYaml(data []byte) (*SshCCommand, error) { ans := &SshCCommand{}