mirror of
https://github.com/octoleo/restic.git
synced 2025-01-09 17:33:56 +00:00
Merge pull request #201 from restic/create_first_then_ask_for_password
Ask for password after create repo succeeded
This commit is contained in:
commit
c143f8c9e3
@ -15,17 +15,17 @@ func (cmd CmdInit) Execute(args []string) error {
|
|||||||
return errors.New("Please specify repository location (-r)")
|
return errors.New("Please specify repository location (-r)")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
be, err := create(cmd.global.Repo)
|
||||||
|
if err != nil {
|
||||||
|
cmd.global.Exitf(1, "creating backend at %s failed: %v\n", cmd.global.Repo, err)
|
||||||
|
}
|
||||||
|
|
||||||
if cmd.global.password == "" {
|
if cmd.global.password == "" {
|
||||||
cmd.global.password = cmd.global.ReadPasswordTwice(
|
cmd.global.password = cmd.global.ReadPasswordTwice(
|
||||||
"enter password for new backend: ",
|
"enter password for new backend: ",
|
||||||
"enter password again: ")
|
"enter password again: ")
|
||||||
}
|
}
|
||||||
|
|
||||||
be, err := create(cmd.global.Repo)
|
|
||||||
if err != nil {
|
|
||||||
cmd.global.Exitf(1, "creating backend at %s failed: %v\n", cmd.global.Repo, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
s := repository.New(be)
|
s := repository.New(be)
|
||||||
err = s.Init(cmd.global.password)
|
err = s.Init(cmd.global.password)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user