summaryrefslogtreecommitdiff
path: root/comitium.go
diff options
context:
space:
mode:
authornytpu <alex@nytpu.com>2021-03-18 10:37:00 -0600
committernytpu <alex@nytpu.com>2021-03-18 10:37:00 -0600
commitc145f8d4d230907bf4dd2e0494190bc22ee5d22f (patch)
treeb732865a080e200aac661b68a35d5694492a7077 /comitium.go
parenta3a427b9eed52b5e173191cb4d2c871db3d8148a (diff)
initialize core in main()
Diffstat (limited to 'comitium.go')
-rw-r--r--comitium.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/comitium.go b/comitium.go
index 6cc069b..b5c4524 100644
--- a/comitium.go
+++ b/comitium.go
@@ -8,11 +8,12 @@ package main
import (
"fmt"
- "log"
"os"
"path/filepath"
"github.com/mitchellh/go-homedir"
+
+ "golang.nytpu.com/comitium/core"
)
func main() {
@@ -45,6 +46,11 @@ func main() {
// dataPath is the location where all the data (list of subs, cached hashes,
// etcetera) are stored
dataPath := getDataPath()
+ err := core.Init(dataPath)
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Error in initialization: %v\n", err)
+ os.Exit(1)
+ }
switch os.Args[1] {
case "refresh":
@@ -57,8 +63,6 @@ func main() {
case "remove":
fmt.Println("Remove")
}
-
- fmt.Printf("Detected data path: %v\n", dataPath)
}
// verifyPath will expand ~ if neccessary and will clean the path.
@@ -94,7 +98,7 @@ func getDataPath() string {
return verifyPath(home + "/.comitium")
}
- log.Printf("Error finding a suitable directory! Falling back to the current working directory. See \"comitium help\" or comitium(1) for more information.")
+ fmt.Fprintln(os.Stderr, "Error finding a suitable directory! Falling back to the current working directory. See \"comitium help\" or comitium(1) for more information.")
return verifyPath("comitium")
}