summaryrefslogtreecommitdiff
path: root/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'config.go')
-rw-r--r--config.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/config.go b/config.go
index abbc78b..851c93b 100644
--- a/config.go
+++ b/config.go
@@ -6,7 +6,9 @@ import (
//"os"
"io/ioutil"
//"strconv"
+ "github.com/fatih/color"
"github.com/BurntSushi/toml"
+ "github.com/atrox/homedir"
)
type Config struct {
@@ -32,7 +34,8 @@ var conffile string
var config Config
func init() {
- conffile = "laboravi.config.toml"
+ conffile,err = homedir.Expand("~/.laboravi.config.toml") //make ~ when finished
+ checkErr(err)
}
func editConf() {
@@ -57,13 +60,16 @@ func editConf() {
}
func initConf() {
+ boldGreen := color.New(color.FgGreen, color.Bold).SprintFunc()
+ boldRed := color.New(color.FgRed, color.Bold).SprintFunc()
for {
if _, err := toml.DecodeFile(conffile, &config); err != nil {
//fmt.Println(err)
- fmt.Println("Configuration file not found")
+ fmt.Println(boldRed("Configuration file not found"))
makeNewTOML(false)
}else{
- fmt.Println("Configuration loaded Successfully")
+ //fmt.Println(boldGreen("Configuration loaded Successfully"))
+ fmt.Println("Config loaded...",boldGreen("Hello ",config.Name))
break
}
}
@@ -76,7 +82,9 @@ func makeNewTOML(gibts bool) {
fmt.Println("Making new Configuration File")
//Examplenames Coming soon
n := ""
- config = Config{".mytimes.db",n,n,n,n,n,n,n,n,n,n,n,n,n,n,n}
+ file,err := homedir.Expand("~/.mywork.db")
+ checkErr(err)
+ config = Config{file,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n}
}
//fmt.Println("Whats Your Namecount\n")
database := getNewInput("DB File Path: ",config.Database)