Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation of backend experimental status #6578

Merged
merged 5 commits into from Dec 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/about/about.go
Expand Up @@ -93,6 +93,9 @@ provided by a backend. Where the value is unlimited it is omitted.
Some backends does not support the ` + "`rclone about`" + ` command at all,
see complete list in [documentation](https://rclone.org/overview/#optional-features).
`,
Annotations: map[string]string{
"versionIntroduced": "v1.41",
},
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(1, 1, command, args)
f := cmd.NewFsSrc(args)
Expand Down
3 changes: 3 additions & 0 deletions cmd/authorize/authorize.go
Expand Up @@ -30,6 +30,9 @@ rclone config.

Use the --auth-no-open-browser to prevent rclone to open auth
link in default browser automatically.`,
Annotations: map[string]string{
"versionIntroduced": "v1.27",
},
RunE: func(command *cobra.Command, args []string) error {
cmd.CheckArgs(1, 3, command, args)
return config.Authorize(context.Background(), args, noAutoBrowser)
Expand Down
3 changes: 3 additions & 0 deletions cmd/backend/backend.go
Expand Up @@ -58,6 +58,9 @@ Pass arguments to the backend by placing them on the end of the line
Note to run these commands on a running backend then see
[backend/command](/rc/#backend-command) in the rc docs.
`,
Annotations: map[string]string{
"versionIntroduced": "v1.52",
},
RunE: func(command *cobra.Command, args []string) error {
cmd.CheckArgs(2, 1e6, command, args)
name, remote := args[0], args[1]
Expand Down
3 changes: 3 additions & 0 deletions cmd/bisync/cmd.go
Expand Up @@ -115,6 +115,9 @@ var commandDefinition = &cobra.Command{
Use: "bisync remote1:path1 remote2:path2",
Short: shortHelp,
Long: longHelp,
Annotations: map[string]string{
"versionIntroduced": "v1.58",
},
RunE: func(command *cobra.Command, args []string) error {
cmd.CheckArgs(2, 2, command, args)
fs1, file1, fs2, file2 := cmd.NewFsSrcDstFiles(args)
Expand Down
4 changes: 4 additions & 0 deletions cmd/cachestats/cachestats.go
Expand Up @@ -25,6 +25,10 @@ var commandDefinition = &cobra.Command{
Print cache stats for a remote in JSON format
`,
Hidden: true,
Annotations: map[string]string{
"versionIntroduced": "v1.39",
"status": "Deprecated",
},
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(1, 1, command, args)
fs.Logf(nil, `"rclone cachestats" is deprecated, use "rclone backend stats %s" instead`, args[0])
Expand Down
3 changes: 3 additions & 0 deletions cmd/cat/cat.go
Expand Up @@ -57,6 +57,9 @@ the end and |--offset| and |--count| to print a section in the middle.
Note that if offset is negative it will count from the end, so
|--offset -1 --count 1| is equivalent to |--tail 1|.
`, "|", "`"),
Annotations: map[string]string{
"versionIntroduced": "v1.33",
},
Run: func(command *cobra.Command, args []string) {
usedOffset := offset != 0 || count >= 0
usedHead := head > 0
Expand Down
3 changes: 3 additions & 0 deletions cmd/checksum/checksum.go
Expand Up @@ -37,6 +37,9 @@ that don't support hashes or if you really want to check all the data.

Note that hash values in the SUM file are treated as case insensitive.
`, "|", "`") + check.FlagsHelp,
Annotations: map[string]string{
"versionIntroduced": "v1.56",
},
RunE: func(command *cobra.Command, args []string) error {
cmd.CheckArgs(3, 3, command, args)
var hashType hash.Type
Expand Down
3 changes: 3 additions & 0 deletions cmd/cleanup/cleanup.go
Expand Up @@ -20,6 +20,9 @@ var commandDefinition = &cobra.Command{
Clean up the remote if possible. Empty the trash or delete old file
versions. Not supported by all remotes.
`,
Annotations: map[string]string{
"versionIntroduced": "v1.31",
},
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(1, 1, command, args)
fsrc := cmd.NewFsSrc(args)
Expand Down
38 changes: 37 additions & 1 deletion cmd/config/config.go
Expand Up @@ -44,6 +44,9 @@ var configCommand = &cobra.Command{
remotes and manage existing ones. You may also set or remove a
password to protect your configuration.
`,
Annotations: map[string]string{
"versionIntroduced": "v1.39",
},
RunE: func(command *cobra.Command, args []string) error {
cmd.CheckArgs(0, 0, command, args)
return config.EditConfig(context.Background())
Expand All @@ -54,12 +57,18 @@ var configEditCommand = &cobra.Command{
Use: "edit",
Short: configCommand.Short,
Long: configCommand.Long,
Run: configCommand.Run,
Annotations: map[string]string{
"versionIntroduced": "v1.39",
},
Run: configCommand.Run,
}

var configFileCommand = &cobra.Command{
Use: "file",
Short: `Show path of configuration file in use.`,
Annotations: map[string]string{
"versionIntroduced": "v1.38",
},
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(0, 0, command, args)
config.ShowConfigLocation()
Expand All @@ -69,6 +78,9 @@ var configFileCommand = &cobra.Command{
var configTouchCommand = &cobra.Command{
Use: "touch",
Short: `Ensure configuration file exists.`,
Annotations: map[string]string{
"versionIntroduced": "v1.56",
},
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(0, 0, command, args)
config.SaveConfig()
Expand All @@ -78,6 +90,9 @@ var configTouchCommand = &cobra.Command{
var configPathsCommand = &cobra.Command{
Use: "paths",
Short: `Show paths used for configuration, cache, temp etc.`,
Annotations: map[string]string{
"versionIntroduced": "v1.57",
},
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(0, 0, command, args)
fmt.Printf("Config file: %s\n", config.GetConfigPath())
Expand All @@ -89,6 +104,9 @@ var configPathsCommand = &cobra.Command{
var configShowCommand = &cobra.Command{
Use: "show [<remote>]",
Short: `Print (decrypted) config file, or the config for a single remote.`,
Annotations: map[string]string{
"versionIntroduced": "v1.38",
},
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(0, 1, command, args)
if len(args) == 0 {
Expand All @@ -103,6 +121,9 @@ var configShowCommand = &cobra.Command{
var configDumpCommand = &cobra.Command{
Use: "dump",
Short: `Dump the config file as JSON.`,
Annotations: map[string]string{
"versionIntroduced": "v1.39",
},
RunE: func(command *cobra.Command, args []string) error {
cmd.CheckArgs(0, 0, command, args)
return config.Dump()
Expand All @@ -112,6 +133,9 @@ var configDumpCommand = &cobra.Command{
var configProvidersCommand = &cobra.Command{
Use: "providers",
Short: `List in JSON format all the providers and options.`,
Annotations: map[string]string{
"versionIntroduced": "v1.39",
},
RunE: func(command *cobra.Command, args []string) error {
cmd.CheckArgs(0, 0, command, args)
return config.JSONListProviders()
Expand Down Expand Up @@ -226,6 +250,9 @@ using remote authorization you would do this:

rclone config create mydrive drive config_is_local=false
`, "|", "`") + configPasswordHelp,
Annotations: map[string]string{
"versionIntroduced": "v1.39",
},
RunE: func(command *cobra.Command, args []string) error {
cmd.CheckArgs(2, 256, command, args)
in, err := argsToMap(args[2:])
Expand Down Expand Up @@ -289,6 +316,9 @@ require this add an extra parameter thus:

rclone config update myremote env_auth=true config_refresh_token=false
`, "|", "`") + configPasswordHelp,
Annotations: map[string]string{
"versionIntroduced": "v1.39",
},
RunE: func(command *cobra.Command, args []string) error {
cmd.CheckArgs(1, 256, command, args)
in, err := argsToMap(args[1:])
Expand All @@ -304,6 +334,9 @@ require this add an extra parameter thus:
var configDeleteCommand = &cobra.Command{
Use: "delete name",
Short: "Delete an existing remote.",
Annotations: map[string]string{
"versionIntroduced": "v1.39",
},
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(1, 1, command, args)
config.DeleteRemote(args[0])
Expand All @@ -326,6 +359,9 @@ For example, to set password of a remote of name myremote you would do:
This command is obsolete now that "config update" and "config create"
both support obscuring passwords directly.
`, "|", "`"),
Annotations: map[string]string{
"versionIntroduced": "v1.39",
},
RunE: func(command *cobra.Command, args []string) error {
cmd.CheckArgs(1, 256, command, args)
in, err := argsToMap(args[1:])
Expand Down
3 changes: 3 additions & 0 deletions cmd/copyto/copyto.go
Expand Up @@ -46,6 +46,9 @@ the destination.

**Note**: Use the ` + "`-P`" + `/` + "`--progress`" + ` flag to view real-time transfer statistics
`,
Annotations: map[string]string{
"versionIntroduced": "v1.35",
},
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(2, 2, command, args)
fsrc, srcFileName, fdst, dstFileName := cmd.NewFsSrcDstFiles(args)
Expand Down
3 changes: 3 additions & 0 deletions cmd/copyurl/copyurl.go
Expand Up @@ -51,6 +51,9 @@ destination if there is one with the same name.
Setting ` + "`--stdout`" + ` or making the output file name ` + "`-`" + `
will cause the output to be written to standard output.
`,
Annotations: map[string]string{
"versionIntroduced": "v1.43",
},
RunE: func(command *cobra.Command, args []string) (err error) {
cmd.CheckArgs(1, 2, command, args)

Expand Down
3 changes: 3 additions & 0 deletions cmd/cryptcheck/cryptcheck.go
Expand Up @@ -47,6 +47,9 @@ the files in remote:path.

After it has run it will log the status of the encryptedremote:.
` + check.FlagsHelp,
Annotations: map[string]string{
"versionIntroduced": "v1.36",
},
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(2, 2, command, args)
fsrc, fdst := cmd.NewFsSrcDst(args)
Expand Down
3 changes: 3 additions & 0 deletions cmd/cryptdecode/cryptdecode.go
Expand Up @@ -41,6 +41,9 @@ use it like this
Another way to accomplish this is by using the ` + "`rclone backend encode` (or `decode`)" + ` command.
See the documentation on the [crypt](/crypt/) overlay for more info.
`,
Annotations: map[string]string{
"versionIntroduced": "v1.38",
},
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(2, 11, command, args)
cmd.Run(false, false, command, func() error {
Expand Down
3 changes: 3 additions & 0 deletions cmd/dedupe/dedupe.go
Expand Up @@ -135,6 +135,9 @@ Or

rclone dedupe rename "drive:Google Photos"
`,
Annotations: map[string]string{
"versionIntroduced": "v1.27",
},
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(1, 2, command, args)
if len(args) > 1 {
Expand Down
3 changes: 3 additions & 0 deletions cmd/delete/delete.go
Expand Up @@ -53,6 +53,9 @@ delete all files bigger than 100 MiB.
**Important**: Since this can cause data loss, test first with the
|--dry-run| or the |--interactive|/|-i| flag.
`, "|", "`"),
Annotations: map[string]string{
"versionIntroduced": "v1.27",
},
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(1, 1, command, args)
fsrc := cmd.NewFsSrc(args)
Expand Down
3 changes: 3 additions & 0 deletions cmd/deletefile/deletefile.go
Expand Up @@ -22,6 +22,9 @@ Remove a single file from remote. Unlike ` + "`" + `delete` + "`" + ` it cannot
remove a directory and it doesn't obey include/exclude filters - if the specified file exists,
it will always be removed.
`,
Annotations: map[string]string{
"versionIntroduced": "v1.42",
},
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(1, 1, command, args)
fs, fileName := cmd.NewFsFile(args[0])
Expand Down
3 changes: 3 additions & 0 deletions cmd/genautocomplete/genautocomplete.go
Expand Up @@ -17,4 +17,7 @@ var completionDefinition = &cobra.Command{
Generates a shell completion script for rclone.
Run with ` + "`--help`" + ` to list the supported shells.
`,
Annotations: map[string]string{
"versionIntroduced": "v1.33",
},
}
31 changes: 23 additions & 8 deletions cmd/gendocs/gendocs.go
Expand Up @@ -31,13 +31,17 @@ type frontmatter struct {
Slug string
URL string
Source string
Annotations map[string]string
}

var frontmatterTemplate = template.Must(template.New("frontmatter").Parse(`---
title: "{{ .Title }}"
description: "{{ .Description }}"
slug: {{ .Slug }}
url: {{ .URL }}
{{- range $key, $value := .Annotations }}
{{ $key }}: {{ $value }}
{{- end }}
# autogenerated - DO NOT EDIT, instead edit the source code in {{ .Source }} and as part of making a release run "make commanddocs"
---
`))
Expand All @@ -49,6 +53,9 @@ var commandDefinition = &cobra.Command{
This produces markdown docs for the rclone commands to the directory
supplied. These are in a format suitable for hugo to render into the
rclone.org website.`,
Annotations: map[string]string{
"versionIntroduced": "v1.33",
},
RunE: func(command *cobra.Command, args []string) error {
cmd.CheckArgs(1, 1, command, args)
now := time.Now().Format(time.RFC3339)
Expand All @@ -75,17 +82,24 @@ rclone.org website.`,
return err
}

// Look up name => description for prepender
var description = map[string]string{}
var addDescription func(root *cobra.Command)
addDescription = func(root *cobra.Command) {
// Look up name => details for prepender
type commandDetails struct {
Short string
Annotations map[string]string
}
var commands = map[string]commandDetails{}
var addCommandDetails func(root *cobra.Command)
addCommandDetails = func(root *cobra.Command) {
name := strings.ReplaceAll(root.CommandPath(), " ", "_") + ".md"
description[name] = root.Short
commands[name] = commandDetails{
Short: root.Short,
Annotations: root.Annotations,
}
for _, c := range root.Commands() {
addDescription(c)
addCommandDetails(c)
}
}
addDescription(cmd.Root)
addCommandDetails(cmd.Root)

// markup for the docs files
prepender := func(filename string) string {
Expand All @@ -94,10 +108,11 @@ rclone.org website.`,
data := frontmatter{
Date: now,
Title: strings.ReplaceAll(base, "_", " "),
Description: description[name],
Description: commands[name].Short,
Slug: base,
URL: "/commands/" + strings.ToLower(base) + "/",
Source: strings.ReplaceAll(strings.ReplaceAll(base, "rclone", "cmd"), "_", "/") + "/",
Annotations: commands[name].Annotations,
}
var buf bytes.Buffer
err := frontmatterTemplate.Execute(&buf, data)
Expand Down
3 changes: 3 additions & 0 deletions cmd/hashsum/hashsum.go
Expand Up @@ -112,6 +112,9 @@ Then

Note that hash names are case insensitive and values are output in lower case.
`,
Annotations: map[string]string{
"versionIntroduced": "v1.41",
},
RunE: func(command *cobra.Command, args []string) error {
cmd.CheckArgs(0, 2, command, args)
if len(args) == 0 {
Expand Down
3 changes: 3 additions & 0 deletions cmd/link/link.go
Expand Up @@ -49,6 +49,9 @@ link. Exact capabilities depend on the remote, but the link will
always by default be created with the least constraints – e.g. no
expiry, no password protection, accessible without account.
`,
Annotations: map[string]string{
"versionIntroduced": "v1.41",
},
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(1, 1, command, args)
fsrc, remote := cmd.NewFsFile(args[0])
Expand Down
3 changes: 3 additions & 0 deletions cmd/listremotes/listremotes.go
Expand Up @@ -30,6 +30,9 @@ rclone listremotes lists all the available remotes from the config file.

When used with the ` + "`--long`" + ` flag it lists the types too.
`,
Annotations: map[string]string{
"versionIntroduced": "v1.34",
},
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(0, 0, command, args)
remotes := config.FileSections()
Expand Down
3 changes: 3 additions & 0 deletions cmd/lsf/lsf.go
Expand Up @@ -142,6 +142,9 @@ those only (without traversing the whole directory structure):
rclone copy --files-from-raw new_files /path/to/local remote:path

` + lshelp.Help,
Annotations: map[string]string{
"versionIntroduced": "v1.40",
},
Run: func(command *cobra.Command, args []string) {
cmd.CheckArgs(1, 1, command, args)
fsrc := cmd.NewFsSrc(args)
Expand Down