2024-09-10 22:59:28 +02:00
|
|
|
// Package cmd /
|
|
|
|
|
/*****
|
|
|
|
|
@author Jonas Kaninda
|
|
|
|
|
@license MIT License <https://opensource.org/licenses/MIT>
|
|
|
|
|
@Copyright © 2024 Jonas Kaninda
|
|
|
|
|
**/
|
2024-01-20 14:03:06 +01:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/jkaninda/pg-bkup/pkg"
|
|
|
|
|
"github.com/jkaninda/pg-bkup/utils"
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var RestoreCmd = &cobra.Command{
|
|
|
|
|
Use: "restore",
|
|
|
|
|
Short: "Restore database operation",
|
|
|
|
|
Example: utils.RestoreExample,
|
|
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
|
if len(args) == 0 {
|
|
|
|
|
pkg.StartRestore(cmd)
|
|
|
|
|
} else {
|
2024-10-20 06:36:59 +02:00
|
|
|
utils.Fatal(`"restore" accepts no argument %q`, args)
|
2024-01-20 14:03:06 +01:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
//Restore
|
|
|
|
|
RestoreCmd.PersistentFlags().StringP("file", "f", "", "File name of database")
|
2024-10-21 08:33:01 +02:00
|
|
|
RestoreCmd.PersistentFlags().StringP("storage", "s", "local", "Define storage: local, s3, ssh, ftp")
|
2024-08-29 21:49:35 +02:00
|
|
|
RestoreCmd.PersistentFlags().StringP("path", "P", "", "AWS S3 path without file name. eg: /custom_path or ssh remote path `/home/foo/backup`")
|
2024-01-20 14:03:06 +01:00
|
|
|
|
|
|
|
|
}
|