1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

fs: implement MetadataInfo to show info about metadata in help and rc

Info about this will appear in operations/fsinfo and in the backend
help (`rclone help backend s3`).
This commit is contained in:
Nick Craig-Wood
2022-06-22 15:56:41 +01:00
parent 6a0e021dac
commit 0652ec95db
6 changed files with 160 additions and 48 deletions

View File

@@ -2278,21 +2278,30 @@ type FsInfo struct {
// Features returns the optional features of this Fs
Features map[string]bool
// MetadataInfo returns info about the metadata for this backend
MetadataInfo *fs.MetadataInfo
}
// GetFsInfo gets the information (FsInfo) about a given Fs
func GetFsInfo(f fs.Fs) *FsInfo {
features := f.Features()
info := &FsInfo{
Name: f.Name(),
Root: f.Root(),
String: f.String(),
Precision: f.Precision(),
Hashes: make([]string, 0, 4),
Features: f.Features().Enabled(),
Name: f.Name(),
Root: f.Root(),
String: f.String(),
Precision: f.Precision(),
Hashes: make([]string, 0, 4),
Features: features.Enabled(),
MetadataInfo: nil,
}
for _, hashType := range f.Hashes().Array() {
info.Hashes = append(info.Hashes, hashType.String())
}
fsInfo, _, _, _, err := fs.ParseRemote(fs.ConfigString(f))
if err == nil && fsInfo != nil && fsInfo.MetadataInfo != nil {
info.MetadataInfo = fsInfo.MetadataInfo
}
return info
}