File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import (
1717 "github.com/snyk/driftctl/pkg/config"
1818 "github.com/snyk/driftctl/pkg/version"
1919 "github.com/snyk/driftctl/sentry"
20+ "github.com/spf13/viper"
2021)
2122
2223func init () {
@@ -33,12 +34,20 @@ func run() int {
3334 config .Init ()
3435 logger .Init ()
3536 build := build.Build {}
37+ // Check whether driftCTL is run under Snyk CLI
38+ isSnyk := viper .GetBool ("IS_SNYK" )
3639 logrus .WithFields (logrus.Fields {
3740 "isRelease" : fmt .Sprintf ("%t" , build .IsRelease ()),
3841 "isUsageReportingEnabled" : fmt .Sprintf ("%t" , build .IsUsageReportingEnabled ()),
3942 "version" : version .Current (),
43+ "isSnyk" : fmt .Sprintf ("%t" , isSnyk ),
4044 }).Debug ("Build info" )
4145
46+ // Enable colorization when driftctl is launched under snyk cli (piped)
47+ if isSnyk {
48+ color .NoColor = false
49+ }
50+
4251 driftctlCmd := cmd .NewDriftctlCmd (build )
4352
4453 checkVersion := driftctlCmd .ShouldCheckVersion ()
You can’t perform that action at this time.
0 commit comments