@@ -2,6 +2,7 @@ package cliconfig
22
33import (
44 "fmt"
5+ "os"
56 "path/filepath"
67
78 "github.com/fatih/color"
@@ -29,17 +30,17 @@ func (cli *cliConfig) featureFlags(showRetired bool) error {
2930 status = green ("✓" )
3031 }
3132
32- fmt .Printf ( "%s %s" , status , nameDesc )
33+ fmt .Fprintf ( os . Stdout , "%s %s" , status , nameDesc )
3334
3435 if feat .State == fflag .DeprecatedState {
35- fmt .Printf ( "\n %s %s" , yellow ("DEPRECATED" ), feat .DeprecationMsg )
36+ fmt .Fprintf ( os . Stdout , "\n %s %s" , yellow ("DEPRECATED" ), feat .DeprecationMsg )
3637 }
3738
3839 if feat .State == fflag .RetiredState {
39- fmt .Printf ( "\n %s %s" , magenta ("RETIRED" ), feat .DeprecationMsg )
40+ fmt .Fprintf ( os . Stdout , "\n %s %s" , magenta ("RETIRED" ), feat .DeprecationMsg )
4041 }
4142
42- fmt .Println ( )
43+ fmt .Fprintln ( os . Stdout )
4344 }
4445
4546 feats := fflag .Crowdsec .GetAllFeatures ()
@@ -63,53 +64,53 @@ func (cli *cliConfig) featureFlags(showRetired bool) error {
6364 }
6465
6566 if len (enabled ) > 0 {
66- fmt .Println ( " --- Enabled features ---" )
67- fmt .Println ( )
67+ fmt .Fprintln ( os . Stdout , " --- Enabled features ---" )
68+ fmt .Fprintln ( os . Stdout )
6869
6970 for _ , feat := range enabled {
7071 printFeature (feat )
7172 }
7273
73- fmt .Println ( )
74+ fmt .Fprintln ( os . Stdout )
7475 }
7576
7677 if len (disabled ) > 0 {
77- fmt .Println ( " --- Disabled features ---" )
78- fmt .Println ( )
78+ fmt .Fprintln ( os . Stdout , " --- Disabled features ---" )
79+ fmt .Fprintln ( os . Stdout )
7980
8081 for _ , feat := range disabled {
8182 printFeature (feat )
8283 }
8384
84- fmt .Println ( )
85+ fmt .Fprintln ( os . Stdout )
8586 }
8687
87- fmt .Println ( "To enable a feature you can: " )
88- fmt .Println ( " - set the environment variable CROWDSEC_FEATURE_<uppercase_feature_name> to true" )
88+ fmt .Fprintln ( os . Stdout , "To enable a feature you can: " )
89+ fmt .Fprintln ( os . Stdout , " - set the environment variable CROWDSEC_FEATURE_<uppercase_feature_name> to true" )
8990
9091 featurePath , err := filepath .Abs (csconfig .GetFeatureFilePath (cli .cfg ().FilePath ))
9192 if err != nil {
9293 // we already read the file, shouldn't happen
9394 return err
9495 }
9596
96- fmt .Printf ( " - add the line '- <feature_name>' to the file %s\n " , featurePath )
97- fmt .Println ( )
97+ fmt .Fprintf ( os . Stdout , " - add the line '- <feature_name>' to the file %s\n " , featurePath )
98+ fmt .Fprintln ( os . Stdout )
9899
99100 if len (enabled ) == 0 && len (disabled ) == 0 {
100- fmt .Println ( "However, no feature flag is available in this release." )
101- fmt .Println ( )
101+ fmt .Fprintln ( os . Stdout , "However, no feature flag is available in this release." )
102+ fmt .Fprintln ( os . Stdout )
102103 }
103104
104105 if showRetired && len (retired ) > 0 {
105- fmt .Println ( " --- Retired features ---" )
106- fmt .Println ( )
106+ fmt .Fprintln ( os . Stdout , " --- Retired features ---" )
107+ fmt .Fprintln ( os . Stdout )
107108
108109 for _ , feat := range retired {
109110 printFeature (feat )
110111 }
111112
112- fmt .Println ( )
113+ fmt .Fprintln ( os . Stdout )
113114 }
114115
115116 return nil
0 commit comments