Improve output readability for mc stat command (#4597)
This commit is contained in:
+2
-1
@@ -12,4 +12,5 @@ mc
|
||||
.run*
|
||||
.idea/
|
||||
mc.RELEASE*
|
||||
mc.gz
|
||||
mc.gz
|
||||
.DS_Store
|
||||
@@ -35,7 +35,7 @@ var (
|
||||
)
|
||||
|
||||
// IsGetEvent checks if the event return is a get event.
|
||||
func IsGetEvent(event notify.Event) bool {
|
||||
func IsGetEvent(_ notify.Event) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ package cmd
|
||||
|
||||
import "os"
|
||||
|
||||
func increasePipeBufferSize(f *os.File, desiredPipeSize int) error {
|
||||
func increasePipeBufferSize(_ *os.File, _ int) error {
|
||||
// this is not supported on non-Linux platforms.
|
||||
return nil
|
||||
}
|
||||
|
||||
+11
-8
@@ -107,6 +107,17 @@ func (stat statMessage) String() (msg string) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if maxKeyEncrypted > 0 {
|
||||
if keyID, ok := stat.Metadata["X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id"]; ok {
|
||||
msgBuilder.WriteString(fmt.Sprintf("%-10s: SSE-%s (%s)\n", "Encryption", "KMS", keyID))
|
||||
} else if _, ok := stat.Metadata["X-Amz-Server-Side-Encryption-Customer-Key-Md5"]; ok {
|
||||
msgBuilder.WriteString(fmt.Sprintf("%-10s: SSE-%s\n", "Encryption", "C"))
|
||||
} else {
|
||||
msgBuilder.WriteString(fmt.Sprintf("%-10s: SSE-%s\n", "Encryption", "S3"))
|
||||
}
|
||||
}
|
||||
|
||||
if maxKeyMetadata > 0 {
|
||||
msgBuilder.WriteString(fmt.Sprintf("%-10s:", "Metadata") + "\n")
|
||||
for k, v := range stat.Metadata {
|
||||
@@ -117,14 +128,6 @@ func (stat statMessage) String() (msg string) {
|
||||
}
|
||||
}
|
||||
|
||||
if maxKeyEncrypted > 0 {
|
||||
msgBuilder.WriteString(fmt.Sprintf("%-10s:", "Encrypted") + "\n")
|
||||
for k, v := range stat.Metadata {
|
||||
if strings.HasPrefix(strings.ToLower(k), serverEncryptionKeyPrefix) {
|
||||
msgBuilder.WriteString(fmt.Sprintf(" %-*.*s: %s ", maxKeyEncrypted, maxKeyEncrypted, k, v) + "\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
if stat.ReplicationStatus != "" {
|
||||
msgBuilder.WriteString(fmt.Sprintf("%-10s: %s ", "Replication Status", stat.ReplicationStatus))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user