Files
filebrowser/cmd/upgrade.go
T

32 lines
818 B
Go
Raw Normal View History

2019-01-05 22:44:33 +00:00
package cmd
import (
"github.com/spf13/cobra"
2020-06-01 01:12:36 +02:00
"github.com/filebrowser/filebrowser/v2/storage/bolt/importer"
2019-01-05 22:44:33 +00:00
)
func init() {
2019-01-07 19:22:32 +00:00
rootCmd.AddCommand(upgradeCmd)
2019-01-05 22:44:33 +00:00
2019-01-07 19:22:32 +00:00
upgradeCmd.Flags().String("old.database", "", "")
upgradeCmd.Flags().String("old.config", "", "")
2020-06-01 01:12:36 +02:00
_ = upgradeCmd.MarkFlagRequired("old.database")
2019-01-05 22:44:33 +00:00
}
2019-01-07 19:22:32 +00:00
var upgradeCmd = &cobra.Command{
2019-02-15 12:54:44 +01:00
Use: "upgrade",
Short: "Upgrades an old configuration",
2019-01-07 19:22:32 +00:00
Long: `Upgrades an old configuration. This command DOES NOT
2019-01-05 22:44:33 +00:00
import share links because they are incompatible with
this version.`,
2019-01-05 23:01:16 +00:00
Args: cobra.NoArgs,
2019-01-05 22:44:33 +00:00
Run: func(cmd *cobra.Command, args []string) {
2019-01-08 14:07:55 +00:00
flags := cmd.Flags()
oldDB := mustGetString(flags, "old.database")
oldConf := mustGetString(flags, "old.config")
2019-01-08 21:10:27 +01:00
err := importer.Import(oldDB, oldConf, getParam(flags, "database"))
2019-01-05 22:44:33 +00:00
checkErr(err)
},
}