aboutsummaryrefslogtreecommitdiff
path: root/weed/util/inits.go
diff options
context:
space:
mode:
authorbingoohuang <bingoo.huang@gmail.com>2020-05-29 16:15:33 +0800
committerbingoohuang <bingoo.huang@gmail.com>2020-05-29 16:15:33 +0800
commit1f8782a1ed504e5f7e7b62218bcf4502903d350f (patch)
tree6dad9d73f5fd3dbe96fbdf2d3eb0b018fae5a84a /weed/util/inits.go
parent1a642b98769ea604dfb74fa4d875bf42c24fda9f (diff)
downloadseaweedfs-1f8782a1ed504e5f7e7b62218bcf4502903d350f.tar.xz
seaweedfs-1f8782a1ed504e5f7e7b62218bcf4502903d350f.zip
try showing the first 100 volume ids and an extra ...
Diffstat (limited to 'weed/util/inits.go')
-rw-r--r--weed/util/inits.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/weed/util/inits.go b/weed/util/inits.go
index dfbf9da5f..378878012 100644
--- a/weed/util/inits.go
+++ b/weed/util/inits.go
@@ -5,6 +5,15 @@ import (
"sort"
)
+// HumanReadableIntsMax joins a serials of inits into a smart one like 1-3 5 ... for human readable.
+func HumanReadableIntsMax(max int, ids ...int) string {
+ if len(ids) <= max {
+ return HumanReadableInts(ids...)
+ }
+
+ return HumanReadableInts(ids[:max]...) + " ..."
+}
+
// HumanReadableInts joins a serials of inits into a smart one like 1-3 5 7-10 for human readable.
func HumanReadableInts(ids ...int) string {
sort.Ints(ids)