Skip to content

Commit 3ef67e2

Browse files
albertonyyuval-cloudinary
authored andcommitted
docs: group the different options affecting lsjson output
1 parent 33add3f commit 3ef67e2

File tree

1 file changed

+41
-34
lines changed

1 file changed

+41
-34
lines changed

cmd/lsjson/lsjson.go

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var commandDefinition = &cobra.Command{
4141
Short: `List directories and objects in the path in JSON format.`,
4242
Long: `List directories and objects in the path in JSON format.
4343
44-
The output is an array of Items, where each Item looks like this
44+
The output is an array of Items, where each Item looks like this:
4545
4646
{
4747
"Hashes" : {
@@ -63,44 +63,50 @@ The output is an array of Items, where each Item looks like this
6363
"Tier" : "hot",
6464
}
6565
66-
If ` + "`--hash`" + ` is not specified, the Hashes property will be omitted. The
67-
types of hash can be specified with the ` + "`--hash-type`" + ` parameter (which
68-
may be repeated). If ` + "`--hash-type`" + ` is set then it implies ` + "`--hash`" + `.
69-
70-
If ` + "`--no-modtime`" + ` is specified then ModTime will be blank. This can
71-
speed things up on remotes where reading the ModTime takes an extra
72-
request (e.g. s3, swift).
73-
74-
If ` + "`--no-mimetype`" + ` is specified then MimeType will be blank. This can
75-
speed things up on remotes where reading the MimeType takes an extra
76-
request (e.g. s3, swift).
77-
78-
If ` + "`--encrypted`" + ` is not specified the Encrypted will be omitted.
79-
80-
If ` + "`--dirs-only`" + ` is not specified files in addition to directories are
81-
returned
82-
83-
If ` + "`--files-only`" + ` is not specified directories in addition to the files
84-
will be returned.
85-
86-
If ` + "`--metadata`" + ` is set then an additional Metadata key will be returned.
87-
This will have metadata in rclone standard format as a JSON object.
88-
89-
if ` + "`--stat`" + ` is set then a single JSON blob will be returned about the
90-
item pointed to. This will return an error if the item isn't found.
91-
However on bucket based backends (like s3, gcs, b2, azureblob etc) if
92-
the item isn't found it will return an empty directory as it isn't
93-
possible to tell empty directories from missing directories there.
66+
The exact set of properties included depends on the backend:
67+
68+
- The property IsBucket will only be included for bucket-based remotes, and only
69+
for directories that are buckets. It will always be omitted when value is not true.
70+
- Properties Encrypted and EncryptedPath will only be included for encrypted
71+
remotes, and (as mentioned below) only if the ` + "`--encrypted`" + ` option is set.
72+
73+
Different options may also affect which properties are included:
74+
75+
- If ` + "`--hash`" + ` is not specified, the Hashes property will be omitted. The
76+
types of hash can be specified with the ` + "`--hash-type`" + ` parameter (which
77+
may be repeated). If ` + "`--hash-type`" + ` is set then it implies ` + "`--hash`" + `.
78+
- If ` + "`--no-modtime`" + ` is specified then ModTime will be blank. This can
79+
speed things up on remotes where reading the ModTime takes an extra
80+
request (e.g. s3, swift).
81+
- If ` + "`--no-mimetype`" + ` is specified then MimeType will be blank. This can
82+
speed things up on remotes where reading the MimeType takes an extra
83+
request (e.g. s3, swift).
84+
- If ` + "`--encrypted`" + ` is not specified the Encrypted and EncryptedPath
85+
properties will be omitted - even for encrypted remotes.
86+
- If ` + "`--metadata`" + ` is set then an additional Metadata property will be
87+
returned. This will have [metadata](/docs/#metadata) in rclone standard format
88+
as a JSON object.
89+
90+
The default is to list directories and files/objects, but this can be changed
91+
with the following options:
92+
93+
- If ` + "`--dirs-only`" + ` is specified then directories will be returned
94+
only, no files/objects.
95+
- If ` + "`--files-only`" + ` is specified then files will be returned only,
96+
no directories.
97+
98+
If ` + "`--stat`" + ` is set then the the output is not an array of items,
99+
but instead a single JSON blob will be returned about the item pointed to.
100+
This will return an error if the item isn't found, however on bucket based
101+
backends (like s3, gcs, b2, azureblob etc) if the item isn't found it will
102+
return an empty directory, as it isn't possible to tell empty directories
103+
from missing directories there.
94104
95105
The Path field will only show folders below the remote path being listed.
96106
If "remote:path" contains the file "subfolder/file.txt", the Path for "file.txt"
97107
will be "subfolder/file.txt", not "remote:path/subfolder/file.txt".
98108
When used without ` + "`--recursive`" + ` the Path will always be the same as Name.
99109
100-
If the directory is a bucket in a bucket-based backend, then
101-
"IsBucket" will be set to true. This key won't be present unless it is
102-
"true".
103-
104110
The time is in RFC3339 format with up to nanosecond precision. The
105111
number of decimal digits in the seconds will depend on the precision
106112
that the remote can hold the times, so if times are accurate to the
@@ -110,7 +116,8 @@ accurate to the nearest second (Dropbox, Box, WebDav, etc.) no digits
110116
will be shown ("2017-05-31T16:15:57+01:00").
111117
112118
The whole output can be processed as a JSON blob, or alternatively it
113-
can be processed line by line as each item is written one to a line.
119+
can be processed line by line as each item is written on individual lines
120+
(except with ` + "`--stat`" + `).
114121
` + lshelp.Help,
115122
Annotations: map[string]string{
116123
"versionIntroduced": "v1.37",

0 commit comments

Comments
 (0)