lsjson, lsf: support showing the Tier of the object
This commit is contained in:
parent
eeab7a0a43
commit
a57756a05c
3 changed files with 17 additions and 0 deletions
|
@ -23,6 +23,7 @@ type ListJSONItem struct {
|
|||
Hashes map[string]string `json:",omitempty"`
|
||||
ID string `json:",omitempty"`
|
||||
OrigID string `json:",omitempty"`
|
||||
Tier string `json:",omitempty"`
|
||||
}
|
||||
|
||||
// Timestamp a time in the provided format
|
||||
|
@ -91,6 +92,7 @@ func ListJSON(fsrc fs.Fs, remote string, opt *ListJSONOpt, callback func(*ListJS
|
|||
return errors.Wrap(err, "ListJSON failed to make new crypt remote")
|
||||
}
|
||||
}
|
||||
canGetTier := fsrc.Features().GetTier
|
||||
format := formatForPrecision(fsrc.Precision())
|
||||
err := walk.ListR(fsrc, remote, false, ConfigMaxDepth(opt.Recurse), walk.ListAll, func(entries fs.DirEntries) (err error) {
|
||||
for _, entry := range entries {
|
||||
|
@ -163,6 +165,11 @@ func ListJSON(fsrc fs.Fs, remote string, opt *ListJSONOpt, callback func(*ListJS
|
|||
}
|
||||
}
|
||||
}
|
||||
if canGetTier {
|
||||
if do, ok := x.(fs.GetTierer); ok {
|
||||
item.Tier = do.GetTier()
|
||||
}
|
||||
}
|
||||
default:
|
||||
fs.Errorf(nil, "Unknown type %T in listing in ListJSON", entry)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue