mirror of
https://github.com/rclone/rclone.git
synced 2024-11-26 10:13:52 +08:00
f78cd1e043
- Change rclone/fs interfaces to accept context.Context - Update interface implementations to use context.Context - Change top level usage to propagate context to lover level functions Context propagation is needed for stopping transfers and passing other request-scoped values.
30 lines
658 B
Go
30 lines
658 B
Go
package cleanup
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/ncw/rclone/cmd"
|
|
"github.com/ncw/rclone/fs/operations"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func init() {
|
|
cmd.Root.AddCommand(commandDefintion)
|
|
}
|
|
|
|
var commandDefintion = &cobra.Command{
|
|
Use: "cleanup remote:path",
|
|
Short: `Clean up the remote if possible`,
|
|
Long: `
|
|
Clean up the remote if possible. Empty the trash or delete old file
|
|
versions. Not supported by all remotes.
|
|
`,
|
|
Run: func(command *cobra.Command, args []string) {
|
|
cmd.CheckArgs(1, 1, command, args)
|
|
fsrc := cmd.NewFsSrc(args)
|
|
cmd.Run(true, false, command, func() error {
|
|
return operations.CleanUp(context.Background(), fsrc)
|
|
})
|
|
},
|
|
}
|