"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
help: make help command output less distracting
albertony498abcc062ac
diff --git a/cmd/help.go b/cmd/help.goindex 36fd26eef..53e3d15f4 100644--- a/cmd/help.go+++ b/cmd/help.go@@ -70,17 +70,22 @@ var helpFlags = &cobra.Command{Short: "Show the global flags for rclone",Run: func(command *cobra.Command, args []string) {command.Flags()- if len(args) > 0 {- re, err := filter.GlobStringToRegexp(args[0], false)- if err != nil {- log.Fatalf("Invalid flag filter: %v", err)- }- fs.Debugf(nil, "Flag filter: %s", re.String())- filterFlagsRe = re- }if GeneratingDocs {Root.SetUsageTemplate(docFlagsTemplate)} else {+ if len(args) > 0 {+ re, err := filter.GlobStringToRegexp(args[0], false)+ if err != nil {+ log.Fatalf("Invalid flag filter: %v", err)+ }+ fs.Debugf(nil, "Flag filter: %s", re.String())+ filterFlagsRe = re+ }+ if filterFlagsGroup != "" {+ Root.SetUsageTemplate(filterFlagsSingleGroupTemplate)+ } else if len(args) > 0 {+ Root.SetUsageTemplate(filterFlagsMultiGroupTemplate)+ }Root.SetOutput(os.Stdout)}_ = command.Usage()@@ -152,7 +157,7 @@ func setupRootCommand(rootCmd *cobra.Command) {})cobra.AddTemplateFunc("flagGroups", func(cmd *cobra.Command) []*flags.Group {// Add the backend flags and check all flags- backendGroup := flags.All.NewGroup("Backend", "Backend only flags. These can be set in the config file also.")+ backendGroup := flags.All.NewGroup("Backend", "Backend-only flags (these can be set in the config file also)")allRegistered := flags.All.AllRegistered()cmd.InheritedFlags().VisitAll(func(flag *pflag.Flag) {if _, ok := backendFlags[flag.Name]; ok {@@ -210,20 +215,16 @@ Aliases:Examples:{{.Example}}{{end}}{{if and (showCommands .) .HasAvailableSubCommands}}-Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "help"))}}+Available commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "help"))}}{{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if and (showLocalFlags .) .HasAvailableLocalFlags}}Flags:{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if and (showGlobalFlags .) .HasAvailableInheritedFlags}}-{{ range flagGroups . }}{{ if .Flags.HasFlags }}-# {{ .Name }} Flags--{{ .Help }}-+{{ range flagGroups . }}{{ if .Flags.HasFlags }}{{ .Help }} (flag group {{ .Name }}):{{ .Flags.FlagUsages | trimTrailingWhitespaces}}-{{ end }}{{ end }}+{{ end }}{{ end }}Additional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}}{{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}@@ -232,6 +233,15 @@ Use "rclone help flags" for to see the global flags.Use "rclone help backends" for a list of supported services.`+var filterFlagsSingleGroupTemplate = `{{ range flagGroups . }}{{ if .Flags.HasFlags }}{{ .Flags.FlagUsages | trimTrailingWhitespaces}}+{{ end }}{{ end }}+`++var filterFlagsMultiGroupTemplate = `{{ range flagGroups . }}{{ if .Flags.HasFlags }}{{ .Help }} (flag group {{ .Name }}):+{{ .Flags.FlagUsages | trimTrailingWhitespaces}}++{{ end }}{{ end }}`+var docFlagsTemplate = `---title: "Global Flags"description: "Rclone Global Flags"@@ -245,7 +255,7 @@ split into groups.{{ range flagGroups . }}{{ if .Flags.HasFlags }}## {{ .Name }}-{{ .Help }}+{{ .Help }}.` + "```" + `{{ .Flags.FlagUsages | trimTrailingWhitespaces}}diff --git a/fs/config.go b/fs/config.goindex bd3d7aa89..caf242fdf 100644--- a/fs/config.go+++ b/fs/config.go@@ -70,7 +70,7 @@ var ConfigOptionsInfo = Options{{Name: "checksum",ShortOpt: "c",Default: false,- Help: "Check for changes with size & checksum (if available, or fallback to size only).",+ Help: "Check for changes with size & checksum (if available, or fallback to size only)",Groups: "Copy",}, {Name: "size_only",diff --git a/fs/config/flags/flags.go b/fs/config/flags/flags.goindex 10b1fd77f..db76f5d71 100644--- a/fs/config/flags/flags.go+++ b/fs/config/flags/flags.go@@ -111,19 +111,19 @@ var All *Groups// Groups of flags for documentation purposesfunc init() {All = NewGroups()- All.NewGroup("Copy", "Flags for anything which can Copy a file.")- All.NewGroup("Sync", "Flags just used for `rclone sync`.")- All.NewGroup("Important", "Important flags useful for most commands.")- All.NewGroup("Check", "Flags used for `rclone check`.")- All.NewGroup("Networking", "General networking and HTTP stuff.")- All.NewGroup("Performance", "Flags helpful for increasing performance.")- All.NewGroup("Config", "General configuration of rclone.")- All.NewGroup("Debugging", "Flags for developers.")- All.NewGroup("Filter", "Flags for filtering directory listings.")- All.NewGroup("Listing", "Flags for listing directories.")- All.NewGroup("Logging", "Logging and statistics.")- All.NewGroup("Metadata", "Flags to control metadata.")- All.NewGroup("RC", "Flags to control the Remote Control API.")+ All.NewGroup("Copy", "Flags for anything which can copy a file")+ All.NewGroup("Sync", "Flags used for sync commands")+ All.NewGroup("Important", "Important flags useful for most commands")+ All.NewGroup("Check", "Flags used for check commands")+ All.NewGroup("Networking", "Flags for general networking and HTTP stuff")+ All.NewGroup("Performance", "Flags helpful for increasing performance")+ All.NewGroup("Config", "Flags for general configuration of rclone")+ All.NewGroup("Debugging", "Flags for developers")+ All.NewGroup("Filter", "Flags for filtering directory listings")+ All.NewGroup("Listing", "Flags for listing directories")+ All.NewGroup("Logging", "Flags for logging and statistics")+ All.NewGroup("Metadata", "Flags to control metadata")+ All.NewGroup("RC", "Flags to control the Remote Control API")}// installFlag constructs a name from the flag passed in and