aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/dm/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/dm/main.go')
-rw-r--r--cmd/dm/main.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/cmd/dm/main.go b/cmd/dm/main.go
index 9a93fa4..de79441 100644
--- a/cmd/dm/main.go
+++ b/cmd/dm/main.go
@@ -73,6 +73,15 @@ func main() {
os.Exit(1)
}
+ opts := reader.Opts{
+ DBPath: "",
+ ImportPath: *importFlg,
+ Name: *nameFlg,
+ Overwrite: *overwriteFlg,
+ Initial: *initialFlg,
+ DMData: nil,
+ }
+
switch os.Args[1] {
case "server":
@@ -109,13 +118,14 @@ func main() {
os.Exit(1)
}
// Here we actually read the data from the file
- data, err := reader.ReadDML(*importFlg)
+ data, err := reader.ReadDML(opts.ImportPath)
if err != nil {
log.Fatal(err)
}
+ opts.DMData = data
- db_path := filepath.Join(config_path, db_name)
- err = reader.DatamapToDB(db_path, data, *nameFlg, *importFlg)
+ opts.DBPath = filepath.Join(config_path, db_name)
+ err = reader.DatamapToDB(opts)
if err != nil {
log.Fatal(err)
}