aboutsummaryrefslogtreecommitdiffstats
path: root/repository/repo.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-05-27 21:18:46 +0200
committerMichael Muré <batolettre@gmail.com>2019-05-27 21:39:55 +0200
commitd564e37b317a2d59a9694d80b03b40e5d36f741f (patch)
treeba6bcdca38286372293b65f3c0b087cf95c066a1 /repository/repo.go
parentc7abac388aadd274d4f23f996a15f8bba90f2a92 (diff)
downloadgit-bug-d564e37b317a2d59a9694d80b03b40e5d36f741f.tar.gz
repository: add ReadConfigBool and ReadConfigString functions
Diffstat (limited to 'repository/repo.go')
-rw-r--r--repository/repo.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/repository/repo.go b/repository/repo.go
index 8a66c320..f3c2de6d 100644
--- a/repository/repo.go
+++ b/repository/repo.go
@@ -3,12 +3,16 @@ package repository
import (
"bytes"
+ "errors"
"strings"
"github.com/MichaelMure/git-bug/util/git"
"github.com/MichaelMure/git-bug/util/lamport"
)
+var ErrNoConfigEntry = errors.New("no config entry for the given key")
+var ErrMultipleConfigEntry = errors.New("multiple config entry for the given key")
+
// RepoCommon represent the common function the we want all the repo to implement
type RepoCommon interface {
// GetPath returns the path to the repo.
@@ -29,6 +33,16 @@ type RepoCommon interface {
// ReadConfigs read all key/value pair matching the key prefix
ReadConfigs(keyPrefix string) (map[string]string, error)
+ // ReadConfigBool read a single boolean value from the config
+ // Return ErrNoConfigEntry or ErrMultipleConfigEntry if there is zero or more than one entry
+ // for this key
+ ReadConfigBool(key string) (bool, error)
+
+ // ReadConfigBool read a single string value from the config
+ // Return ErrNoConfigEntry or ErrMultipleConfigEntry if there is zero or more than one entry
+ // for this key
+ ReadConfigString(key string) (string, error)
+
// RmConfigs remove all key/value pair matching the key prefix
RmConfigs(keyPrefix string) error
}