box: add --box-owned-by to only show items owned by the login passed #5545

This commit is contained in:
Nick Craig-Wood
2021-10-15 15:28:54 +01:00
parent 34140b2f57
commit 825f7826f5
2 changed files with 16 additions and 1 deletions
+9
View File
@@ -139,6 +139,11 @@ func init() {
Default: 1000,
Help: "Size of listing chunk 1-1000.",
Advanced: true,
}, {
Name: "owned_by",
Default: "",
Help: "Only show items owned by the login (email address) passed in.",
Advanced: true,
}, {
Name: config.ConfigEncoding,
Help: config.ConfigEncodingHelp,
@@ -254,6 +259,7 @@ type Options struct {
RootFolderID string `config:"root_folder_id"`
AccessToken string `config:"access_token"`
ListChunk int `config:"list_chunk"`
OwnedBy string `config:"owned_by"`
}
// Fs represents a remote box
@@ -619,6 +625,9 @@ OUTER:
if activeOnly && item.ItemStatus != api.ItemStatusActive {
continue
}
if f.opt.OwnedBy != "" && f.opt.OwnedBy != item.OwnedBy.Login {
continue
}
item.Name = f.opt.Enc.ToStandardName(item.Name)
if fn(item) {
found = true