aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/datamaps/config.go
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-07-22 21:01:54 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-07-22 21:01:54 +0100
commitd7d4d0a0476f98d1b0b4c5c454b6d1048a82bdad (patch)
tree11aaba3bab132e3f7d13f73c61d8b14739794f50 /pkg/datamaps/config.go
parentc3d4c6bb51a3d7b89e0fcbb69230db423577ae17 (diff)
more major surgery
Diffstat (limited to '')
-rw-r--r--pkg/datamaps/config.go46
1 files changed, 46 insertions, 0 deletions
diff --git a/pkg/datamaps/config.go b/pkg/datamaps/config.go
new file mode 100644
index 0000000..61ef760
--- /dev/null
+++ b/pkg/datamaps/config.go
@@ -0,0 +1,46 @@
+package datamaps
+
+import (
+ "os"
+ "path/filepath"
+)
+
+const (
+ config_dir_name = "datamaps-go"
+ db_name = "datamaps.db"
+)
+
+func getUserConfigDir() (string, error) {
+ dir, err := os.UserConfigDir()
+ config_path := filepath.Join(dir, config_dir_name)
+ if err != nil {
+ return "", err
+ }
+ return config_path, nil
+}
+
+type Options struct {
+ DBPath string
+ DMPath string
+ DMName string
+ DMOverwrite bool
+ DMInitial bool
+ DMData []DatamapLine
+}
+
+func defaultOptions() *Options {
+ return &Options{
+ DBPath: "PATH TO DB",
+ DMPath: "PATH TO DATAMAP",
+ DMName: "Unnamed Datamap",
+ DMOverwrite: false,
+ DMInitial: false,
+ DMData: make([]DatamapLine, 0),
+ }
+}
+
+func ParseOptions() *Options {
+ opts := defaultOptions()
+ return opts
+
+}