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 --query (shorthand -q) flag to all atmos describe <subcommand> commands #920

Merged
merged 41 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
e367197
updates
aknysh Dec 30, 2024
3e8039f
updates
aknysh Dec 30, 2024
5ee6558
updates
aknysh Dec 30, 2024
3b7cc60
updates
aknysh Jan 1, 2025
56d632b
updates
aknysh Jan 1, 2025
2fd79ca
updates
aknysh Jan 1, 2025
6ad4818
updates
aknysh Jan 1, 2025
387f068
updates
aknysh Jan 1, 2025
58f6d06
updates
aknysh Jan 1, 2025
42d7231
updates
aknysh Jan 2, 2025
c89b649
updates
aknysh Jan 2, 2025
59f560a
updates
aknysh Jan 3, 2025
fff0f25
updates
aknysh Jan 3, 2025
0cfbc03
updates
aknysh Jan 3, 2025
fa94442
Merge remote-tracking branch 'origin/main' into add-vars-parameter
aknysh Jan 3, 2025
e9f3cc9
updates
aknysh Jan 3, 2025
9600d7c
Merge remote-tracking branch 'origin/main' into add-vars-parameter
aknysh Jan 4, 2025
142a400
updates
aknysh Jan 4, 2025
986f489
updates
aknysh Jan 4, 2025
6bbab1d
updates
aknysh Jan 5, 2025
de5c5fc
updates
aknysh Jan 5, 2025
ad43eea
updates
aknysh Jan 5, 2025
da030d7
Merge remote-tracking branch 'origin/main' into add-vars-parameter
aknysh Jan 5, 2025
9ff14e2
Merge remote-tracking branch 'origin/main' into add-vars-parameter
aknysh Jan 6, 2025
e1268ea
updates
aknysh Jan 6, 2025
47353e5
Merge remote-tracking branch 'origin/main' into add-vars-parameter
aknysh Jan 6, 2025
b42d9e1
Merge remote-tracking branch 'origin/main' into add-vars-parameter
aknysh Jan 7, 2025
c3ba221
updates
aknysh Jan 7, 2025
4abfed2
Merge remote-tracking branch 'origin/main' into add-vars-parameter
aknysh Jan 7, 2025
98294c6
updates
aknysh Jan 7, 2025
da5a237
updates
aknysh Jan 7, 2025
437af8f
updates
aknysh Jan 8, 2025
7433f93
updates
aknysh Jan 8, 2025
571f30d
updates
aknysh Jan 8, 2025
5ce9afc
updates
aknysh Jan 8, 2025
49c779e
updates
aknysh Jan 8, 2025
1f26f29
updates
aknysh Jan 8, 2025
4853ed1
Merge branch 'main' into add-vars-parameter
aknysh Jan 8, 2025
c01a353
updates
aknysh Jan 8, 2025
f495d77
Merge remote-tracking branch 'origin/main' into add-vars-parameter
aknysh Jan 8, 2025
a8a66f1
updates
aknysh Jan 8, 2025
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
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2020-2024 Cloud Posse, LLC
Copyright 2020-2025 Cloud Posse, LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion atmos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# are independent settings (supporting both absolute and relative paths).
# If 'base_path' is provided, 'components.terraform.base_path', 'components.helmfile.base_path', 'stacks.base_path' and 'workflows.base_path'
# are considered paths relative to 'base_path'.
base_path: "."
base_path: ""

vendor:
# Path to vendor configuration file or directory containing vendor files
Expand Down
5 changes: 4 additions & 1 deletion cmd/about.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ var aboutCmd = &cobra.Command{
return fmt.Errorf("failed to render about documentation: %w", err)
}

fmt.Fprint(os.Stdout, out)
_, err = fmt.Fprint(os.Stdout, out)
if err != nil {
return err
}
return nil
},
}
Expand Down
2 changes: 2 additions & 0 deletions cmd/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ var describeCmd = &cobra.Command{
}

func init() {
describeCmd.PersistentFlags().StringP("query", "q", "", "Query the results of an 'atmos describe' command using 'yq' expressions: atmos describe <subcommand> --query <yq-expression>")

RootCmd.AddCommand(describeCmd)
}
13 changes: 10 additions & 3 deletions cmd/list_components.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package cmd
import (
"fmt"

"github.com/fatih/color"
"github.com/spf13/cobra"

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"
u "github.com/cloudposse/atmos/pkg/utils"
"github.com/fatih/color"
"github.com/spf13/cobra"
)

// listComponentsCmd lists atmos components
Expand All @@ -23,7 +24,13 @@ var listComponentsCmd = &cobra.Command{
// Check Atmos configuration
checkAtmosConfig()

stackFlag, _ := cmd.Flags().GetString("stack")
flags := cmd.Flags()

stackFlag, err := flags.GetString("stack")
if err != nil {
u.PrintMessageInColor(fmt.Sprintf("Error getting the 'stack' flag: %v", err), color.New(color.FgRed))
return
}

configAndStacksInfo := schema.ConfigAndStacksInfo{}
atmosConfig, err := config.InitCliConfig(configAndStacksInfo, true)
Expand Down
5 changes: 3 additions & 2 deletions cmd/list_stacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package cmd
import (
"fmt"

"github.com/fatih/color"
"github.com/spf13/cobra"

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"
u "github.com/cloudposse/atmos/pkg/utils"
"github.com/fatih/color"
"github.com/spf13/cobra"
)

// listStacksCmd lists atmos stacks
Expand Down
6 changes: 5 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ func init() {
RootCmd.PersistentFlags().String("logs-file", "/dev/stdout", "The file to write Atmos logs to. Logs can be written to any file or any standard file descriptor, including '/dev/stdout', '/dev/stderr' and '/dev/null'")

// Set custom usage template
templates.SetCustomUsageFunc(RootCmd)
err := templates.SetCustomUsageFunc(RootCmd)
if err != nil {
u.LogErrorAndExit(atmosConfig, err)
}

initCobraConfig()
}

Expand Down
6 changes: 5 additions & 1 deletion cmd/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ var supportCmd = &cobra.Command{
return fmt.Errorf("failed to render support documentation: %w", err)
}

fmt.Fprint(os.Stdout, out)
_, err = fmt.Fprint(os.Stdout, out)
if err != nil {
return err
}

return nil
},
}
Expand Down
2 changes: 1 addition & 1 deletion examples/quick-start-advanced/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG GEODESIC_OS=debian
# https://atmos.tools/
# https://github.com/cloudposse/atmos
# https://github.com/cloudposse/atmos/releases
ARG ATMOS_VERSION=1.137.0
ARG ATMOS_VERSION=1.140.0

# Terraform: https://github.com/hashicorp/terraform/releases
ARG TF_VERSION=1.5.7
Expand Down
12 changes: 11 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ require (
github.com/kubescape/go-git-url v0.0.30
github.com/lrstanley/bubblezone v0.0.0-20241221063659-0f12a2876fb2
github.com/mattn/go-isatty v0.0.20
github.com/mikefarah/yq/v4 v4.44.6
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/go-wordwrap v1.0.1
github.com/mitchellh/mapstructure v1.5.0
Expand All @@ -51,6 +52,7 @@ require (
github.com/stretchr/testify v1.10.0
github.com/zclconf/go-cty v1.16.0
golang.org/x/term v0.28.0
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
mvdan.cc/sh/v3 v3.10.0
Expand All @@ -68,9 +70,11 @@ require (
github.com/OneOfOne/xxhash v1.2.8 // indirect
github.com/ProtonMail/go-crypto v1.1.3 // indirect
github.com/Shopify/ejson v1.3.3 // indirect
github.com/a8m/envsubst v1.4.2 // indirect
github.com/agext/levenshtein v1.2.2 // indirect
github.com/agnivade/levenshtein v1.2.0 // indirect
github.com/alecthomas/chroma/v2 v2.14.0 // indirect
github.com/alecthomas/participle/v2 v2.1.1 // indirect
github.com/apparentlymart/go-cidr v1.1.0 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
Expand Down Expand Up @@ -117,13 +121,15 @@ require (
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
github.com/cyphar/filepath-securejoin v0.3.6 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/dlclark/regexp2 v1.11.0 // indirect
github.com/docker/cli v27.1.1+incompatible // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker-credential-helpers v0.7.0 // indirect
github.com/docker/libkv v0.2.2-0.20180912205406-458977154600 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dustin/gojson v0.0.0-20160307161227-2e71ec9dd5ad // indirect
github.com/elliotchance/orderedmap v1.7.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
Expand All @@ -135,6 +141,8 @@ require (
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/goccy/go-json v0.10.3 // indirect
github.com/goccy/go-yaml v1.13.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.4 // indirect
Expand Down Expand Up @@ -176,6 +184,7 @@ require (
github.com/huandu/xstrings v1.5.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jinzhu/copier v0.4.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/joho/godotenv v1.4.0 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
Expand All @@ -201,7 +210,7 @@ require (
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/otiai10/mint v1.6.3 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
Expand Down Expand Up @@ -235,6 +244,7 @@ require (
github.com/yashtewari/glob-intersection v0.2.0 // indirect
github.com/yuin/goldmark v1.7.4 // indirect
github.com/yuin/goldmark-emoji v1.0.3 // indirect
github.com/yuin/gopher-lua v1.1.1 // indirect
github.com/zealic/xignore v0.3.3 // indirect
go.etcd.io/bbolt v1.3.10 // indirect
go.opencensus.io v0.24.0 // indirect
Expand Down
Loading
Loading