Files
filebrowser/cmd/upgrade.go
T

32 lines
844 B
Go
Raw Normal View History

2019-01-05 22:44:33 +00:00
package cmd
import (
"github.com/filebrowser/filebrowser/v2/storage/bolt/importer"
"github.com/spf13/cobra"
)
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", "", "")
upgradeCmd.MarkFlagRequired("old.database")
2019-01-05 22:44:33 +00:00
}
2019-01-07 19:22:32 +00:00
var upgradeCmd = &cobra.Command{
Use: "upgrade",
Version: rootCmd.Version,
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)
},
}