Add obscure command for generating encrypted passwords for rclone's config
This commit is contained in:
parent
e426cb1d1a
commit
d4c923a5cc
2 changed files with 27 additions and 0 deletions
|
@ -25,6 +25,7 @@ import (
|
||||||
_ "github.com/ncw/rclone/cmd/mount"
|
_ "github.com/ncw/rclone/cmd/mount"
|
||||||
_ "github.com/ncw/rclone/cmd/move"
|
_ "github.com/ncw/rclone/cmd/move"
|
||||||
_ "github.com/ncw/rclone/cmd/moveto"
|
_ "github.com/ncw/rclone/cmd/moveto"
|
||||||
|
_ "github.com/ncw/rclone/cmd/obscure"
|
||||||
_ "github.com/ncw/rclone/cmd/purge"
|
_ "github.com/ncw/rclone/cmd/purge"
|
||||||
_ "github.com/ncw/rclone/cmd/rmdir"
|
_ "github.com/ncw/rclone/cmd/rmdir"
|
||||||
_ "github.com/ncw/rclone/cmd/rmdirs"
|
_ "github.com/ncw/rclone/cmd/rmdirs"
|
||||||
|
|
26
cmd/obscure/obscure.go
Normal file
26
cmd/obscure/obscure.go
Normal 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
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
Loading…
Reference in a new issue