cli: don't ask for password if repository is not connected
@@ -47,10 +47,14 @@ func onCtrlC(f func()) {
}
func openRepository(ctx context.Context, opts *repo.Options, required bool) (repo.Repository, error) {
- if _, err := os.Stat(repositoryConfigFileName()); os.IsNotExist(err) && !required {
+ if _, err := os.Stat(repositoryConfigFileName()); os.IsNotExist(err) {
+ if !required {
return nil, nil
}
+ return nil, errors.Errorf("repository is not connected. See https://kopia.io/docs/repositories/")
+ }
+
maybePrintUpdateNotification(ctx)
pass, err := getPasswordFromFlags(ctx, false, true)
