feat: add --preserve-config flag to restore command (#1939)

Add a new `--preserve-config` flag to the restore command that allows
users to restore database and files from a dump while keeping their
existing configuration file untouched.
This commit is contained in:
kolaente
2025-12-07 22:44:45 +01:00
committed by GitHub
parent f14f6ba38f
commit 0a78f7608a
2 changed files with 16 additions and 6 deletions

View File

@@ -23,8 +23,11 @@ import (
"github.com/spf13/cobra"
)
var preserveConfig bool
func init() {
rootCmd.AddCommand(restoreCmd)
restoreCmd.Flags().BoolVar(&preserveConfig, "preserve-config", false, "Preserve existing configuration instead of restoring from dump")
}
var restoreCmd = &cobra.Command{
@@ -35,7 +38,7 @@ var restoreCmd = &cobra.Command{
initialize.FullInitWithoutAsync()
},
Run: func(_ *cobra.Command, args []string) {
if err := dump.Restore(args[0]); err != nil {
if err := dump.Restore(args[0], !preserveConfig); err != nil {
log.Critical(err.Error())
}
},