diff --git a/atmos.yaml b/atmos.yaml index 48441fd136..a7b440a850 100644 --- a/atmos.yaml +++ b/atmos.yaml @@ -353,7 +353,6 @@ settings: terminal: max_width: 120 # Maximum width for terminal output pager: true # Pager setting for all terminal output - colors: true # Enable colored output unicode: true # Use unicode characters syntax_highlighting: diff --git a/cmd/root.go b/cmd/root.go index b797213834..24354128ec 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -9,6 +9,7 @@ import ( "regexp" "strings" + "github.com/charmbracelet/lipgloss" "github.com/charmbracelet/log" "github.com/elewis787/boa" "github.com/spf13/cobra" @@ -95,6 +96,16 @@ func setupLogger(atmosConfig *schema.AtmosConfiguration) { log.SetLevel(log.InfoLevel) } + if atmosConfig.Settings.Terminal.NoColor { + stylesDefault := log.DefaultStyles() + // Clear colors for levels + styles := &log.Styles{} + styles.Levels = make(map[log.Level]lipgloss.Style) + for k := range stylesDefault.Levels { + styles.Levels[k] = stylesDefault.Levels[k].UnsetForeground().Bold(false) + } + log.SetStyles(styles) + } var output io.Writer switch atmosConfig.Logs.File { @@ -194,6 +205,7 @@ func init() { RootCmd.PersistentFlags().String("base-path", "", "Base path for Atmos project") RootCmd.PersistentFlags().StringSlice("config", []string{}, "Paths to configuration files (comma-separated or repeated flag)") RootCmd.PersistentFlags().StringSlice("config-path", []string{}, "Paths to configuration directories (comma-separated or repeated flag)") + RootCmd.PersistentFlags().Bool("no-color", false, "Disable color output") // Set custom usage template err := templates.SetCustomUsageFunc(RootCmd) if err != nil { diff --git a/cmd/root_test.go b/cmd/root_test.go new file mode 100644 index 0000000000..716577150f --- /dev/null +++ b/cmd/root_test.go @@ -0,0 +1,37 @@ +package cmd + +import ( + "bytes" + "os" + "strings" + "testing" + + log "github.com/charmbracelet/log" +) + +func TestNoColorLog(t *testing.T) { + // Set the environment variable to disable color + // t.Setenv("NO_COLOR", "1") + t.Setenv("ATMOS_LOGS_LEVEL", "Debug") + t.Setenv("NO_COLOR", "1") + // Create a buffer to capture the output + var buf bytes.Buffer + log.SetOutput(&buf) + + oldArgs := os.Args + defer func() { + os.Args = oldArgs + }() + // Set the arguments for the command + os.Args = []string{"atmos", "about"} + // Execute the command + if err := Execute(); err != nil { + t.Fatalf("Failed to execute command: %v", err) + } + // Check if the output is without color + output := buf.String() + if strings.Contains(output, "\033[") { + t.Errorf("Expected no color in output, but got: %s", output) + } + t.Log(output, "output") +} diff --git a/cmd/support_test.go b/cmd/support_test.go deleted file mode 100644 index 9c3dab7880..0000000000 --- a/cmd/support_test.go +++ /dev/null @@ -1,35 +0,0 @@ -package cmd - -import ( - "bytes" - "io" - "os" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestSupportCmd(t *testing.T) { - // Capture stdout since utils.PrintfMarkdown writes directly to os.Stdout - oldStdout := os.Stdout - r, w, _ := os.Pipe() - os.Stdout = w - - // Execute the command - err := supportCmd.RunE(supportCmd, []string{}) - assert.NoError(t, err, "'atmos support' command should execute without error") - - // Close the writer and restore stdout - err = w.Close() - assert.NoError(t, err, "'atmos support' command should execute without error") - - os.Stdout = oldStdout - - // Read captured output - var output bytes.Buffer - _, err = io.Copy(&output, r) - assert.NoError(t, err, "'atmos support' command should execute without error") - - // Check if output contains expected markdown content - assert.Contains(t, output.String(), supportMarkdown, "'atmos support' output should contain information about Cloud Posse Atmos support") -} diff --git a/cmd/validate_editorconfig.go b/cmd/validate_editorconfig.go index 5dd995f025..8e569106c3 100644 --- a/cmd/validate_editorconfig.go +++ b/cmd/validate_editorconfig.go @@ -116,8 +116,10 @@ func replaceAtmosConfigInConfig(cmd *cobra.Command, atmosConfig schema.AtmosConf cliConfig.Verbose = true } } - if !cmd.Flags().Changed("no-color") && !atmosConfig.Validate.EditorConfig.Color { - cliConfig.NoColor = !atmosConfig.Validate.EditorConfig.Color + if !cmd.Flags().Changed("no-color") && atmosConfig.Settings.Terminal.NoColor { + cliConfig.NoColor = atmosConfig.Settings.Terminal.NoColor + } else if cmd.Flags().Changed("no-color") { + cliConfig.NoColor, _ = cmd.Flags().GetBool("no-color") } if !cmd.Flags().Changed("disable-trim-trailing-whitespace") && atmosConfig.Validate.EditorConfig.DisableTrimTrailingWhitespace { cliConfig.Disable.TrimTrailingWhitespace = atmosConfig.Validate.EditorConfig.DisableTrimTrailingWhitespace @@ -192,7 +194,6 @@ func addPersistentFlags(cmd *cobra.Command) { cmd.PersistentFlags().BoolVar(&cliConfig.DryRun, "dry-run", false, "Show which files would be checked") cmd.PersistentFlags().BoolVar(&cliConfig.ShowVersion, "version", false, "Print the version number") cmd.PersistentFlags().StringVar(&format, "format", "default", "Specify the output format: default, gcc") - cmd.PersistentFlags().BoolVar(&cliConfig.NoColor, "no-color", false, "Don't print colors") cmd.PersistentFlags().BoolVar(&cliConfig.Disable.TrimTrailingWhitespace, "disable-trim-trailing-whitespace", false, "Disable trailing whitespace check") cmd.PersistentFlags().BoolVar(&cliConfig.Disable.EndOfLine, "disable-end-of-line", false, "Disable end-of-line check") cmd.PersistentFlags().BoolVar(&cliConfig.Disable.InsertFinalNewline, "disable-insert-final-newline", false, "Disable final newline check") diff --git a/pkg/config/config.go b/pkg/config/config.go index ad4deff5f4..a8a448d811 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -77,6 +77,11 @@ func setLogConfig(atmosConfig *schema.AtmosConfiguration) { if v, ok := flagKeyValue["logs-file"]; ok { atmosConfig.Logs.File = v } + if flagKeyValue, ok := flagKeyValue["no-color"]; ok || flagKeyValue == "true" { + atmosConfig.Settings.Terminal.NoColor = true + } else if flagKeyValue == "false" { + atmosConfig.Settings.Terminal.NoColor = false + } } // TODO: This function works well, but we should generally avoid implementing manual flag parsing, diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index d9e5bd6d5b..1f51ad5840 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -403,3 +403,86 @@ func TestMergeDefaultConfig(t *testing.T) { err = mergeDefaultConfig(v) assert.NoError(t, err, "should not return error if config type is yaml") } + +func TestParseFlags(t *testing.T) { + tests := []struct { + name string + args []string + expected map[string]string + }{ + { + name: "no flags", + args: []string{}, + expected: map[string]string{}, + }, + { + name: "single flag", + args: []string{"--key=value"}, + expected: map[string]string{"key": "value"}, + }, + { + name: "multiple flags", + args: []string{"--key1=value1", "--key2=value2"}, + expected: map[string]string{"key1": "value1", "key2": "value2"}, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + oldArgs := os.Args + defer func() { os.Args = oldArgs }() + os.Args = test.args + result := parseFlags() + assert.Equal(t, test.expected, result) + }) + } +} + +func TestSetLogConfig(t *testing.T) { + tests := []struct { + name string + args []string + expectedLogLevel string + expectetdNoColor bool + }{ + { + name: "valid log level", + args: []string{"--logs-level", "Debug"}, + expectedLogLevel: "Debug", + }, + { + name: "invalid log level", + args: []string{"--logs-level", "InvalidLevel"}, + expectedLogLevel: "InvalidLevel", + }, + { + name: "No color flag", + args: []string{"--no-color"}, + expectedLogLevel: "", + expectetdNoColor: true, + }, + { + name: "No color flag with log level", + args: []string{"--no-color", "--logs-level", "Debug"}, + expectedLogLevel: "Debug", + expectetdNoColor: true, + }, + { + name: "No color flag disable with log level", + args: []string{"--no-color=false", "--logs-level", "Debug"}, + expectedLogLevel: "Debug", + expectetdNoColor: false, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + oldArgs := os.Args + defer func() { os.Args = oldArgs }() + os.Args = test.args + atmosConfig := &schema.AtmosConfiguration{} + setLogConfig(atmosConfig) + assert.Equal(t, test.expectedLogLevel, atmosConfig.Logs.Level) + }) + } +} diff --git a/pkg/config/default.go b/pkg/config/default.go index f3dd22af1e..4c6833949d 100644 --- a/pkg/config/default.go +++ b/pkg/config/default.go @@ -56,7 +56,6 @@ var ( Terminal: schema.Terminal{ MaxWidth: templates.GetTerminalWidth(), Pager: "less", - Colors: true, Unicode: true, SyntaxHighlighting: schema.SyntaxHighlighting{ Enabled: true, diff --git a/pkg/config/load.go b/pkg/config/load.go index 161c2c447c..c394da3377 100644 --- a/pkg/config/load.go +++ b/pkg/config/load.go @@ -75,8 +75,6 @@ func LoadConfig(configAndStacksInfo *schema.ConfigAndStacksInfo) (schema.AtmosCo } } setEnv(v) - // We want the editorconfig color by default to be true - atmosConfig.Validate.EditorConfig.Color = true // https://gist.github.com/chazcheadle/45bf85b793dea2b71bd05ebaa3c28644 // https://sagikazarmark.hu/blog/decoding-custom-formats-with-viper/ err := v.Unmarshal(&atmosConfig) @@ -101,6 +99,7 @@ func setEnv(v *viper.Viper) { bindEnv(v, "settings.atmos_gitlab_token", "ATMOS_GITLAB_TOKEN") bindEnv(v, "settings.terminal.pager", "ATMOS_PAGER", "PAGER") + bindEnv(v, "settings.terminal.no_color", "ATMOS_NO_COLOR", "NO_COLOR") } func bindEnv(v *viper.Viper, key ...string) { @@ -118,6 +117,7 @@ func setDefaultConfiguration(v *viper.Viper) { v.SetDefault("logs.file", "/dev/stderr") v.SetDefault("logs.level", "Info") + v.SetDefault("settings.terminal.no_color", false) v.SetDefault("settings.terminal.pager", true) v.SetDefault("docs.generate.readme.output", "./README.md") } diff --git a/pkg/schema/schema.go b/pkg/schema/schema.go index c7741add89..93c23b0f3d 100644 --- a/pkg/schema/schema.go +++ b/pkg/schema/schema.go @@ -174,7 +174,6 @@ type EditorConfig struct { IgnoreDefaults bool `yaml:"ignore_defaults,omitempty" json:"ignore_defaults,omitempty" mapstructure:"ignore_defaults"` DryRun bool `yaml:"dry_run,omitempty" json:"dry_run,omitempty" mapstructure:"dry_run"` Format string `yaml:"format,omitempty" json:"format,omitempty" mapstructure:"format"` - Color bool `yaml:"color,omitempty" json:"color,omitempty" mapstructure:"color"` ConfigFilePaths []string `yaml:"config_file_paths,omitempty" json:"config_file_paths,omitempty" mapstructure:"config_file_paths"` Exclude []string `yaml:"exclude,omitempty" json:"exclude,omitempty" mapstructure:"exclude"` Init bool `yaml:"init,omitempty" json:"init,omitempty" mapstructure:"init"` @@ -190,9 +189,9 @@ type EditorConfig struct { type Terminal struct { MaxWidth int `yaml:"max_width" json:"max_width" mapstructure:"max_width"` Pager string `yaml:"pager" json:"pager" mapstructure:"pager"` - Colors bool `yaml:"colors" json:"colors" mapstructure:"colors"` Unicode bool `yaml:"unicode" json:"unicode" mapstructure:"unicode"` SyntaxHighlighting SyntaxHighlighting `yaml:"syntax_highlighting" json:"syntax_highlighting" mapstructure:"syntax_highlighting"` + NoColor bool `yaml:"no_color" json:"no_color" mapstructure:"no_color"` } func (t *Terminal) IsPagerEnabled() bool { diff --git a/pkg/ui/markdown/renderer.go b/pkg/ui/markdown/renderer.go index d3bfc35e47..cc6681c2da 100644 --- a/pkg/ui/markdown/renderer.go +++ b/pkg/ui/markdown/renderer.go @@ -12,19 +12,26 @@ import ( "github.com/muesli/termenv" ) +const defaultWidth = 80 + // Renderer is a markdown renderer using Glamour type Renderer struct { - renderer *glamour.TermRenderer - width uint - profile termenv.Profile - atmosConfig *schema.AtmosConfiguration + renderer *glamour.TermRenderer + width uint + profile termenv.Profile + atmosConfig *schema.AtmosConfiguration + isTTYSupportForStdout func() bool + isTTYSupportForStderr func() bool } // NewRenderer creates a new markdown renderer with the given options func NewRenderer(atmosConfig schema.AtmosConfiguration, opts ...Option) (*Renderer, error) { r := &Renderer{ - width: 80, // default width - profile: termenv.ColorProfile(), // default color profile + width: defaultWidth, // default width + profile: termenv.ColorProfile(), // default color profile + isTTYSupportForStdout: term.IsTTYSupportForStdout, + isTTYSupportForStderr: term.IsTTYSupportForStderr, + atmosConfig: &atmosConfig, } // Apply options @@ -32,6 +39,21 @@ func NewRenderer(atmosConfig schema.AtmosConfiguration, opts ...Option) (*Render opt(r) } + if atmosConfig.Settings.Terminal.NoColor { + renderer, err := glamour.NewTermRenderer( + glamour.WithStandardStyle(styles.AsciiStyle), + glamour.WithWordWrap(int(r.width)), + glamour.WithColorProfile(r.profile), + glamour.WithEmoji(), + ) + if err != nil { + return nil, err + } + + r.renderer = renderer + return r, nil + } + // Get default style style, err := GetDefaultStyle(atmosConfig) if err != nil { @@ -56,17 +78,37 @@ func NewRenderer(atmosConfig schema.AtmosConfiguration, opts ...Option) (*Render func (r *Renderer) RenderWithoutWordWrap(content string) (string, error) { // Render without line wrapping - out, err := glamour.NewTermRenderer( - glamour.WithAutoStyle(), // Uses terminal's default style - glamour.WithWordWrap(0), - glamour.WithColorProfile(r.profile), - glamour.WithEmoji(), - ) - if err != nil { - return "", err + var out *glamour.TermRenderer + var err error + if r.atmosConfig.Settings.Terminal.NoColor { + out, err = glamour.NewTermRenderer( + glamour.WithStandardStyle(styles.AsciiStyle), + glamour.WithWordWrap(0), + glamour.WithColorProfile(r.profile), + glamour.WithEmoji(), + ) + if err != nil { + return "", err + } + } else { + // Get default style + style, err := GetDefaultStyle(*r.atmosConfig) + if err != nil { + return "", err + } + out, err = glamour.NewTermRenderer( + glamour.WithAutoStyle(), // Uses terminal's default style + glamour.WithWordWrap(0), + glamour.WithStylesFromJSONBytes(style), + glamour.WithColorProfile(r.profile), + glamour.WithEmoji(), + ) + if err != nil { + return "", err + } } result := "" - if term.IsTTYSupportForStdout() { + if r.isTTYSupportForStdout() { result, err = out.Render(content) } else { // Fallback to ASCII rendering for non-TTY stdout @@ -79,7 +121,7 @@ func (r *Renderer) RenderWithoutWordWrap(content string) (string, error) { func (r *Renderer) Render(content string) (string, error) { var rendered string var err error - if term.IsTTYSupportForStdout() { + if r.isTTYSupportForStdout() { rendered, err = r.renderer.Render(content) } else { // Fallback to ASCII rendering for non-TTY stdout @@ -136,22 +178,6 @@ func (r *Renderer) RenderAscii(content string) (string, error) { return renderer.Render(content) } -// RenderWithStyle renders markdown content with a specific style -func (r *Renderer) RenderWithStyle(content string, style []byte) (string, error) { - renderer, err := glamour.NewTermRenderer( - glamour.WithAutoStyle(), - glamour.WithWordWrap(int(r.width)), - glamour.WithStylesFromJSONBytes(style), - glamour.WithColorProfile(r.profile), - glamour.WithEmoji(), - ) - if err != nil { - return "", err - } - - return renderer.Render(content) -} - // RenderWorkflow renders workflow documentation with specific styling func (r *Renderer) RenderWorkflow(content string) (string, error) { // Add workflow header @@ -183,7 +209,7 @@ func (r *Renderer) RenderError(title, details, suggestion string) (string, error // RenderErrorf renders an error message with specific styling func (r *Renderer) RenderErrorf(content string, args ...interface{}) (string, error) { - if term.IsTTYSupportForStderr() { + if r.isTTYSupportForStderr() { return r.Render(content) } // Fallback to ASCII rendering for non-TTY stderr diff --git a/pkg/ui/markdown/renderer_test.go b/pkg/ui/markdown/renderer_test.go new file mode 100644 index 0000000000..28ba170195 --- /dev/null +++ b/pkg/ui/markdown/renderer_test.go @@ -0,0 +1,100 @@ +package markdown + +import ( + "testing" + + "github.com/cloudposse/atmos/internal/tui/templates/term" + "github.com/cloudposse/atmos/pkg/schema" + "github.com/stretchr/testify/assert" +) + +func TestRenderer(t *testing.T) { + tests := []struct { + name string + input string + expected string + atmosConfig schema.AtmosConfiguration + }{ + { + name: "Test with no color", + input: "## Hello **world**", + expected: " ## Hello **world**", + atmosConfig: schema.AtmosConfiguration{ + Settings: schema.AtmosSettings{ + Terminal: schema.Terminal{ + NoColor: true, + }, + }, + }, + }, + { + name: "Test with color", + input: "## Hello **world**", + expected: "\x1b[;1m\x1b[0m\x1b[;1m\x1b[0m\x1b[;1m## \x1b[0m\x1b[;1mHello \x1b[0m\x1b[;1m**\x1b[0m\x1b[;1mworld\x1b[0m\x1b[;1m**\x1b[0m", + atmosConfig: schema.AtmosConfiguration{ + Settings: schema.AtmosSettings{ + Terminal: schema.Terminal{ + NoColor: false, + }, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + r, _ := NewRenderer(tt.atmosConfig) + r.isTTYSupportForStdout = func() bool { + return true + } + defer func() { + r.isTTYSupportForStdout = term.IsTTYSupportForStdout + }() + str, err := r.Render(tt.input) + assert.Contains(t, str, tt.expected) + assert.NoError(t, err) + str, err = r.RenderWithoutWordWrap(tt.input) + assert.Contains(t, str, tt.expected) + assert.NoError(t, err) + }) + } +} + +func TestRenderErrorf(t *testing.T) { + tests := []struct { + name string + input string + expected string + isColor bool + }{ + { + name: "Test with no color", + input: "## Hello **world**", + expected: "## Hello **world**", + isColor: false, + }, + { + name: "Test with color", + input: "## Hello **world**", + expected: "\x1b[;1m\x1b[0m\x1b[;1m\x1b[0m\x1b[;1m## \x1b[0m\x1b[;1mHello \x1b[0m\x1b[;1m**\x1b[0m\x1b[;1mworld\x1b[0m\x1b[;1m**\x1b[0m", + isColor: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + r, _ := NewRenderer(schema.AtmosConfiguration{}) + r.isTTYSupportForStderr = func() bool { + return tt.isColor + } + r.isTTYSupportForStdout = func() bool { + return tt.isColor + } + defer func() { + r.isTTYSupportForStderr = term.IsTTYSupportForStderr + r.isTTYSupportForStdout = term.IsTTYSupportForStdout + }() + str, err := r.RenderErrorf(tt.input) + assert.Contains(t, str, tt.expected) + assert.NoError(t, err) + }) + } +} diff --git a/tests/snapshots/TestCLICommands_Valid_Log_Level_in_Command_Line_Flag.stdout.golden b/tests/snapshots/TestCLICommands_Valid_Log_Level_in_Command_Line_Flag.stdout.golden index 82c26c3598..c39a129255 100644 --- a/tests/snapshots/TestCLICommands_Valid_Log_Level_in_Command_Line_Flag.stdout.golden +++ b/tests/snapshots/TestCLICommands_Valid_Log_Level_in_Command_Line_Flag.stdout.golden @@ -1,3 +1,3 @@ -👽 Atmos test on darwin/arm64 +👽 Atmos test on linux/amd64 diff --git a/tests/snapshots/TestCLICommands_Valid_Log_Level_in_Config_File.stdout.golden b/tests/snapshots/TestCLICommands_Valid_Log_Level_in_Config_File.stdout.golden index 82c26c3598..c39a129255 100644 --- a/tests/snapshots/TestCLICommands_Valid_Log_Level_in_Config_File.stdout.golden +++ b/tests/snapshots/TestCLICommands_Valid_Log_Level_in_Config_File.stdout.golden @@ -1,3 +1,3 @@ -👽 Atmos test on darwin/arm64 +👽 Atmos test on linux/amd64 diff --git a/tests/snapshots/TestCLICommands_Valid_Log_Level_in_Environment_Variable.stdout.golden b/tests/snapshots/TestCLICommands_Valid_Log_Level_in_Environment_Variable.stdout.golden index 82c26c3598..c39a129255 100644 --- a/tests/snapshots/TestCLICommands_Valid_Log_Level_in_Environment_Variable.stdout.golden +++ b/tests/snapshots/TestCLICommands_Valid_Log_Level_in_Environment_Variable.stdout.golden @@ -1,3 +1,3 @@ -👽 Atmos test on darwin/arm64 +👽 Atmos test on linux/amd64 diff --git a/tests/snapshots/TestCLICommands_Valid_log_file_in_env_should_be_priortized_over_config.stdout.golden b/tests/snapshots/TestCLICommands_Valid_log_file_in_env_should_be_priortized_over_config.stdout.golden index dcba28a289..37872fd722 100644 --- a/tests/snapshots/TestCLICommands_Valid_log_file_in_env_should_be_priortized_over_config.stdout.golden +++ b/tests/snapshots/TestCLICommands_Valid_log_file_in_env_should_be_priortized_over_config.stdout.golden @@ -4,5 +4,5 @@ DEBU Atmos configuration not found path=/absolute/path/to/repo/.atmos.d/**/* err DEBU Found ENV variable ATMOS_VERSION_CHECK_ENABLED=false DEBU processStoreConfig atmosConfig.StoresConfig=map[] -👽 Atmos test on darwin/arm64 +👽 Atmos test on linux/amd64 diff --git a/tests/snapshots/TestCLICommands_Valid_log_file_in_flag_should_be_priortized_over_env_and_config.stdout.golden b/tests/snapshots/TestCLICommands_Valid_log_file_in_flag_should_be_priortized_over_env_and_config.stdout.golden index dcba28a289..37872fd722 100644 --- a/tests/snapshots/TestCLICommands_Valid_log_file_in_flag_should_be_priortized_over_env_and_config.stdout.golden +++ b/tests/snapshots/TestCLICommands_Valid_log_file_in_flag_should_be_priortized_over_env_and_config.stdout.golden @@ -4,5 +4,5 @@ DEBU Atmos configuration not found path=/absolute/path/to/repo/.atmos.d/**/* err DEBU Found ENV variable ATMOS_VERSION_CHECK_ENABLED=false DEBU processStoreConfig atmosConfig.StoresConfig=map[] -👽 Atmos test on darwin/arm64 +👽 Atmos test on linux/amd64 diff --git a/tests/snapshots/TestCLICommands_Valid_log_level_in_env_should_be_priortized_over_config.stdout.golden b/tests/snapshots/TestCLICommands_Valid_log_level_in_env_should_be_priortized_over_config.stdout.golden index 82c26c3598..c39a129255 100644 --- a/tests/snapshots/TestCLICommands_Valid_log_level_in_env_should_be_priortized_over_config.stdout.golden +++ b/tests/snapshots/TestCLICommands_Valid_log_level_in_env_should_be_priortized_over_config.stdout.golden @@ -1,3 +1,3 @@ -👽 Atmos test on darwin/arm64 +👽 Atmos test on linux/amd64 diff --git a/tests/snapshots/TestCLICommands_Valid_log_level_in_flag_should_be_priortized_over_env_and_config.stdout.golden b/tests/snapshots/TestCLICommands_Valid_log_level_in_flag_should_be_priortized_over_env_and_config.stdout.golden index 82c26c3598..c39a129255 100644 --- a/tests/snapshots/TestCLICommands_Valid_log_level_in_flag_should_be_priortized_over_env_and_config.stdout.golden +++ b/tests/snapshots/TestCLICommands_Valid_log_level_in_flag_should_be_priortized_over_env_and_config.stdout.golden @@ -1,3 +1,3 @@ -👽 Atmos test on darwin/arm64 +👽 Atmos test on linux/amd64 diff --git a/tests/snapshots/TestCLICommands_atmos_--help.stdout.golden b/tests/snapshots/TestCLICommands_atmos_--help.stdout.golden index 6ac14ebc46..8ba954bb70 100644 --- a/tests/snapshots/TestCLICommands_atmos_--help.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_--help.stdout.golden @@ -57,6 +57,8 @@ Flags: is set to Off, Atmos will not log any messages (default Info) + --no-color Disable color output (default false) + --redirect-stderr string File descriptor to redirect stderr to. Errors can be redirected to any file or any standard file descriptor (including diff --git a/tests/snapshots/TestCLICommands_atmos_about_--help.stdout.golden b/tests/snapshots/TestCLICommands_atmos_about_--help.stdout.golden index 8b9e1d8955..3ebf43c4ce 100644 --- a/tests/snapshots/TestCLICommands_atmos_about_--help.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_about_--help.stdout.golden @@ -34,6 +34,8 @@ Global Flags: is set to Off, Atmos will not log any messages (default Info) + --no-color Disable color output (default false) + --redirect-stderr string File descriptor to redirect stderr to. Errors can be redirected to any file or any standard file descriptor (including diff --git a/tests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.golden b/tests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.golden index 3bb9772423..8ca7ca3b41 100644 --- a/tests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.golden @@ -42,6 +42,8 @@ Global Flags: is set to Off, Atmos will not log any messages (default Info) + --no-color Disable color output (default false) + --redirect-stderr string File descriptor to redirect stderr to. Errors can be redirected to any file or any standard file descriptor (including diff --git a/tests/snapshots/TestCLICommands_atmos_atlantis_generate_--help.stdout.golden b/tests/snapshots/TestCLICommands_atmos_atlantis_generate_--help.stdout.golden index 86591cbdca..0bef10097c 100644 --- a/tests/snapshots/TestCLICommands_atmos_atlantis_generate_--help.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_atlantis_generate_--help.stdout.golden @@ -45,6 +45,8 @@ Global Flags: is set to Off, Atmos will not log any messages (default Info) + --no-color Disable color output (default false) + --redirect-stderr string File descriptor to redirect stderr to. Errors can be redirected to any file or any standard file descriptor (including diff --git a/tests/snapshots/TestCLICommands_atmos_atlantis_generate_help.stdout.golden b/tests/snapshots/TestCLICommands_atmos_atlantis_generate_help.stdout.golden index 86591cbdca..0bef10097c 100644 --- a/tests/snapshots/TestCLICommands_atmos_atlantis_generate_help.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_atlantis_generate_help.stdout.golden @@ -45,6 +45,8 @@ Global Flags: is set to Off, Atmos will not log any messages (default Info) + --no-color Disable color output (default false) + --redirect-stderr string File descriptor to redirect stderr to. Errors can be redirected to any file or any standard file descriptor (including diff --git a/tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.golden b/tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.golden index f6205f259a..cfc1282da4 100644 --- a/tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.golden @@ -82,6 +82,8 @@ Global Flags: is set to Off, Atmos will not log any messages (default Info) + --no-color Disable color output (default false) + --redirect-stderr string File descriptor to redirect stderr to. Errors can be redirected to any file or any standard file descriptor (including diff --git a/tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.golden b/tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.golden index f6205f259a..cfc1282da4 100644 --- a/tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.golden @@ -82,6 +82,8 @@ Global Flags: is set to Off, Atmos will not log any messages (default Info) + --no-color Disable color output (default false) + --redirect-stderr string File descriptor to redirect stderr to. Errors can be redirected to any file or any standard file descriptor (including diff --git a/tests/snapshots/TestCLICommands_atmos_atlantis_help.stdout.golden b/tests/snapshots/TestCLICommands_atmos_atlantis_help.stdout.golden index 3bb9772423..8ca7ca3b41 100644 --- a/tests/snapshots/TestCLICommands_atmos_atlantis_help.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_atlantis_help.stdout.golden @@ -42,6 +42,8 @@ Global Flags: is set to Off, Atmos will not log any messages (default Info) + --no-color Disable color output (default false) + --redirect-stderr string File descriptor to redirect stderr to. Errors can be redirected to any file or any standard file descriptor (including diff --git a/tests/snapshots/TestCLICommands_atmos_describe_config.stdout.golden b/tests/snapshots/TestCLICommands_atmos_describe_config.stdout.golden index 9276ff57f6..2c27b4d8f4 100644 --- a/tests/snapshots/TestCLICommands_atmos_describe_config.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_describe_config.stdout.golden @@ -68,7 +68,6 @@ "terminal": { "max_width": 0, "pager": "0", - "colors": false, "unicode": false, "syntax_highlighting": { "enabled": false, @@ -78,7 +77,8 @@ "pager": false, "line_numbers": false, "wrap": false - } + }, + "no_color": false }, "docs": { "max_width": 0, @@ -147,9 +147,7 @@ } }, "validate": { - "editorconfig": { - "color": true - } + "editorconfig": {} }, "cli_config_path": "/absolute/path/to/repo/examples/demo-stacks", "import": null, diff --git a/tests/snapshots/TestCLICommands_atmos_describe_config_-f_yaml.stdout.golden b/tests/snapshots/TestCLICommands_atmos_describe_config_-f_yaml.stdout.golden index f32f13b28c..f0da0d6899 100644 --- a/tests/snapshots/TestCLICommands_atmos_describe_config_-f_yaml.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_describe_config_-f_yaml.stdout.golden @@ -35,7 +35,6 @@ settings: terminal: max_width: 0 pager: "0" - colors: false unicode: false syntax_highlighting: enabled: false @@ -45,6 +44,7 @@ settings: pager: false line_numbers: false wrap: false + no_color: false inject_github_token: true initialized: true stacksBaseAbsolutePath: /absolute/path/to/repo/examples/demo-stacks/stacks @@ -55,9 +55,6 @@ excludeStackAbsolutePaths: terraformDirAbsolutePath: /absolute/path/to/repo/examples/demo-stacks/components/terraform helmfileDirAbsolutePath: /absolute/path/to/repo/examples/demo-stacks default: false -validate: - editorconfig: - color: true cli_config_path: /absolute/path/to/repo/examples/demo-stacks import: [] docs: diff --git a/tests/snapshots/TestCLICommands_atmos_describe_config_imports.stdout.golden b/tests/snapshots/TestCLICommands_atmos_describe_config_imports.stdout.golden index 5c029eaa53..78856880e8 100644 --- a/tests/snapshots/TestCLICommands_atmos_describe_config_imports.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_describe_config_imports.stdout.golden @@ -111,7 +111,6 @@ settings: terminal: max_width: 120 pager: "1" - colors: true unicode: true syntax_highlighting: enabled: true @@ -121,6 +120,7 @@ settings: pager: false line_numbers: true wrap: false + no_color: false markdown: document: color: ${colors.text} @@ -159,7 +159,6 @@ version: validate: editorconfig: format: default - color: true cli_config_path: /absolute/path/to/repo/tests/fixtures/scenarios/atmos-cli-imports import: - https://raw.githubusercontent.com/cloudposse/atmos/refs/heads/main/atmos.yaml diff --git a/tests/snapshots/TestCLICommands_atmos_describe_configuration.stdout.golden b/tests/snapshots/TestCLICommands_atmos_describe_configuration.stdout.golden index a85dc6f5de..1101bf896f 100644 --- a/tests/snapshots/TestCLICommands_atmos_describe_configuration.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_describe_configuration.stdout.golden @@ -48,7 +48,6 @@ settings: terminal: max_width: 0 pager: "1" - colors: false unicode: false syntax_highlighting: enabled: false @@ -58,6 +57,7 @@ settings: pager: false line_numbers: false wrap: false + no_color: false inject_github_token: true initialized: true stacksBaseAbsolutePath: /absolute/path/to/repo/tests/fixtures/scenarios/atmos-configuration/stacks @@ -68,9 +68,6 @@ excludeStackAbsolutePaths: terraformDirAbsolutePath: /absolute/path/to/repo/tests/fixtures/scenarios/atmos-configuration/components/terraform helmfileDirAbsolutePath: /absolute/path/to/repo/tests/fixtures/scenarios/atmos-configuration/components/helmfile default: false -validate: - editorconfig: - color: true cli_config_path: /absolute/path/to/repo/tests/fixtures/scenarios/atmos-configuration import: [] docs: diff --git a/tests/snapshots/TestCLICommands_atmos_helmfile_--help.stdout.golden b/tests/snapshots/TestCLICommands_atmos_helmfile_--help.stdout.golden index d98fe5be06..4bf580c34b 100644 --- a/tests/snapshots/TestCLICommands_atmos_helmfile_--help.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_helmfile_--help.stdout.golden @@ -53,6 +53,8 @@ Global Flags: is set to Off, Atmos will not log any messages (default Info) + --no-color Disable color output (default false) + --redirect-stderr string File descriptor to redirect stderr to. Errors can be redirected to any file or any standard file descriptor (including diff --git a/tests/snapshots/TestCLICommands_atmos_helmfile_apply_--help.stdout.golden b/tests/snapshots/TestCLICommands_atmos_helmfile_apply_--help.stdout.golden index 2b63de9bfc..574e74365c 100644 --- a/tests/snapshots/TestCLICommands_atmos_helmfile_apply_--help.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_helmfile_apply_--help.stdout.golden @@ -35,6 +35,8 @@ Global Flags: is set to Off, Atmos will not log any messages (default Info) + --no-color Disable color output (default false) + --redirect-stderr string File descriptor to redirect stderr to. Errors can be redirected to any file or any standard file descriptor (including diff --git a/tests/snapshots/TestCLICommands_atmos_helmfile_apply_help.stdout.golden b/tests/snapshots/TestCLICommands_atmos_helmfile_apply_help.stdout.golden index 2b63de9bfc..574e74365c 100644 --- a/tests/snapshots/TestCLICommands_atmos_helmfile_apply_help.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_helmfile_apply_help.stdout.golden @@ -35,6 +35,8 @@ Global Flags: is set to Off, Atmos will not log any messages (default Info) + --no-color Disable color output (default false) + --redirect-stderr string File descriptor to redirect stderr to. Errors can be redirected to any file or any standard file descriptor (including diff --git a/tests/snapshots/TestCLICommands_atmos_helmfile_help.stdout.golden b/tests/snapshots/TestCLICommands_atmos_helmfile_help.stdout.golden index d98fe5be06..4bf580c34b 100644 --- a/tests/snapshots/TestCLICommands_atmos_helmfile_help.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_helmfile_help.stdout.golden @@ -53,6 +53,8 @@ Global Flags: is set to Off, Atmos will not log any messages (default Info) + --no-color Disable color output (default false) + --redirect-stderr string File descriptor to redirect stderr to. Errors can be redirected to any file or any standard file descriptor (including diff --git a/tests/snapshots/TestCLICommands_atmos_support.stderr.golden b/tests/snapshots/TestCLICommands_atmos_support.stderr.golden new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/snapshots/TestCLICommands_atmos_support.stdout.golden b/tests/snapshots/TestCLICommands_atmos_support.stdout.golden new file mode 100644 index 0000000000..8b78586722 --- /dev/null +++ b/tests/snapshots/TestCLICommands_atmos_support.stdout.golden @@ -0,0 +1,18 @@ +# Support +## Community Resources +Need help? Join the Atmos community! https://cloudposse.com/slack +• **Slack Community**: Connect with active users in the #atmos channel and get help anytime on slack https://cloudposse.com/slack. +• **GitHub Discussions**: Post questions or join conversations with the community and Cloud Posse. +• **Issue Tracker**: Found a bug? Report it here https://github.com/cloudposse/atmos/issues. +## Office Hours +We hold **office hours every Wednesday at 11:30 AM PST**. Join us for live Q&A sessions. +https://cloudposse.com/office-hours +## Paid Support +We offer priority support to GitHub Sponsors (Enterprise Tier). +https://github.com/sponsors/cloudposse +Included with sponsorship, we host **30-minute workshops twice a week** to: +• Answer your questions. +• Assist with debugging issues. +• Discuss architectural decisions. +Workshops are tailored to help you succeed with Atmos, our AWS Reference Architectures, and related tools. +│ **Note**: Paid support includes priority responses. https://github.com/sponsors/cloudposse diff --git a/tests/snapshots/TestCLICommands_atmos_terraform_--help.stdout.golden b/tests/snapshots/TestCLICommands_atmos_terraform_--help.stdout.golden index 333ccd418f..69abb7204e 100644 --- a/tests/snapshots/TestCLICommands_atmos_terraform_--help.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_terraform_--help.stdout.golden @@ -108,6 +108,8 @@ Global Flags: is set to Off, Atmos will not log any messages (default Info) + --no-color Disable color output (default false) + --redirect-stderr string File descriptor to redirect stderr to. Errors can be redirected to any file or any standard file descriptor (including diff --git a/tests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden b/tests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden index 01eab6d26c..43ed32b577 100644 --- a/tests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden @@ -113,6 +113,8 @@ Global Flags: is set to Off, Atmos will not log any messages (default Info) + --no-color Disable color output (default false) + --redirect-stderr string File descriptor to redirect stderr to. Errors can be redirected to any file or any standard file descriptor (including diff --git a/tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden b/tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden index 944ee76cb4..9624ecd49d 100644 --- a/tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden @@ -46,6 +46,8 @@ Global Flags: log level is set to Off, Atmos will not log any messages (default Info) + --no-color Disable color output (default false) + --process-functions Enable/disable YAML functions processing in Atmos stack manifests when executing terraform commands (default true) diff --git a/tests/snapshots/TestCLICommands_atmos_terraform_apply_help.stdout.golden b/tests/snapshots/TestCLICommands_atmos_terraform_apply_help.stdout.golden index 944ee76cb4..9624ecd49d 100644 --- a/tests/snapshots/TestCLICommands_atmos_terraform_apply_help.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_terraform_apply_help.stdout.golden @@ -46,6 +46,8 @@ Global Flags: log level is set to Off, Atmos will not log any messages (default Info) + --no-color Disable color output (default false) + --process-functions Enable/disable YAML functions processing in Atmos stack manifests when executing terraform commands (default true) diff --git a/tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden b/tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden index 333ccd418f..69abb7204e 100644 --- a/tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden @@ -108,6 +108,8 @@ Global Flags: is set to Off, Atmos will not log any messages (default Info) + --no-color Disable color output (default false) + --redirect-stderr string File descriptor to redirect stderr to. Errors can be redirected to any file or any standard file descriptor (including diff --git a/tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden b/tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden index 8b3372aa12..eb05e0b34a 100644 --- a/tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden @@ -43,9 +43,6 @@ Flags: --init Create an initial configuration (default false) - --no-color Don't print colors (default - false) - --version Print the version number (default false) @@ -73,6 +70,8 @@ Global Flags: is set to Off, Atmos will not log any messages (default Info) + --no-color Disable color output (default false) + --redirect-stderr string File descriptor to redirect stderr to. Errors can be redirected to any file or any standard file descriptor (including diff --git a/tests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.golden b/tests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.golden index 8b3372aa12..eb05e0b34a 100644 --- a/tests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.golden +++ b/tests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.golden @@ -43,9 +43,6 @@ Flags: --init Create an initial configuration (default false) - --no-color Don't print colors (default - false) - --version Print the version number (default false) @@ -73,6 +70,8 @@ Global Flags: is set to Off, Atmos will not log any messages (default Info) + --no-color Disable color output (default false) + --redirect-stderr string File descriptor to redirect stderr to. Errors can be redirected to any file or any standard file descriptor (including diff --git a/tests/test-cases/empty-dir.yaml b/tests/test-cases/empty-dir.yaml index 388e747cde..09491449db 100644 --- a/tests/test-cases/empty-dir.yaml +++ b/tests/test-cases/empty-dir.yaml @@ -14,6 +14,17 @@ tests: - "^$" exit_code: 0 + - name: atmos support + enabled: true + snapshot: true + description: "Check that atmos support command outputs support details." + workdir: "fixtures/scenarios/empty-dir" + command: "atmos" + args: + - "support" + expect: + exit_code: 0 + - name: check atmos in empty-dir enabled: true snapshot: true diff --git a/website/docs/cli/configuration/configuration.mdx b/website/docs/cli/configuration/configuration.mdx index 8a3300b68e..52c54307b5 100644 --- a/website/docs/cli/configuration/configuration.mdx +++ b/website/docs/cli/configuration/configuration.mdx @@ -119,6 +119,7 @@ templates: settings: list_merge_strategy: replace terminal: + no_color: false # Disable color output (Can also be set using 'ATMOS_NO_COLOR' or 'NO_COLOR' ENV var or '--no-color' command-line argument) max_width: 120 # Maximum width for terminal output pager: true # Use pager for long output ``` diff --git a/website/docs/cli/configuration/markdown-styling.mdx b/website/docs/cli/configuration/markdown-styling.mdx index dfc73b63a1..94db94d9f6 100644 --- a/website/docs/cli/configuration/markdown-styling.mdx +++ b/website/docs/cli/configuration/markdown-styling.mdx @@ -25,7 +25,6 @@ settings: terminal: max_width: 120 # Maximum width for terminal output pager: true # Use pager for long output - colors: true unicode: true # Markdown element styling @@ -269,4 +268,4 @@ The styling is managed internally by Glamour and does not require manual configu ## See Also - [CLI Configuration](/cli/configuration) -- [Command Reference](/cli/commands) \ No newline at end of file +- [Command Reference](/cli/commands) diff --git a/website/docs/cli/configuration/terminal.mdx b/website/docs/cli/configuration/terminal.mdx index 6844e1c203..cfdaf30107 100644 --- a/website/docs/cli/configuration/terminal.mdx +++ b/website/docs/cli/configuration/terminal.mdx @@ -27,8 +27,8 @@ Configure general terminal behavior. These are also the default settings if not settings: terminal: max_width: 120 # Maximum width for terminal output - pager: true # Pager setting for all terminal output - colors: true # Enable colored output + pager: true # Pager setting for all terminal output + no_color: false # Disable color output unicode: true # Use Unicode characters in output ``` @@ -77,6 +77,10 @@ settings:
`wrap`
Wrap long lines (default: `false`)
+ +
`no_color`
+
Disable color output (default: `false`)
+ ### Example Usage