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") }