Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for native --template in Atmos for describe output #989

Closed
wants to merge 18 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
update describe command
Cerebrovinny committed Feb 1, 2025
commit ae9770a590cbb1c0643f6f2c7ee15e7eec117d41
28 changes: 17 additions & 11 deletions cmd/list_stacks.go
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@ import (

e "github.com/cloudposse/atmos/internal/exec"
"github.com/cloudposse/atmos/pkg/config"
l "github.com/cloudposse/atmos/pkg/list"
"github.com/cloudposse/atmos/pkg/schema"
"github.com/cloudposse/atmos/pkg/ui/theme"
u "github.com/cloudposse/atmos/pkg/utils"
@@ -16,20 +15,18 @@ import (
// listStacksCmd lists atmos stacks
var listStacksCmd = &cobra.Command{
Use: "stacks",
Short: "List all Atmos stacks or stacks for a specific component",
Long: "This command lists all Atmos stacks, or filters the list to show only the stacks associated with a specified component.",
Short: "List all Atmos stacks",
Long: "This command lists all Atmos stacks. For detailed filtering and output formatting, use 'atmos describe stacks'.",
Example: "# List all stacks\n" +
"atmos list stacks\n\n" +
"# List stacks for a specific component\n" +
"atmos list stacks -c <component>",
"# For detailed stack information and filtering, use:\n" +
"atmos describe stacks",
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false},
Args: cobra.NoArgs,
Run: func(cmd *cobra.Command, args []string) {
// Check Atmos configuration
checkAtmosConfig()

componentFlag, _ := cmd.Flags().GetString("component")

configAndStacksInfo := schema.ConfigAndStacksInfo{}
atmosConfig, err := config.InitCliConfig(configAndStacksInfo, true)
if err != nil {
@@ -43,17 +40,26 @@ var listStacksCmd = &cobra.Command{
return
}

output, err := l.FilterAndListStacks(stacksMap, componentFlag, "", "", "")
if err != nil {
u.PrintMessageInColor(fmt.Sprintf("Error filtering stacks: %v", err), theme.Colors.Error)
// Simple list of stack names
var stackNames []string
for stackName := range stacksMap {
stackNames = append(stackNames, stackName)
}

if len(stackNames) == 0 {
u.PrintMessageInColor("No stacks found\n", theme.Colors.Warning)
return
}

output := "Available stacks:\n"
for _, name := range stackNames {
output += fmt.Sprintf(" %s\n", name)
}
u.PrintMessageInColor(output, theme.Colors.Success)
},
}

func init() {
listStacksCmd.DisableFlagParsing = false
listStacksCmd.PersistentFlags().StringP("component", "c", "", "Filter stacks by component")
listCmd.AddCommand(listStacksCmd)
}
112 changes: 0 additions & 112 deletions pkg/list/list_stacks.go

This file was deleted.

7 changes: 0 additions & 7 deletions tests/snapshots/TestCLICommands_atmos_--help.stdout.golden

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.