docs: ensure empty line between text and a following heading

This commit is contained in:
albertony 2024-04-05 13:27:33 +02:00
parent 05e5712bc4
commit e739ee2c27
18 changed files with 52 additions and 29 deletions

View file

@ -31,6 +31,11 @@ import (
//go:embed mount.md //go:embed mount.md
var mountHelp string var mountHelp string
// help returns the help string cleaned up to simplify appending
func help(commandName string) string {
return strings.TrimSpace(strings.ReplaceAll(mountHelp, "@", commandName)) + "\n\n"
}
// Options for creating the mount // Options for creating the mount
type Options struct { type Options struct {
DebugFUSE bool DebugFUSE bool
@ -196,7 +201,7 @@ func NewMountCommand(commandName string, hidden bool, mount MountFn) *cobra.Comm
Use: commandName + " remote:path /path/to/mountpoint", Use: commandName + " remote:path /path/to/mountpoint",
Hidden: hidden, Hidden: hidden,
Short: `Mount the remote as file system on a mountpoint.`, Short: `Mount the remote as file system on a mountpoint.`,
Long: strings.ReplaceAll(mountHelp, "@", commandName) + vfs.Help, Long: help(commandName) + vfs.Help(),
Annotations: map[string]string{ Annotations: map[string]string{
"versionIntroduced": "v1.33", "versionIntroduced": "v1.33",
"groups": "Filter", "groups": "Filter",

View file

@ -1,6 +1,5 @@
rclone @ allows Linux, FreeBSD, macOS and Windows to Rclone @ allows Linux, FreeBSD, macOS and Windows to
mount any of Rclone's cloud storage systems as a file system with mount any of Rclone's cloud storage systems as a file system with FUSE.
FUSE.
First set up your remote using `rclone config`. Check it works with `rclone ls` etc. First set up your remote using `rclone config`. Check it works with `rclone ls` etc.

View file

@ -20,8 +20,7 @@ func init() {
var commandDefinition = &cobra.Command{ var commandDefinition = &cobra.Command{
Use: "rcd <path to files to serve>*", Use: "rcd <path to files to serve>*",
Short: `Run rclone listening to remote control commands only.`, Short: `Run rclone listening to remote control commands only.`,
Long: ` Long: `This runs rclone so that it only listens to remote control commands.
This runs rclone so that it only listens to remote control commands.
This is useful if you are controlling rclone via the rc API. This is useful if you are controlling rclone via the rc API.
@ -30,6 +29,7 @@ for GET requests on the URL passed in. It will also open the URL in
the browser when rclone is run. the browser when rclone is run.
See the [rc documentation](/rc/) for more info on the rc flags. See the [rc documentation](/rc/) for more info on the rc flags.
` + libhttp.Help(rcflags.FlagPrefix) + libhttp.TemplateHelp(rcflags.FlagPrefix) + libhttp.AuthHelp(rcflags.FlagPrefix), ` + libhttp.Help(rcflags.FlagPrefix) + libhttp.TemplateHelp(rcflags.FlagPrefix) + libhttp.AuthHelp(rcflags.FlagPrefix),
Annotations: map[string]string{ Annotations: map[string]string{
"versionIntroduced": "v1.45", "versionIntroduced": "v1.45",

View file

@ -50,7 +50,7 @@ based on media formats or file extensions. Additionally, there is no
media transcoding support. This means that some players might show media transcoding support. This means that some players might show
files that they are not able to play back correctly. files that they are not able to play back correctly.
` + dlnaflags.Help + vfs.Help, ` + dlnaflags.Help + vfs.Help(),
Annotations: map[string]string{ Annotations: map[string]string{
"versionIntroduced": "v1.46", "versionIntroduced": "v1.46",
"groups": "Filter", "groups": "Filter",

View file

@ -10,8 +10,7 @@ import (
) )
// Help contains the text for the command line help and manual. // Help contains the text for the command line help and manual.
var Help = ` var Help = `### Server options
### Server options
Use ` + "`--addr`" + ` to specify which IP address and port the server should 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 listen on, e.g. ` + "`--addr 1.2.3.4:8000` or `--addr :8080`" + ` to listen to all
@ -22,6 +21,7 @@ default "rclone (hostname)".
Use ` + "`--log-trace` in conjunction with `-vv`" + ` to enable additional debug Use ` + "`--log-trace` in conjunction with `-vv`" + ` to enable additional debug
logging of all UPNP traffic. logging of all UPNP traffic.
` `
// Options is the type for DLNA serving options. // Options is the type for DLNA serving options.

View file

@ -5,6 +5,7 @@ import (
"context" "context"
_ "embed" _ "embed"
"path/filepath" "path/filepath"
"strings"
"syscall" "syscall"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -33,6 +34,11 @@ var (
//go:embed docker.md //go:embed docker.md
var longHelp string var longHelp string
// help returns the help string cleaned up to simplify appending
func help() string {
return strings.TrimSpace(longHelp) + "\n\n"
}
func init() { func init() {
cmdFlags := Command.Flags() cmdFlags := Command.Flags()
// Add command specific flags // Add command specific flags
@ -50,7 +56,7 @@ func init() {
var Command = &cobra.Command{ var Command = &cobra.Command{
Use: "docker", Use: "docker",
Short: `Serve any remote on docker's volume plugin API.`, Short: `Serve any remote on docker's volume plugin API.`,
Long: longHelp + vfs.Help, Long: help() + vfs.Help(),
Annotations: map[string]string{ Annotations: map[string]string{
"versionIntroduced": "v1.56", "versionIntroduced": "v1.56",
"groups": "Filter", "groups": "Filter",

View file

@ -80,8 +80,7 @@ func init() {
var Command = &cobra.Command{ var Command = &cobra.Command{
Use: "ftp remote:path", Use: "ftp remote:path",
Short: `Serve remote:path over FTP.`, Short: `Serve remote:path over FTP.`,
Long: ` Long: `Run a basic FTP server to serve a remote over FTP protocol.
Run a basic FTP server to serve a remote over FTP protocol.
This can be viewed with a FTP client or you can make a remote of This can be viewed with a FTP client or you can make a remote of
type FTP to read and write it. type FTP to read and write it.
@ -100,7 +99,8 @@ then using Authentication is advised - see the next section for info.
By default this will serve files without needing a login. By default this will serve files without needing a login.
You can set a single username and password with the --user and --pass flags. You can set a single username and password with the --user and --pass flags.
` + vfs.Help + proxy.Help,
` + vfs.Help() + proxy.Help,
Annotations: map[string]string{ Annotations: map[string]string{
"versionIntroduced": "v1.44", "versionIntroduced": "v1.44",
"groups": "Filter", "groups": "Filter",

View file

@ -73,7 +73,8 @@ 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. control the stats printing.
` + libhttp.Help(flagPrefix) + libhttp.TemplateHelp(flagPrefix) + libhttp.AuthHelp(flagPrefix) + vfs.Help + proxy.Help,
` + libhttp.Help(flagPrefix) + libhttp.TemplateHelp(flagPrefix) + libhttp.AuthHelp(flagPrefix) + vfs.Help() + proxy.Help,
Annotations: map[string]string{ Annotations: map[string]string{
"versionIntroduced": "v1.39", "versionIntroduced": "v1.39",
"groups": "Filter", "groups": "Filter",

View file

@ -92,7 +92,7 @@ Where ` + "`$PORT`" + ` is the same port number we used in the serve nfs command
This feature is only available on Unix platforms. This feature is only available on Unix platforms.
` + vfs.Help, ` + vfs.Help(),
Annotations: map[string]string{ Annotations: map[string]string{
"versionIntroduced": "v1.65", "versionIntroduced": "v1.65",
"groups": "Filter", "groups": "Filter",

View file

@ -23,8 +23,7 @@ import (
) )
// Help contains text describing how to use the proxy // Help contains text describing how to use the proxy
var Help = strings.Replace(` var Help = strings.Replace(`### Auth Proxy
### Auth Proxy
If you supply the parameter |--auth-proxy /path/to/program| then If you supply the parameter |--auth-proxy /path/to/program| then
rclone will use that program to generate backends on the fly which rclone will use that program to generate backends on the fly which
@ -104,6 +103,7 @@ before it takes effect.
This can be used to build general purpose proxies to any kind of This can be used to build general purpose proxies to any kind of
backend that rclone supports. backend that rclone supports.
`, "|", "`", -1) `, "|", "`", -1)
// Options is options for creating the proxy // Options is options for creating the proxy

View file

@ -147,6 +147,7 @@ these **must** end with /. Eg
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>/`" + `. with a path of ` + "`/<username>/`" + `.
` + libhttp.Help(flagPrefix) + libhttp.AuthHelp(flagPrefix), ` + libhttp.Help(flagPrefix) + libhttp.AuthHelp(flagPrefix),
Annotations: map[string]string{ Annotations: map[string]string{
"versionIntroduced": "v1.40", "versionIntroduced": "v1.40",

View file

@ -3,6 +3,7 @@ package s3
import ( import (
"context" "context"
_ "embed" _ "embed"
"strings"
"github.com/rclone/rclone/cmd" "github.com/rclone/rclone/cmd"
"github.com/rclone/rclone/fs/config/flags" "github.com/rclone/rclone/fs/config/flags"
@ -40,6 +41,11 @@ func init() {
//go:embed serve_s3.md //go:embed serve_s3.md
var serveS3Help string var serveS3Help string
// help returns the help string cleaned up to simplify appending
func help() string {
return strings.TrimSpace(serveS3Help) + "\n\n"
}
// Command definition for cobra // Command definition for cobra
var Command = &cobra.Command{ var Command = &cobra.Command{
Annotations: map[string]string{ Annotations: map[string]string{
@ -49,7 +55,7 @@ var Command = &cobra.Command{
}, },
Use: "s3 remote:path", Use: "s3 remote:path",
Short: `Serve remote:path over s3.`, Short: `Serve remote:path over s3.`,
Long: serveS3Help + httplib.Help(flagPrefix) + vfs.Help, Long: help() + httplib.Help(flagPrefix) + vfs.Help(),
RunE: func(command *cobra.Command, args []string) error { RunE: func(command *cobra.Command, args []string) error {
cmd.CheckArgs(1, 1, command, args) cmd.CheckArgs(1, 1, command, args)
f := cmd.NewFsSrc(args) f := cmd.NewFsSrc(args)

View file

@ -114,7 +114,7 @@ used. Omitting "restrict" and using ` + "`--sftp-path-override`" + ` to enable
checksumming is possible but less secure and you could use the SFTP server checksumming is possible but less secure and you could use the SFTP server
provided by OpenSSH in this case. provided by OpenSSH in this case.
` + vfs.Help + proxy.Help, ` + vfs.Help() + proxy.Help,
Annotations: map[string]string{ Annotations: map[string]string{
"versionIntroduced": "v1.48", "versionIntroduced": "v1.48",
"groups": "Filter", "groups": "Filter",

View file

@ -89,6 +89,7 @@ supported hash on the backend or you can use a named hash such as
to see the full list. to see the full list.
### Access WebDAV on Windows ### Access WebDAV on Windows
WebDAV shared folder can be mapped as a drive on Windows, however the default settings prevent it. WebDAV shared folder can be mapped as a drive on Windows, however the default settings prevent it.
Windows will fail to connect to the server using insecure Basic authentication. Windows will fail to connect to the server using insecure Basic authentication.
It will not even display any login dialog. Windows requires SSL / HTTPS connection to be used with Basic. It will not even display any login dialog. Windows requires SSL / HTTPS connection to be used with Basic.
@ -104,6 +105,7 @@ If required, increase the FileSizeLimitInBytes to a higher value.
Navigate to the Services interface, then restart the WebClient service. Navigate to the Services interface, then restart the WebClient service.
### Access Office applications on WebDAV ### Access Office applications on WebDAV
Navigate to following registry HKEY_CURRENT_USER\Software\Microsoft\Office\[14.0/15.0/16.0]\Common\Internet Navigate to following registry HKEY_CURRENT_USER\Software\Microsoft\Office\[14.0/15.0/16.0]\Common\Internet
Create a new DWORD BasicAuthLevel with value 2. Create a new DWORD BasicAuthLevel with value 2.
0 - Basic authentication disabled 0 - Basic authentication disabled
@ -112,7 +114,7 @@ Create a new DWORD BasicAuthLevel with value 2.
https://learn.microsoft.com/en-us/office/troubleshoot/powerpoint/office-opens-blank-from-sharepoint https://learn.microsoft.com/en-us/office/troubleshoot/powerpoint/office-opens-blank-from-sharepoint
` + libhttp.Help(flagPrefix) + libhttp.TemplateHelp(flagPrefix) + libhttp.AuthHelp(flagPrefix) + vfs.Help + proxy.Help, ` + libhttp.Help(flagPrefix) + libhttp.TemplateHelp(flagPrefix) + libhttp.AuthHelp(flagPrefix) + vfs.Help() + proxy.Help,
Annotations: map[string]string{ Annotations: map[string]string{
"versionIntroduced": "v1.39", "versionIntroduced": "v1.39",
"groups": "Filter", "groups": "Filter",

View file

@ -11,8 +11,7 @@ import (
// AuthHelp returns text describing the http authentication to add to the command help. // AuthHelp returns text describing the http authentication to add to the command help.
func AuthHelp(prefix string) string { func AuthHelp(prefix string) string {
help := ` help := `#### Authentication
#### Authentication
By default this will serve files without needing a login. By default this will serve files without needing a login.
@ -38,6 +37,7 @@ The password file can be updated while rclone is running.
Use ` + "`--{{ .Prefix }}realm`" + ` to set the authentication realm. Use ` + "`--{{ .Prefix }}realm`" + ` to set the authentication realm.
Use ` + "`--{{ .Prefix }}salt`" + ` to change the password hashing salt from the default. Use ` + "`--{{ .Prefix }}salt`" + ` to change the password hashing salt from the default.
` `
tmpl, err := template.New("auth help").Parse(help) tmpl, err := template.New("auth help").Parse(help)
if err != nil { if err != nil {

View file

@ -27,8 +27,7 @@ import (
// Help returns text describing the http server to add to the command // Help returns text describing the http server to add to the command
// help. // help.
func Help(prefix string) string { func Help(prefix string) string {
help := ` help := `### Server options
### Server options
Use ` + "`--{{ .Prefix }}addr`" + ` to specify which IP address and port the server should Use ` + "`--{{ .Prefix }}addr`" + ` to specify which IP address and port the server should
listen on, eg ` + "`--{{ .Prefix }}addr 1.2.3.4:8000` or `--{{ .Prefix }}addr :8080`" + ` to listen to all listen on, eg ` + "`--{{ .Prefix }}addr 1.2.3.4:8000` or `--{{ .Prefix }}addr :8080`" + ` to listen to all
@ -74,6 +73,7 @@ certificate authority certificate.
--{{ .Prefix }}min-tls-version is minimum TLS version that is acceptable. Valid --{{ .Prefix }}min-tls-version is minimum TLS version that is acceptable. Valid
values are "tls1.0", "tls1.1", "tls1.2" and "tls1.3" (default values are "tls1.0", "tls1.1", "tls1.2" and "tls1.3" (default
"tls1.0"). "tls1.0").
` `
tmpl, err := template.New("server help").Parse(help) tmpl, err := template.New("server help").Parse(help)
if err != nil { if err != nil {

View file

@ -16,8 +16,7 @@ import (
// TemplateHelp returns a string that describes how to use a custom template // TemplateHelp returns a string that describes how to use a custom template
func TemplateHelp(prefix string) string { func TemplateHelp(prefix string) string {
help := ` help := `#### Template
#### Template
` + "`--{{ .Prefix }}template`" + ` allows a user to specify a custom markup template for HTTP ` + "`--{{ .Prefix }}template`" + ` allows a user to specify a custom markup template for HTTP
and WebDAV serve functions. The server exports the following markup and WebDAV serve functions. The server exports the following markup
@ -52,6 +51,7 @@ be used to render HTML based on specific conditions.
| contains | Checks whether a given substring is present or not in a given string. | | contains | Checks whether a given substring is present or not in a given string. |
| hasPrefix | Checks whether the given string begins with the specified prefix. | | hasPrefix | Checks whether the given string begins with the specified prefix. |
| hasSuffix | Checks whether the given string end with the specified suffix. | | hasSuffix | Checks whether the given string end with the specified suffix. |
` `
tmpl, err := template.New("template help").Parse(help) tmpl, err := template.New("template help").Parse(help)

View file

@ -43,10 +43,13 @@ import (
"github.com/rclone/rclone/vfs/vfscommon" "github.com/rclone/rclone/vfs/vfscommon"
) )
// Help for the VFS.
//
//go:embed vfs.md //go:embed vfs.md
var Help string var help string
// Help returns the help string cleaned up to simplify appending
func Help() string {
return strings.TrimSpace(help) + "\n\n"
}
// Node represents either a directory (*Dir) or a file (*File) // Node represents either a directory (*Dir) or a file (*File)
type Node interface { type Node interface {