Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

Add obscure command for generating encrypted passwords for rclone's config

T.C. Fergusond4c923a5ccad
diff --git a/cmd/all/all.go b/cmd/all/all.go
index 2cf1160ed..9a256e825 100644
--- a/cmd/all/all.go
+++ b/cmd/all/all.go
@@ -25,6 +25,7 @@ import (
_ "github.com/ncw/rclone/cmd/mount"
_ "github.com/ncw/rclone/cmd/move"
_ "github.com/ncw/rclone/cmd/moveto"
+ _ "github.com/ncw/rclone/cmd/obscure"
_ "github.com/ncw/rclone/cmd/purge"
_ "github.com/ncw/rclone/cmd/rmdir"
_ "github.com/ncw/rclone/cmd/rmdirs"
diff --git a/cmd/obscure/obscure.go b/cmd/obscure/obscure.go
new file mode 100644
index 000000000..f754b8cd9
--- /dev/null
+++ b/cmd/obscure/obscure.go
@@ -0,0 +1,26 @@
+package obscure
+
+import (
+ "fmt"
+
+ "github.com/ncw/rclone/cmd"
+ "github.com/ncw/rclone/fs"
+ "github.com/spf13/cobra"
+)
+
+func init() {
+ cmd.Root.AddCommand(commandDefintion)
+}
+
+var commandDefintion = &cobra.Command{
+ Use: "obscure password",
+ Short: `Obscure password for use in the rclone.conf`,
+ Run: func(command *cobra.Command, args []string) {
+ cmd.CheckArgs(1, 1, command, args)
+ cmd.Run(false, false, command, func() error {
+ obscure := fs.MustObscure(args[0])
+ fmt.Println(obscure)
+ return nil
+ })
+ },
+}