From d4c923a5ccadb4f189ce2f501afbfc0ca0bf263e Mon Sep 17 00:00:00 2001 From: "T.C. Ferguson" Date: Sun, 8 Jan 2017 10:24:03 -0600 Subject: [PATCH] Add obscure command for generating encrypted passwords for rclone's config --- cmd/all/all.go | 1 + cmd/obscure/obscure.go | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 cmd/obscure/obscure.go 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 + }) + }, +}