You've already forked filebrowser
mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-11-26 14:25:26 +08:00
feat: v2 (#599)
Read https://github.com/filebrowser/filebrowser/pull/575.
This commit is contained in:
30
cmd/import.go
Normal file
30
cmd/import.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/filebrowser/filebrowser/v2/storage/bolt/importer"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(importCmd)
|
||||
|
||||
importCmd.Flags().String("old.database", "", "")
|
||||
importCmd.Flags().String("old.config", "", "")
|
||||
importCmd.MarkFlagRequired("old.database")
|
||||
}
|
||||
|
||||
var importCmd = &cobra.Command{
|
||||
Use: "import",
|
||||
Short: "Imports an old configuration",
|
||||
Long: `Imports an old configuration. This command DOES NOT
|
||||
import share links because they are incompatible with
|
||||
this version.`,
|
||||
Args: cobra.NoArgs,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
oldDB := mustGetString(cmd, "old.database")
|
||||
oldConf := mustGetString(cmd, "old.config")
|
||||
|
||||
err := importer.Import(oldDB, oldConf, databasePath)
|
||||
checkErr(err)
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user