Skip to content

Commit

Permalink
Merge pull request #107 from subhamkrai/fix-adding-empty-log
Browse files Browse the repository at this point in the history
status: remove extra empty line logging
  • Loading branch information
subhamkrai authored May 23, 2023
2 parents 04e4ffa + df1ab8b commit ad5c057
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions pkg/logging/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ import (

func Info(output string, args ...interface{}) {
blue := color.New(color.FgBlue).SprintFunc()
fmt.Print(blue("Info: "))
fmt.Printf(output, args...)
if output != "" {
fmt.Print(blue("Info: "))
fmt.Printf(output, args...)
}

fmt.Println()
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/rook/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ func PrintCustomResourceStatus(clusterNamespace string, arg []string) {
if len(arg) == 1 && arg[0] == "all" {
command := fmt.Sprintf(getCrdList, clusterNamespace)
allCRs := strings.Split(exec.ExecuteBashCommand(command), "\n")
logging.Info(allCRs[0])
allCRs = allCRs[:len(allCRs)-1] // remove last empty line which is not a CR
for _, cr := range allCRs {
logging.Info(cr)
command := fmt.Sprintf(scriptPrintSpecificCRStatus, clusterNamespace, cr)
logging.Info(exec.ExecuteBashCommand(command))
fmt.Println(exec.ExecuteBashCommand(command))
}

} else if len(arg) == 1 {
Expand Down

0 comments on commit ad5c057

Please sign in to comment.