mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 16:34:30 +01:00
bff702a6f1
This adds an additional parameter to the creation of each flag. This specifies one or more flag groups. This **must** be set for global flags and **must not** be set for local flags. This causes flags.md to be built with sections to aid comprehension and it causes the documentation pages for each command (and the `--help`) to be built showing the flags groups as specified in the `groups` annotation on the command. See: https://forum.rclone.org/t/make-docs-for-mortals-not-only-rclone-gurus/39476/
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
// Package purge provides the purge command.
|
|
package purge
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/rclone/rclone/cmd"
|
|
"github.com/rclone/rclone/fs/operations"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func init() {
|
|
cmd.Root.AddCommand(commandDefinition)
|
|
}
|
|
|
|
var commandDefinition = &cobra.Command{
|
|
Use: "purge remote:path",
|
|
Short: `Remove the path and all of its contents.`,
|
|
Long: `
|
|
Remove the path and all of its contents. Note that this does not obey
|
|
include/exclude filters - everything will be removed. Use the
|
|
[delete](/commands/rclone_delete/) command if you want to selectively
|
|
delete files. To delete empty directories only, use command
|
|
[rmdir](/commands/rclone_rmdir/) or [rmdirs](/commands/rclone_rmdirs/).
|
|
|
|
**Important**: Since this can cause data loss, test first with the
|
|
` + "`--dry-run` or the `--interactive`/`-i`" + ` flag.
|
|
`,
|
|
Annotations: map[string]string{
|
|
"groups": "Important",
|
|
},
|
|
Run: func(command *cobra.Command, args []string) {
|
|
cmd.CheckArgs(1, 1, command, args)
|
|
fdst := cmd.NewFsDir(args)
|
|
cmd.Run(true, false, command, func() error {
|
|
return operations.Purge(context.Background(), fdst, "")
|
|
})
|
|
},
|
|
}
|