Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

status: remove extra empty line logging #107

Merged
merged 1 commit into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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...)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a blank line will still be helpful if it's blank

Suggested change
}
} else {
fmt.Println()
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is already new line

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh right, I overlooked it, thanks


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" {
subhamkrai marked this conversation as resolved.
Show resolved Hide resolved
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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logging.Info() is printing "Info:" with no other info for other commands besides the example given in the issue. Instead of changing the implementation here, try just change inside the logging.Info() method to only print a blank line if there is no message.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be good now

fmt.Println(exec.ExecuteBashCommand(command))
}

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