mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 01:44:41 +01:00
Check return value of errors for config encrypt
This commit is contained in:
parent
b0506a35e7
commit
99a4938d3b
@ -69,15 +69,22 @@ var configEncrypt = &cobra.Command{
|
||||
pass your password directly as an argument. After encryption you will be
|
||||
asked to enter a password when using Rclone. Passwords are not recoverable.
|
||||
`,
|
||||
Run: func(command *cobra.Command, args []string) {
|
||||
RunE: func(command *cobra.Command, args []string) error {
|
||||
if len(args) == 0 {
|
||||
passwd := config.ChangePassword("NEW configuration")
|
||||
config.SetConfigPassword(passwd)
|
||||
err := config.SetConfigPassword(passwd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
cmd.CheckArgs(1, 1, command, args)
|
||||
config.SetConfigPassword(args[0])
|
||||
err := config.SetConfigPassword(args[0])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
config.SaveConfig()
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,10 @@ func rcEncrypt(ctx context.Context, in rc.Params) (out rc.Params, err error) {
|
||||
"error": "password paramater not supplied",
|
||||
}
|
||||
} else {
|
||||
SetConfigPassword(passwd)
|
||||
err := SetConfigPassword(passwd)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
SaveConfig()
|
||||
out = nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user