Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 0 additions & 80 deletions cli/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -721,86 +721,6 @@ func (r *runners) promptForPreflightPathsWithCharts(charts []tools.ChartConfig,
return preflights, nil
}

func (r *runners) promptForPreflightValues(preflightPath string, charts []tools.ChartConfig) (string, error) {
if len(charts) == 0 {
// No charts configured, just ask if they want to specify a custom path
addValuesPath := promptui.Select{
Label: fmt.Sprintf("Does '%s' use Helm chart values?", filepath.Base(preflightPath)),
Items: []string{"No", "Yes - specify path"},
}
_, result, err := addValuesPath.Run()
if err != nil {
if err == promptui.ErrInterrupt {
return "", errors.New("cancelled")
}
return "", errors.Wrap(err, "failed to read values option")
}

if result == "Yes - specify path" {
valuesPathPrompt := promptui.Prompt{
Label: "Values file path",
Default: "",
}
valuesPath, err := valuesPathPrompt.Run()
if err != nil {
if err == promptui.ErrInterrupt {
return "", errors.New("cancelled")
}
return "", errors.Wrap(err, "failed to read values path")
}
return valuesPath, nil
}
return "", nil
}

// Charts are configured, offer them as options
options := []string{"No"}
for _, chart := range charts {
options = append(options, fmt.Sprintf("Yes - use %s", chart.Path))
}
options = append(options, "Yes - other path")

valuesPrompt := promptui.Select{
Label: fmt.Sprintf("Does '%s' use Helm chart values?", filepath.Base(preflightPath)),
Items: options,
}
_, result, err := valuesPrompt.Run()
if err != nil {
if err == promptui.ErrInterrupt {
return "", errors.New("cancelled")
}
return "", errors.Wrap(err, "failed to read values option")
}

if result == "No" {
return "", nil
}

if result == "Yes - other path" {
valuesPathPrompt := promptui.Prompt{
Label: "Values file path",
Default: "",
}
valuesPath, err := valuesPathPrompt.Run()
if err != nil {
if err == promptui.ErrInterrupt {
return "", errors.New("cancelled")
}
return "", errors.Wrap(err, "failed to read values path")
}
return valuesPath, nil
}

// Extract the chart path from the selection
for _, chart := range charts {
if result == fmt.Sprintf("Yes - use %s", chart.Path) {
return chart.Path, nil
}
}

return "", nil
}

func (r *runners) promptForManifests() ([]string, error) {
var manifests []string

Expand Down
Loading
Loading