forked from TrueCloudLab/rclone
box: add --box-owned-by to only show items owned by the login passed #5545
This commit is contained in:
parent
34140b2f57
commit
825f7826f5
2 changed files with 16 additions and 1 deletions
|
@ -61,7 +61,7 @@ func (e *Error) Error() string {
|
||||||
var _ error = (*Error)(nil)
|
var _ error = (*Error)(nil)
|
||||||
|
|
||||||
// ItemFields are the fields needed for FileInfo
|
// ItemFields are the fields needed for FileInfo
|
||||||
var ItemFields = "type,id,sequence_id,etag,sha1,name,size,created_at,modified_at,content_created_at,content_modified_at,item_status,shared_link"
|
var ItemFields = "type,id,sequence_id,etag,sha1,name,size,created_at,modified_at,content_created_at,content_modified_at,item_status,shared_link,owned_by"
|
||||||
|
|
||||||
// Types of things in Item
|
// Types of things in Item
|
||||||
const (
|
const (
|
||||||
|
@ -90,6 +90,12 @@ type Item struct {
|
||||||
URL string `json:"url,omitempty"`
|
URL string `json:"url,omitempty"`
|
||||||
Access string `json:"access,omitempty"`
|
Access string `json:"access,omitempty"`
|
||||||
} `json:"shared_link"`
|
} `json:"shared_link"`
|
||||||
|
OwnedBy struct {
|
||||||
|
Type string `json:"type"`
|
||||||
|
ID string `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Login string `json:"login"`
|
||||||
|
} `json:"owned_by"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ModTime returns the modification time of the item
|
// ModTime returns the modification time of the item
|
||||||
|
|
|
@ -139,6 +139,11 @@ func init() {
|
||||||
Default: 1000,
|
Default: 1000,
|
||||||
Help: "Size of listing chunk 1-1000.",
|
Help: "Size of listing chunk 1-1000.",
|
||||||
Advanced: true,
|
Advanced: true,
|
||||||
|
}, {
|
||||||
|
Name: "owned_by",
|
||||||
|
Default: "",
|
||||||
|
Help: "Only show items owned by the login (email address) passed in.",
|
||||||
|
Advanced: true,
|
||||||
}, {
|
}, {
|
||||||
Name: config.ConfigEncoding,
|
Name: config.ConfigEncoding,
|
||||||
Help: config.ConfigEncodingHelp,
|
Help: config.ConfigEncodingHelp,
|
||||||
|
@ -254,6 +259,7 @@ type Options struct {
|
||||||
RootFolderID string `config:"root_folder_id"`
|
RootFolderID string `config:"root_folder_id"`
|
||||||
AccessToken string `config:"access_token"`
|
AccessToken string `config:"access_token"`
|
||||||
ListChunk int `config:"list_chunk"`
|
ListChunk int `config:"list_chunk"`
|
||||||
|
OwnedBy string `config:"owned_by"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fs represents a remote box
|
// Fs represents a remote box
|
||||||
|
@ -619,6 +625,9 @@ OUTER:
|
||||||
if activeOnly && item.ItemStatus != api.ItemStatusActive {
|
if activeOnly && item.ItemStatus != api.ItemStatusActive {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if f.opt.OwnedBy != "" && f.opt.OwnedBy != item.OwnedBy.Login {
|
||||||
|
continue
|
||||||
|
}
|
||||||
item.Name = f.opt.Enc.ToStandardName(item.Name)
|
item.Name = f.opt.Enc.ToStandardName(item.Name)
|
||||||
if fn(item) {
|
if fn(item) {
|
||||||
found = true
|
found = true
|
||||||
|
|
Loading…
Reference in a new issue