docs: add missing code section formatting to commands and flags

This commit is contained in:
albertony 2022-06-19 19:55:37 +02:00
parent 9f81b4df4f
commit 53f831f40a
17 changed files with 100 additions and 99 deletions

View File

@ -29,7 +29,7 @@ var commandDefinition = &cobra.Command{
rclone cryptdecode returns unencrypted file names when provided with
a list of encrypted file names. List limit is 10 items.
If you supply the --reverse flag, it will return encrypted file names.
If you supply the ` + "`--reverse`" + ` flag, it will return encrypted file names.
use it like this

View File

@ -37,7 +37,7 @@ Opendrive) that can have duplicate file names. It can be run on wrapping backend
(e.g. crypt) if they wrap a backend which supports duplicate file
names.
However if --by-hash is passed in then dedupe will find files with
However if ` + "`--by-hash`" + ` is passed in then dedupe will find files with
duplicate hashes instead which will work on any backend which supports
at least one hash. This can be used to find files with duplicate
content. This is known as deduping by hash.

View File

@ -14,6 +14,6 @@ var completionDefinition = &cobra.Command{
Short: `Output completion script for a given shell.`,
Long: `
Generates a shell completion script for rclone.
Run with --help to list the supported shells.
Run with ` + "`--help`" + ` to list the supported shells.
`,
}

View File

@ -27,7 +27,7 @@ var commandDefinition = &cobra.Command{
Long: `
rclone listremotes lists all the available remotes from the config file.
When uses with the -l flag it lists the types too.
When used with the ` + "`--long`" + ` flag it lists the types too.
`,
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(0, 0, command, args)

View File

@ -27,7 +27,7 @@ var commandDefinition = &cobra.Command{
Short: `List all directories/containers/buckets in the path.`,
Long: `
Lists the directories in the source path to standard output. Does not
recurse by default. Use the -R flag to recurse.
recurse by default. Use the ` + "`-R`" + ` flag to recurse.
This command lists the total size of the directory (if known, -1 if
not), the modification time (if known, the current time if not), the
@ -45,7 +45,7 @@ Or
-1 2017-01-03 14:40:54 -1 2500files
-1 2017-07-08 14:39:28 -1 4000files
If you just want the directory names use "rclone lsf --dirs-only".
If you just want the directory names use ` + "`rclone lsf --dirs-only`" + `.
` + lshelp.Help,
Run: func(command *cobra.Command, args []string) {

View File

@ -59,7 +59,7 @@ Eg
ferejej3gux/
fubuwic
Use the --format option to control what gets listed. By default this
Use the ` + "`--format`" + ` option to control what gets listed. By default this
is just the path, but you can use these parameters to control the
output:
@ -74,7 +74,7 @@ output:
T - tier of storage if known, e.g. "Hot" or "Cool"
So if you wanted the path, size and modification time, you would use
--format "pst", or maybe --format "tsp" to put the path last.
` + "`--format \"pst\"`, or maybe `--format \"tsp\"`" + ` to put the path last.
Eg
@ -86,7 +86,7 @@ Eg
2016-06-25 18:55:40;37600;fubuwic
If you specify "h" in the format you will get the MD5 hash by default,
use the "--hash" flag to change which hash you want. Note that this
use the ` + "`--hash`" + ` flag to change which hash you want. Note that this
can be returned as an empty string if it isn't available on the object
(and for directories), "ERROR" if there was an error reading it from
the object and "UNSUPPORTED" if that object does not support that hash
@ -108,7 +108,7 @@ Eg
(Though "rclone md5sum ." is an easier way of typing this.)
By default the separator is ";" this can be changed with the
--separator flag. Note that separators aren't escaped in the path so
` + "`--separator`" + ` flag. Note that separators aren't escaped in the path so
putting it last is a good strategy.
Eg
@ -130,8 +130,8 @@ Eg
test.sh,449
"this file contains a comma, in the file name.txt",6
Note that the --absolute parameter is useful for making lists of files
to pass to an rclone copy with the --files-from-raw flag.
Note that the ` + "`--absolute`" + ` parameter is useful for making lists of files
to pass to an rclone copy with the ` + "`--files-from-raw`" + ` flag.
For example, to find all the files modified within one day and copy
those only (without traversing the whole directory structure):

View File

@ -61,27 +61,27 @@ The output is an array of Items, where each Item looks like this
"Tier" : "hot",
}
If --hash is not specified the Hashes property won't be emitted. The
types of hash can be specified with the --hash-type parameter (which
may be repeated). If --hash-type is set then it implies --hash.
If ` + "`--hash`" + ` is not specified the Hashes property won't be emitted. The
types of hash can be specified with the ` + "`--hash-type`" + ` parameter (which
may be repeated). If ` + "`--hash-type`" + ` is set then it implies ` + "`--hash`" + `.
If --no-modtime is specified then ModTime will be blank. This can
If ` + "`--no-modtime`" + ` is specified then ModTime will be blank. This can
speed things up on remotes where reading the ModTime takes an extra
request (e.g. s3, swift).
If --no-mimetype is specified then MimeType will be blank. This can
If ` + "`--no-mimetype`" + ` is specified then MimeType will be blank. This can
speed things up on remotes where reading the MimeType takes an extra
request (e.g. s3, swift).
If --encrypted is not specified the Encrypted won't be emitted.
If ` + "`--encrypted`" + ` is not specified the Encrypted won't be emitted.
If --dirs-only is not specified files in addition to directories are
If ` + "`--dirs-only`" + ` is not specified files in addition to directories are
returned
If --files-only is not specified directories in addition to the files
If ` + "`--files-only`" + ` is not specified directories in addition to the files
will be returned.
if --stat is set then a single JSON blob will be returned about the
if ` + "`--stat`" + ` is set then a single JSON blob will be returned about the
item pointed to. This will return an error if the item isn't found.
However on bucket based backends (like s3, gcs, b2, azureblob etc) if
the item isn't found it will return an empty directory as it isn't
@ -90,7 +90,7 @@ possible to tell empty directories from missing directories there.
The Path field will only show folders below the remote path being listed.
If "remote:path" contains the file "subfolder/file.txt", the Path for "file.txt"
will be "subfolder/file.txt", not "remote:path/subfolder/file.txt".
When used without --recursive the Path will always be the same as Name.
When used without ` + "`--recursive`" + ` the Path will always be the same as Name.
If the directory is a bucket in a bucket-based backend, then
"IsBucket" will be set to true. This key won't be present unless it is

View File

@ -50,26 +50,26 @@ var commandDefinition = &cobra.Command{
Short: `Run a command against a running rclone.`,
Long: `
This runs a command against a running rclone. Use the --url flag to
This runs a command against a running rclone. Use the ` + "`--url`" + ` flag to
specify an non default URL to connect on. This can be either a
":port" which is taken to mean "http://localhost:port" or a
"host:port" which is taken to mean "http://host:port"
A username and password can be passed in with --user and --pass.
A username and password can be passed in with ` + "`--user`" + ` and ` + "`--pass`" + `.
Note that --rc-addr, --rc-user, --rc-pass will be read also for --url,
--user, --pass.
Note that ` + "`--rc-addr`, `--rc-user`, `--rc-pass`" + ` will be read also for
` + "`--url`, `--user`, `--pass`" + `.
Arguments should be passed in as parameter=value.
The result will be returned as a JSON object by default.
The --json parameter can be used to pass in a JSON blob as an input
The ` + "`--json`" + ` parameter can be used to pass in a JSON blob as an input
instead of key=value arguments. This is the only way of passing in
more complicated values.
The -o/--opt option can be used to set a key "opt" with key, value
options in the form "-o key=value" or "-o key". It can be repeated as
The ` + "`-o`/`--opt`" + ` option can be used to set a key "opt" with key, value
options in the form ` + "`-o key=value` or `-o key`" + `. It can be repeated as
many times as required. This is useful for rc commands which take the
"opt" parameter which by convention is a dictionary of strings.
@ -80,7 +80,7 @@ Will place this in the "opt" value
{"key":"value", "key2","")
The -a/--arg option can be used to set strings in the "arg" value. It
The ` + "`-a`/`--arg`" + ` option can be used to set strings in the "arg" value. It
can be repeated as many times as required. This is useful for rc
commands which take the "arg" parameter which by convention is a list
of strings.
@ -91,13 +91,13 @@ Will place this in the "arg" value
["value", "value2"]
Use --loopback to connect to the rclone instance running "rclone rc".
Use ` + "`--loopback`" + ` to connect to the rclone instance running ` + "`rclone rc`" + `.
This is very useful for testing commands without having to run an
rclone rc server, e.g.:
rclone rc --loopback operations/about fs=/
Use "rclone rc" to see a list of all possible commands.`,
Use ` + "`rclone rc`" + ` to see a list of all possible commands.`,
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(0, 1e9, command, args)
cmd.Run(false, false, command, func() error {

View File

@ -44,11 +44,11 @@ must fit into RAM. The cutoff needs to be small enough to adhere
the limits of your remote, please see there. Generally speaking,
setting this cutoff too high will decrease your performance.
Use the |--size| flag to preallocate the file in advance at the remote end
Use the ` + "`--size`" + ` flag to preallocate the file in advance at the remote end
and actually stream it, even if remote backend doesn't support streaming.
|--size| should be the exact size of the input stream in bytes. If the
size of the stream is different in length to the |--size| passed in
` + "`--size`" + ` should be the exact size of the input stream in bytes. If the
size of the stream is different in length to the ` + "`--size`" + ` passed in
then the transfer will likely fail.
Note that the upload can also not be retried because the data is

View File

@ -19,7 +19,7 @@ import (
var Help = `
#### Template
--template allows a user to specify a custom markup template for HTTP
` + "`--template`" + ` allows a user to specify a custom markup template for HTTP
and WebDAV serve functions. The server exports the following markup
to be used within the template to server pages:

View File

@ -51,12 +51,12 @@ var Command = &cobra.Command{
This can be viewed in a web browser or you can make a remote of type
http read from it.
You can use the filter flags (e.g. --include, --exclude) to control what
You can use the filter flags (e.g. ` + "`--include`, `--exclude`" + `) to control what
is served.
The server will log errors. Use -v to see access logs.
The server will log errors. Use ` + "`-v`" + ` to see access logs.
--bwlimit will be respected for file transfers. Use --stats to
` + "`--bwlimit`" + ` will be respected for file transfers. Use ` + "`--stats`" + ` to
control the stats printing.
` + httplib.Help + data.Help + auth.Help + vfs.Help,
Run: func(command *cobra.Command, args []string) {

View File

@ -30,30 +30,30 @@ var ()
var Help = `
### Server options
Use --addr to specify which IP address and port the server should
listen on, e.g. --addr 1.2.3.4:8000 or --addr :8080 to listen to all
IPs. By default it only listens on localhost. You can use port
Use ` + "`--addr`" + ` to specify which IP address and port the server should
listen on, e.g. ` + "`--addr 1.2.3.4:8000` or `--addr :8080`" + ` to
listen to all IPs. By default it only listens on localhost. You can use port
:0 to let the OS choose an available port.
If you set --addr to listen on a public or LAN accessible IP address
If you set ` + "`--addr`" + ` to listen on a public or LAN accessible IP address
then using Authentication is advised - see the next section for info.
--server-read-timeout and --server-write-timeout can be used to
` + "`--server-read-timeout` and `--server-write-timeout`" + ` can be used to
control the timeouts on the server. Note that this is the total time
for a transfer.
--max-header-bytes controls the maximum number of bytes the server will
` + "`--max-header-bytes`" + ` controls the maximum number of bytes the server will
accept in the HTTP header.
--baseurl controls the URL prefix that rclone serves from. By default
rclone will serve from the root. If you used --baseurl "/rclone" then
` + "`--baseurl`" + ` controls the URL prefix that rclone serves from. By default
rclone will serve from the root. If you used ` + "`--baseurl \"/rclone\"`" + ` then
rclone would serve from a URL starting with "/rclone/". This is
useful if you wish to proxy rclone serve. Rclone automatically
inserts leading and trailing "/" on --baseurl, so --baseurl "rclone",
--baseurl "/rclone" and --baseurl "/rclone/" are all treated
inserts leading and trailing "/" on ` + "`--baseurl`" + `, so ` + "`--baseurl \"rclone\"`" + `,
` + "`--baseurl \"/rclone\"` and `--baseurl \"/rclone/\"`" + ` are all treated
identically.
--template allows a user to specify a custom markup template for HTTP
` + "`--template`" + ` allows a user to specify a custom markup template for HTTP
and WebDAV serve functions. The server exports the following markup
to be used within the template to server pages:
@ -81,9 +81,9 @@ to be used within the template to server pages:
By default this will serve files without needing a login.
You can either use an htpasswd file which can take lots of users, or
set a single username and password with the --user and --pass flags.
set a single username and password with the ` + "`--user` and `--pass`" + ` flags.
Use --htpasswd /path/to/htpasswd to provide an htpasswd file. This is
Use ` + "`--htpasswd /path/to/htpasswd`" + ` to provide an htpasswd file. This is
in standard apache format and supports MD5, SHA1 and BCrypt for basic
authentication. Bcrypt is recommended.
@ -95,18 +95,18 @@ To create an htpasswd file:
The password file can be updated while rclone is running.
Use --realm to set the authentication realm.
Use ` + "`--realm`" + ` to set the authentication realm.
#### SSL/TLS
By default this will serve over HTTP. If you want you can serve over
HTTPS. You will need to supply the --cert and --key flags. If you
wish to do client side certificate validation then you will need to
supply --client-ca also.
HTTPS. You will need to supply the ` + "`--cert` and `--key`" + ` flags.
If you wish to do client side certificate validation then you will need to
supply ` + "`--client-ca`" + ` also.
--cert should be either a PEM encoded certificate or a concatenation
of that with the CA certificate. --key should be the PEM encoded
private key and --client-ca should be the PEM encoded client
` + "`--cert`" + ` should be either a PEM encoded certificate or a concatenation
of that with the CA certificate. ` + "`--key`" + ` should be the PEM encoded
private key and ` + "`--client-ca`" + ` should be the PEM encoded client
certificate authority certificate.
`

View File

@ -59,8 +59,8 @@ backups.
The server will log errors. Use -v to see access logs.
--bwlimit will be respected for file transfers. Use --stats to
control the stats printing.
` + "`--bwlimit`" + ` will be respected for file transfers.
Use ` + "`--stats`" + ` to control the stats printing.
### Setting up rclone for use by restic ###
@ -79,11 +79,11 @@ Where you can replace "backup" in the above by whatever path in the
remote you wish to use.
By default this will serve on "localhost:8080" you can change this
with use of the "--addr" flag.
with use of the ` + "`--addr`" + ` flag.
You might wish to start this server on boot.
Adding --cache-objects=false will cause rclone to stop caching objects
Adding ` + "`--cache-objects=false`" + ` will cause rclone to stop caching objects
returned from the List call. Caching is normally desirable as it speeds
up downloading objects, saves transactions and uses very little memory.
@ -129,7 +129,7 @@ these **must** end with /. Eg
#### Private repositories ####
The "--private-repos" flag can be used to limit users to repositories starting
The` + "`--private-repos`" + ` flag can be used to limit users to repositories starting
with a path of ` + "`/<username>/`" + `.
` + httplib.Help,
Run: func(command *cobra.Command, args []string) {

View File

@ -65,17 +65,18 @@ var Command = &cobra.Command{
Long: `Run a SFTP server to serve a remote over SFTP. This can be used
with an SFTP client or you can make a remote of type sftp to use with it.
You can use the filter flags (e.g. --include, --exclude) to control what
You can use the filter flags (e.g. ` + "`--include`, `--exclude`" + `) to control what
is served.
The server will log errors. Use -v to see access logs.
The server will log errors. Use ` + "`-v`" + ` to see access logs.
--bwlimit will be respected for file transfers. Use --stats to
control the stats printing.
` + "`--bwlimit`" + ` will be respected for file transfers.
Use ` + "`--stats`" + ` to control the stats printing.
You must provide some means of authentication, either with --user/--pass,
an authorized keys file (specify location with --authorized-keys - the
default is the same as ssh), an --auth-proxy, or set the --no-auth flag for no
You must provide some means of authentication, either with
` + "`--user`/`--pass`" + `, an authorized keys file (specify location with
` + "`--authorized-keys`" + ` - the default is the same as ssh), an
` + "`--auth-proxy`" + `, or set the ` + "`--no-auth`" + ` flag for no
authentication when logging in.
Note that this also implements a small number of shell commands so
@ -83,30 +84,30 @@ that it can provide md5sum/sha1sum/df information for the rclone sftp
backend. This means that is can support SHA1SUMs, MD5SUMs and the
about command when paired with the rclone sftp backend.
If you don't supply a host --key then rclone will generate rsa, ecdsa
If you don't supply a host ` + "`--key`" + ` then rclone will generate rsa, ecdsa
and ed25519 variants, and cache them for later use in rclone's cache
directory (see "rclone help flags cache-dir") in the "serve-sftp"
directory (see ` + "`rclone help flags cache-dir`" + `) in the "serve-sftp"
directory.
By default the server binds to localhost:2022 - if you want it to be
reachable externally then supply "--addr :2022" for example.
reachable externally then supply ` + "`--addr :2022`" + ` for example.
Note that the default of "--vfs-cache-mode off" is fine for the rclone
Note that the default of ` + "`--vfs-cache-mode off`" + ` is fine for the rclone
sftp backend, but it may not be with other SFTP clients.
If --stdio is specified, rclone will serve SFTP over stdio, which can
If ` + "`--stdio`" + ` is specified, rclone will serve SFTP over stdio, which can
be used with sshd via ~/.ssh/authorized_keys, for example:
restrict,command="rclone serve sftp --stdio ./photos" ssh-rsa ...
On the client you need to set "--transfers 1" when using --stdio.
On the client you need to set ` + "`--transfers 1`" + ` when using ` + "`--stdio`" + `.
Otherwise multiple instances of the rclone server are started by OpenSSH
which can lead to "corrupted on transfer" errors. This is the case because
the client chooses indiscriminately which server to send commands to while
the servers all have different views of the state of the filing system.
The "restrict" in authorized_keys prevents SHA1SUMs and MD5SUMs from beeing
used. Omitting "restrict" and using --sftp-path-override to enable
used. Omitting "restrict" and using ` + "`--sftp-path-override`" + ` to enable
checksumming is possible but less secure and you could use the SFTP server
provided by OpenSSH in this case.

View File

@ -14,9 +14,9 @@ var Help = `
By default this will serve files without needing a login.
You can either use an htpasswd file which can take lots of users, or
set a single username and password with the --user and --pass flags.
set a single username and password with the ` + "`--user` and `--pass`" + ` flags.
Use --htpasswd /path/to/htpasswd to provide an htpasswd file. This is
Use ` + "`--htpasswd /path/to/htpasswd`" + ` to provide an htpasswd file. This is
in standard apache format and supports MD5, SHA1 and BCrypt for basic
authentication. Bcrypt is recommended.
@ -28,9 +28,9 @@ To create an htpasswd file:
The password file can be updated while rclone is running.
Use --realm to set the authentication realm.
Use ` + "`--realm`" + ` to set the authentication realm.
Use --salt to change the password hashing salt from the default.
Use ` + "`--salt`" + ` to change the password hashing salt from the default.
`
// CustomAuthFn if used will be used to authenticate user, pass. If an error

View File

@ -25,39 +25,39 @@ import (
var Help = `
### Server options
Use --addr to specify which IP address and port the server should
listen on, eg --addr 1.2.3.4:8000 or --addr :8080 to listen to all
Use ` + "`--addr`" + ` to specify which IP address and port the server should
listen on, eg ` + "`--addr 1.2.3.4:8000` or `--addr :8080`" + ` to listen to all
IPs. By default it only listens on localhost. You can use port
:0 to let the OS choose an available port.
If you set --addr to listen on a public or LAN accessible IP address
If you set ` + "`--addr`" + ` to listen on a public or LAN accessible IP address
then using Authentication is advised - see the next section for info.
--server-read-timeout and --server-write-timeout can be used to
` + "`--server-read-timeout` and `--server-write-timeout`" + ` can be used to
control the timeouts on the server. Note that this is the total time
for a transfer.
--max-header-bytes controls the maximum number of bytes the server will
` + "`--max-header-bytes`" + ` controls the maximum number of bytes the server will
accept in the HTTP header.
--baseurl controls the URL prefix that rclone serves from. By default
rclone will serve from the root. If you used --baseurl "/rclone" then
` + "`--baseurl`" + ` controls the URL prefix that rclone serves from. By default
rclone will serve from the root. If you used ` + "`--baseurl \"/rclone\"`" + ` then
rclone would serve from a URL starting with "/rclone/". This is
useful if you wish to proxy rclone serve. Rclone automatically
inserts leading and trailing "/" on --baseurl, so --baseurl "rclone",
--baseurl "/rclone" and --baseurl "/rclone/" are all treated
inserts leading and trailing "/" on ` + "`--baseurl`" + `, so ` + "`--baseurl \"rclone\"`" + `,
` + "`--baseurl \"/rclone\"` and `--baseurl \"/rclone/\"`" + ` are all treated
identically.
#### SSL/TLS
By default this will serve over http. If you want you can serve over
https. You will need to supply the --cert and --key flags. If you
wish to do client side certificate validation then you will need to
supply --client-ca also.
https. You will need to supply the ` + "`--cert` and `--key`" + ` flags.
If you wish to do client side certificate validation then you will need to
supply ` + "`--client-ca`" + ` also.
--cert should be a either a PEM encoded certificate or a concatenation
of that with the CA certificate. --key should be the PEM encoded
private key and --client-ca should be the PEM encoded client
` + "`--cert`" + ` should be a either a PEM encoded certificate or a concatenation
of that with the CA certificate. ` + "`--key`" + ` should be the PEM encoded
private key and ` + "`--client-ca`" + ` should be the PEM encoded client
certificate authority certificate.
`