summaryrefslogtreecommitdiff
path: root/forgeConfig.config.go
blob: 6b7f084ef629d4752b96bda30763e7f280c630ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright 2025 WIT.COM Inc Licensed GPL 3.0

package forgepb

import (
	"os"

	"go.wit.com/lib/config"
	"go.wit.com/log"
)

// functions to import and export the protobuf
// data to and from config files

// write to ~/.config/forge/
func (cfg *ForgeConfigs) ConfigSave() error {
	var header string
	header += "\n"
	header += "# the forge config file\n"
	header += "# You can customize things like:\n"
	header += "#\n"
	header += "#    * which repos you have write access to\n"
	header += "#    * custom branch names for 'master', 'devel' and 'user'\n"
	header += "#    * 'favorites' so you can remember which things you like\n"
	header += "#\n"
	header += "\n"
	return config.ConfigSaveWithHeader(cfg, header)
}

func (cfg *ForgeConfigs) DumpENV() {
	log.Infof("RepoPB file: cfg.ReposPB=%s FORGE_REPOSPB=%s\n", cfg.ReposPB, os.Getenv("FORGE_REPOSPB"))
}

// load the ~/.config/forge/ files
func (c *ForgeConfigs) ConfigLoad(fullpath string) error {
	return nil
}

/*
	if f.Config.Username == "" {
		usr, _ := user.Current()
		f.Config.Username = usr.Username
		f.SetConfigSave(true)
	}

	if f.Config.Xterm == "" {
		f.Config.Xterm = "xterm"
		f.Config.XtermArgv = append(f.Config.XtermArgv, "-bg")
		f.Config.XtermArgv = append(f.Config.XtermArgv, "black")
		f.Config.XtermArgv = append(f.Config.XtermArgv, "-fg")
		f.Config.XtermArgv = append(f.Config.XtermArgv, "white")
		f.SetConfigSave(true)
	}
*/