Skip to content

Commit

Permalink
Added no style flags to disable color output.
Browse files Browse the repository at this point in the history
  • Loading branch information
daveshanley committed Feb 1, 2023
1 parent 3af6fcc commit 3773289
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions cmd/html_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ func GetHTMLReportCommand() *cobra.Command {
doneChan := make(chan bool)
failed := false

noColorFlag, _ := cmd.Flags().GetBool("no-color")

if noColorFlag {
pterm.DisableStyling()
pterm.DisableColor()
}

PrintBanner()

// if there are no args, print out how to use the console.
Expand Down Expand Up @@ -182,6 +189,7 @@ func GetHTMLReportCommand() *cobra.Command {
return nil
},
}
cmd.Flags().BoolP("no-style", "n", false, "Disable color and style output (very useful for CI/CD)")
return cmd
}

Expand Down
1 change: 0 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ func init() {
rootCmd.AddCommand(GetReportCommand())
rootCmd.AddCommand(GetHTMLReportCommand())
rootCmd.PersistentFlags().BoolP("top", "t", false, "Only show latest changes (last git revision against HEAD)")

}

func initConfig() {
Expand Down
7 changes: 7 additions & 0 deletions cmd/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ func GetSummaryCommand() *cobra.Command {
doneChan := make(chan bool)
failed := false
latestFlag, _ := cmd.Flags().GetBool("top")
noColorFlag, _ := cmd.Flags().GetBool("no-color")

if noColorFlag {
pterm.DisableStyling()
pterm.DisableColor()
}

PrintBanner()

Expand Down Expand Up @@ -150,6 +156,7 @@ func GetSummaryCommand() *cobra.Command {
return nil
},
}
cmd.Flags().BoolP("no-style", "n", false, "Disable color and style output (very useful for CI/CD)")
return cmd
}

Expand Down

0 comments on commit 3773289

Please sign in to comment.