Skip to content

Commit

Permalink
Add support for helmfile version command (#854)
Browse files Browse the repository at this point in the history
  • Loading branch information
samtholiya and aknysh authored Dec 14, 2024
1 parent 58b46f5 commit 11ec388
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 4 additions & 0 deletions internal/exec/helmfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ func ExecuteHelmfile(info schema.ConfigAndStacksInfo) error {
return nil
}

if info.SubCommand == "version" {
return ExecuteShellCommand(cliConfig, "helmfile", []string{info.SubCommand}, "", nil, false, info.RedirectStdErr)
}

info, err = ProcessStacks(cliConfig, info, true, true)
if err != nil {
return err
Expand Down
13 changes: 5 additions & 8 deletions internal/exec/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -661,22 +661,19 @@ func processArgsAndFlags(componentType string, inputArgsAndFlags []string) (sche
var indexesToRemove []int

// For commands like `atmos terraform clean` and `atmos terraform plan`, show the command help
if len(inputArgsAndFlags) == 1 {
if len(inputArgsAndFlags) == 1 && inputArgsAndFlags[0] != "version" {
info.SubCommand = inputArgsAndFlags[0]
info.NeedHelp = true
return info, nil
}

// https://github.com/roboll/helmfile#cli-reference
var globalOptionsFlagIndex int

// For commands like `atmos terraform clean` and `atmos terraform plan`, show the command help
if len(inputArgsAndFlags) == 1 {
if len(inputArgsAndFlags) == 1 && inputArgsAndFlags[0] == "version" {
info.SubCommand = inputArgsAndFlags[0]
info.NeedHelp = true
return info, nil
}

// https://github.com/roboll/helmfile#cli-reference
var globalOptionsFlagIndex int

for i, arg := range inputArgsAndFlags {
if arg == cfg.GlobalOptionsFlag {
globalOptionsFlagIndex = i + 1
Expand Down

0 comments on commit 11ec388

Please sign in to comment.