forked from rclone/rclone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Factor each commmand into its own package
- Loading branch information
Showing
25 changed files
with
855 additions
and
558 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Package all imports all the commands | ||
package all | ||
|
||
import ( | ||
// Active commands | ||
_ "github.com/ncw/rclone/cmd" | ||
_ "github.com/ncw/rclone/cmd/authorize" | ||
_ "github.com/ncw/rclone/cmd/check" | ||
_ "github.com/ncw/rclone/cmd/cleanup" | ||
_ "github.com/ncw/rclone/cmd/config" | ||
_ "github.com/ncw/rclone/cmd/copy" | ||
_ "github.com/ncw/rclone/cmd/dedupe" | ||
_ "github.com/ncw/rclone/cmd/delete" | ||
_ "github.com/ncw/rclone/cmd/genautocomplete" | ||
_ "github.com/ncw/rclone/cmd/gendocs" | ||
_ "github.com/ncw/rclone/cmd/ls" | ||
_ "github.com/ncw/rclone/cmd/lsd" | ||
_ "github.com/ncw/rclone/cmd/lsl" | ||
_ "github.com/ncw/rclone/cmd/md5sum" | ||
_ "github.com/ncw/rclone/cmd/memtest" | ||
_ "github.com/ncw/rclone/cmd/mkdir" | ||
_ "github.com/ncw/rclone/cmd/move" | ||
_ "github.com/ncw/rclone/cmd/purge" | ||
_ "github.com/ncw/rclone/cmd/rmdir" | ||
_ "github.com/ncw/rclone/cmd/sha1sum" | ||
_ "github.com/ncw/rclone/cmd/size" | ||
_ "github.com/ncw/rclone/cmd/sync" | ||
_ "github.com/ncw/rclone/cmd/version" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package authorize | ||
|
||
import ( | ||
"github.com/ncw/rclone/cmd" | ||
"github.com/ncw/rclone/fs" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func init() { | ||
cmd.Root.AddCommand(authorizeCmd) | ||
} | ||
|
||
var authorizeCmd = &cobra.Command{ | ||
Use: "authorize", | ||
Short: `Remote authorization.`, | ||
Long: ` | ||
Remote authorization. Used to authorize a remote or headless | ||
rclone from a machine with a browser - use as instructed by | ||
rclone config.`, | ||
Run: func(command *cobra.Command, args []string) { | ||
cmd.CheckArgs(1, 3, command, args) | ||
fs.Authorize(args) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package check | ||
|
||
import ( | ||
"github.com/ncw/rclone/cmd" | ||
"github.com/ncw/rclone/fs" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func init() { | ||
cmd.Root.AddCommand(checkCmd) | ||
} | ||
|
||
var checkCmd = &cobra.Command{ | ||
Use: "check source:path dest:path", | ||
Short: `Checks the files in the source and destination match.`, | ||
Long: ` | ||
Checks the files in the source and destination match. It | ||
compares sizes and MD5SUMs and prints a report of files which | ||
don't match. It doesn't alter the source or destination. | ||
` + "`" + `--size-only` + "`" + ` may be used to only compare the sizes, not the MD5SUMs. | ||
`, | ||
Run: func(command *cobra.Command, args []string) { | ||
cmd.CheckArgs(2, 2, command, args) | ||
fsrc, fdst := cmd.NewFsSrcDst(args) | ||
cmd.Run(false, command, func() error { | ||
return fs.Check(fdst, fsrc) | ||
}) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package cleanup | ||
|
||
import ( | ||
"github.com/ncw/rclone/cmd" | ||
"github.com/ncw/rclone/fs" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func init() { | ||
cmd.Root.AddCommand(cleanupCmd) | ||
} | ||
|
||
var cleanupCmd = &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, command, func() error { | ||
return fs.CleanUp(fsrc) | ||
}) | ||
}, | ||
} |
Oops, something went wrong.