Skip to content

Commit

Permalink
Improve output of "kafkactl get topics"
Browse files Browse the repository at this point in the history
  • Loading branch information
fgrosse committed Feb 21, 2023
1 parent 629316e commit 50f8768
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/get/get_topics.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,11 @@ func shortDuration(d time.Duration) string {
return fmt.Sprintf("%d days", int(hours/24))
}

// if we have less than 24h and a round number of hours then output simpler format
if hours <= 24 && minutes == 0 {
return fmt.Sprintf("%d hours", int(hours))
}

// if we have less than 1h, display minutes only
if int(hours) == 0 {
return fmt.Sprintf("%dm", int(minutes))
Expand Down

0 comments on commit 50f8768

Please sign in to comment.