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

s3-about
T.C. Ferguson 2017-01-08 10:24:03 -06:00 committed by Nick Craig-Wood
parent e426cb1d1a
commit d4c923a5cc
2 changed files with 27 additions and 0 deletions

View File

@ -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"

26
cmd/obscure/obscure.go Normal file
View File

@ -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
})
},
}