t

commit 6c50d91fc42836327d758c6b90bf1247b121cfeb

Author: Pedro Lucas Porcellis <pedrolucasporcellis@gmail.com>

Generate basic config

The Initialize function will hold other actions as to load remote from
config file and to create the repository if there's none

 config/config.go | 36 ++++++++++++++++++++++++++++++++++++
 main.go | 10 ++++++++++


diff --git a/config/config.go b/config/config.go
new file mode 100644
index 0000000000000000000000000000000000000000..96b668630bee926630017fc04d1c97cb5da5a975
--- /dev/null
+++ b/config/config.go
@@ -0,0 +1,36 @@
+package config
+
+import (
+  "path"
+  "fmt"
+  "os/user"
+)
+
+type TConfig struct {
+  BasePath string
+  GitRemote string
+}
+
+func LoadBasicConfiguration() (*TConfig, error) {
+  var (
+    err error
+  )
+
+  currentUser, err := user.Current()
+
+  if err != nil {
+    panic("Could not get the current user")
+  }
+
+  base := path.Join(currentUser.HomeDir, "notes")
+
+  fmt.Println(base)
+
+  config := &TConfig{BasePath: base, GitRemote: "origin"} 
+
+  return config, err
+}
+
+func Initialize() (*TConfig, error) {
+  return LoadBasicConfiguration()
+}




diff --git a/main.go b/main.go
index 1ba83343aecf9ad0b5f4d3019114c44f3155a802..254c7738b7d28260d724a27b7f5bf3bb7a0b09dd 100644
--- a/main.go
+++ b/main.go
@@ -3,12 +3,22 @@
 import (
   "fmt"
   "git.sr.ht/~porcellis/t/models"
+  "git.sr.ht/~porcellis/t/config"
 )
 
 func main() {
   var (
     n models.Note
+    c *config.TConfig
   )
+
+  c, err := config.Initialize()
+  
+  if err != nil {
+    panic(err)
+  }
+
+  fmt.Println(c)
 
   n = models.Note{"Test", "~/notes/test.md"}