mirror of https://github.com/ledisdb/ledisdb.git
36 lines
545 B
Go
36 lines
545 B
Go
package cmd
|
|
|
|
import (
|
|
"flag"
|
|
|
|
"github.com/ledisdb/ledisdb/config"
|
|
"github.com/ledisdb/ledisdb/store"
|
|
)
|
|
|
|
func CmdRepair() {
|
|
var fileName = flag.String("config", "", "ledisdb config file")
|
|
|
|
flag.Parse()
|
|
|
|
if len(*fileName) == 0 {
|
|
println("need ledis config file")
|
|
return
|
|
}
|
|
|
|
cfg, err := config.NewConfigWithFile(*fileName)
|
|
|
|
if err != nil {
|
|
println(err.Error())
|
|
return
|
|
}
|
|
|
|
if len(cfg.DataDir) == 0 {
|
|
println("must set data dir")
|
|
return
|
|
}
|
|
|
|
if err = store.Repair(cfg); err != nil {
|
|
println("repair error: ", err.Error())
|
|
}
|
|
}
|