minio / mc

Unix like utilities for object store
https://min.io/download
GNU Affero General Public License v3.0
2.86k stars 548 forks source link

Humanize object size #4766

Closed Cdaprod closed 10 months ago

Cdaprod commented 11 months ago

Community Contribution License

All community contributions in this pull request are licensed to the project maintainers under the terms of the [Apache 2 license] (https://www.apache.org/licenses/LICENSE-2.0). By creating this pull request I represent that I have the right to license the contributions to the project maintainers under the Apache 2 license.

Description

This PR introduces enhancements to stat.go in the MinIO mc tool, implementing humanized formatting for object counts in the mc stat command output. By adopting comma-separated values, this update significantly improves the readability of large numbers.

Furthermore, the stat_test.go file has been augmented to include comprehensive tests for these new formatting features. These tests rigorously verify that the humanized output adheres to the expected format across a range of scenarios.

Changes Summary

These changes aim to enhance the readability of the mc stat command output, particularly when dealing with large object counts.

Motivation and Context

When dealing with large object counts, it's easier for users to read and understand the numbers when they're formatted with commas. This change enhances the user experience by making the output of mc stat more accessible, especially when presenting large datasets.

How to test this PR?

Manual Testing of mc stat

Automated Testing

The tests should cover various scenarios and check if the humanized output is as expected for different object sizes. These tests ensure that both the new functionality and existing features of the mc stat command work as intended.

Types of changes

Checklist:

klauspost commented 11 months ago

@Cdaprod

Error: cmd/stat_test.go:43:2: expected operand, found '}'
Error: make: *** [Makefile:33: vet] Error 1
Error: Process completed with exit code 2.
Cdaprod commented 11 months ago

I am adding bubbletea to the mc stat.go to give it a more appealing output.

harshavardhana commented 10 months ago

Please resubmit when its ready @Cdaprod