aboutsummaryrefslogtreecommitdiffstats
path: root/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'config.go')
-rw-r--r--config.go29
1 files changed, 28 insertions, 1 deletions
diff --git a/config.go b/config.go
index 21f0406..f26e560 100644
--- a/config.go
+++ b/config.go
@@ -1,13 +1,32 @@
package main
import (
+ "io/ioutil"
"os"
"path/filepath"
"github.com/goulash/xdg"
)
-func MaybeWriteConfig() {
+const emptyConfig = `[auth]
+username = ""
+password_cmd = ""
+
+
+[profile]
+person_id = # ADD PERSON ID
+
+
+[projects.example]
+client = # ADD CLIENT ID
+project = # ADD PROJECT ID
+module = # ADD MODULE ID
+task = 0
+work_type = # ADD WORK TYPE ID
+billable = true
+`
+
+func MaybeWriteConfig() error {
path := xdg.FindConfig("timetasker/config.toml")
if path == "" {
@@ -15,5 +34,13 @@ func MaybeWriteConfig() {
if _, err := os.Stat(path); os.IsNotExist(err) {
os.Mkdir(path, 0700)
}
+
+ config_path := filepath.Join(path, "config.toml")
+ err := ioutil.WriteFile(config_path, []byte(emptyConfig), 0644)
+ if err != nil {
+ return err
+ }
}
+
+ return nil
}