We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 48574c2 commit f9748d5Copy full SHA for f9748d5
1 file changed
src/cmd/say.go
@@ -7,8 +7,11 @@ package cmd
7
import (
8
"fmt"
9
"os"
10
+ "regexp"
11
12
"github.com/spf13/cobra"
13
+
14
+ "github.com/zarf-dev/zarf/src/pkg/message"
15
)
16
17
func sayCommand() *cobra.Command {
@@ -17,7 +20,13 @@ func sayCommand() *cobra.Command {
20
Short: "Print Zarf logo",
18
21
Long: "Print out the adorable Zarf logo",
19
22
RunE: func(_ *cobra.Command, _ []string) error {
- _, err := fmt.Fprintln(os.Stderr, logo())
23
+ out := logo()
24
+ if !message.ColorEnabled() {
25
+ // Strip ANSI color codes - https://regex101.com/r/YFyIwC/2
26
+ ansiRegex := regexp.MustCompile(`\x1b\[(.*?)m`)
27
+ out = ansiRegex.ReplaceAllString(out, "")
28
+ }
29
+ _, err := fmt.Fprintln(os.Stderr, out)
30
return err
31
},
32
}
0 commit comments