diff --git a/cmd/restic/cmd_migrate.go b/cmd/restic/cmd_migrate.go index 4af98005e..f82439715 100644 --- a/cmd/restic/cmd_migrate.go +++ b/cmd/restic/cmd_migrate.go @@ -8,11 +8,12 @@ import ( ) var cmdMigrate = &cobra.Command{ - Use: "migrate [flags] [name]", + Use: "migrate [flags] [migration name] [...]", Short: "Apply migrations", Long: ` -The "migrate" command applies migrations to a repository. When no migration -name is explicitly given, a list of migrations that can be applied is printed. +The "migrate" command checks which migrations can be applied for a repository +and prints a list with available migration names. If one or more migration +names are specified, these migrations are applied. EXIT STATUS =========== @@ -41,6 +42,8 @@ func init() { func checkMigrations(opts MigrateOptions, gopts GlobalOptions, repo restic.Repository) error { ctx := gopts.ctx Printf("available migrations:\n") + found := false + for _, m := range migrations.All { ok, err := m.Check(ctx, repo) if err != nil { @@ -48,10 +51,15 @@ func checkMigrations(opts MigrateOptions, gopts GlobalOptions, repo restic.Repos } if ok { - Printf(" %v: %v\n", m.Name(), m.Desc()) + Printf(" %v\t%v\n", m.Name(), m.Desc()) + found = true } } + if !found { + Printf("no migrations found") + } + return nil }