mirror of
https://github.com/rclone/rclone.git
synced 2025-01-22 14:19:56 +01:00
lsjson: add ID field to output to show Object ID - fixes #1901
This commit is contained in:
parent
909c3a92d6
commit
f162116132
@ -42,6 +42,7 @@ type lsJSON struct {
|
|||||||
ModTime Timestamp //`json:",omitempty"`
|
ModTime Timestamp //`json:",omitempty"`
|
||||||
IsDir bool
|
IsDir bool
|
||||||
Hashes map[string]string `json:",omitempty"`
|
Hashes map[string]string `json:",omitempty"`
|
||||||
|
ID string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Timestamp a time in RFC3339 format with Nanosecond precision secongs
|
// Timestamp a time in RFC3339 format with Nanosecond precision secongs
|
||||||
@ -69,6 +70,7 @@ The output is an array of Items, where each Item looks like this
|
|||||||
"MD5" : "b1946ac92492d2347c6235b4d2611184",
|
"MD5" : "b1946ac92492d2347c6235b4d2611184",
|
||||||
"DropboxHash" : "ecb65bb98f9d905b70458986c39fcbad7715e5f2fcc3b1f07767d7c83e2438cc"
|
"DropboxHash" : "ecb65bb98f9d905b70458986c39fcbad7715e5f2fcc3b1f07767d7c83e2438cc"
|
||||||
},
|
},
|
||||||
|
"ID": "y2djkhiujf83u33",
|
||||||
"IsDir" : false,
|
"IsDir" : false,
|
||||||
"ModTime" : "2017-05-31T16:15:57.034468261+01:00",
|
"ModTime" : "2017-05-31T16:15:57.034468261+01:00",
|
||||||
"Name" : "file.txt",
|
"Name" : "file.txt",
|
||||||
@ -138,6 +140,9 @@ can be processed line by line as each item is written one to a line.
|
|||||||
fs.Errorf(nil, "Unknown type %T in listing", entry)
|
fs.Errorf(nil, "Unknown type %T in listing", entry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if do, ok := entry.(fs.IDer); ok {
|
||||||
|
item.ID = do.ID()
|
||||||
|
}
|
||||||
switch x := entry.(type) {
|
switch x := entry.(type) {
|
||||||
case fs.Directory:
|
case fs.Directory:
|
||||||
item.IsDir = true
|
item.IsDir = true
|
||||||
|
Loading…
Reference in New Issue
Block a user