summaryrefslogtreecommitdiff
path: root/configfile.go
diff options
context:
space:
mode:
Diffstat (limited to 'configfile.go')
-rw-r--r--configfile.go108
1 files changed, 1 insertions, 107 deletions
diff --git a/configfile.go b/configfile.go
index 2cab8fa..d24fc8e 100644
--- a/configfile.go
+++ b/configfile.go
@@ -1,113 +1,6 @@
package repolist
-import (
- "errors"
-
- "go.wit.com/lib/gui/repostatus"
- "go.wit.com/log"
-)
-
/*
-func (v *RepoList) InitRepoList(cfgfile string) {
- v.cfgfile = cfgfile
- lines := parsecfg(cfgfile)
- for _, line := range lines {
- var repo *RepoRow
- var err error
- line = strings.TrimSpace(line)
- if line == "" {
- // skip empty lines
- continue
- }
- if strings.HasPrefix(line, "#") {
- // skip config file comment lines
- continue
- }
- parts := strings.Split(line, " ")
- var private bool = false
- var readonly bool = false
- var userdir bool = false
- if len(parts) > 1 {
- repodir := parts[0]
- for _, s := range parts[1:] {
- option := strings.Split(s, "=")
- if len(option) != 2 {
- log.Log(REPOWARN, "can not parse cfgfile line:", line)
- continue
- }
- switch option[0] {
- case "private":
- if option[1] == "true" {
- log.Log(REPOWARN, repodir, "setting private to true")
- private = true
- } else {
- log.Log(REPOWARN, repodir, "setting private to false")
- private = false
- }
- case "readonly":
- if option[1] == "true" {
- log.Log(REPOWARN, repodir, "setting ReadOnly to true")
- readonly = true
- } else {
- log.Log(REPOWARN, repodir, "setting ReadOnly to false")
- readonly = false
- }
- case "userdir":
- if option[1] == "true" {
- log.Log(REPOWARN, repodir, "setting this directory as Writable()")
- userdir = true
- } else {
- userdir = false
- }
- default:
- log.Log(REPOWARN, "unknown config file option", s)
- }
- }
- }
- if userdir {
- log.Log(REPOWARN, "add this as a writable dir", line)
- continue
- }
- if len(parts) > 0 {
- path := parts[0]
- repo, err = v.NewRepo(path)
- }
- if err != nil {
- log.Log(REPOWARN, line, "repo could not be added", err)
- continue
- }
- if repo == nil {
- // there is not a new repo
- continue
- }
- if private {
- repo.Status.SetPrivate(true)
- } else {
- repo.Status.SetPrivate(false)
- }
- if readonly {
- repo.Status.SetReadOnly(true)
- } else {
- repo.Status.SetReadOnly(false)
- }
- }
-}
-
-func parsecfg(f string) []string {
- homeDir, _ := os.UserHomeDir()
- cfgfile := filepath.Join(homeDir, f)
- content, err := ioutil.ReadFile(cfgfile)
- if err != nil {
- log.Log(REPOWARN, "read cfgfile error", err)
- return nil
- }
- out := string(content)
- out = strings.TrimSpace(out)
- lines := strings.Split(out, "\n")
- return lines
-}
-*/
-
func (rl *RepoList) ArgGitPull() bool {
var localonly int
var badmap int
@@ -195,3 +88,4 @@ func (rl *RepoList) ArgCheckoutUser() bool {
func (rl *RepoList) Cfgfile() string {
return rl.cfgfile
}
+*/