summaryrefslogtreecommitdiff
path: root/config.go
blob: 8f53f71ce878a26dd146b8889a2d3de35419ef40 (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
package main

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

import (
	"fmt"

	"go.wit.com/lib/config"
	"go.wit.com/lib/protobuf/forgepb"
)

func forgeConfigSave() error {
	return me.forge.Config.ConfigSave()
}

func setForgeMode(fmode forgepb.ForgeMode) {
	if me.forge.Config.Mode == fmode {
		return
	}
	me.forge.Config.Mode = fmode
	config.SetChanged("forge", true)
	me.forge.Config.ConfigSave()
}

func sampleConfig(all *forgepb.ForgeConfigs) {
	new1 := new(forgepb.ForgeConfig)
	new1.GoPath = "go.wit.com"
	new1.Writable = true
	new1.Directory = true
	all.Append(new1)

	fmt.Println("first time user. adding an example config file with", len(all.ForgeConfigs), "repos")
}