aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/config/section.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-08-02 08:12:44 +0200
committerGitHub <noreply@github.com>2017-08-02 08:12:44 +0200
commit9befb514d83e22268d00ab2c0fdd797b3742f0e9 (patch)
tree923a78009cce4531912b92e1b756a6a8f3ee6d32 /plumbing/format/config/section.go
parent91cdedae7faffca0a707fa47780efafe157ba47c (diff)
parente5c6fa237776870483cbe227d7f7ea943f35cb12 (diff)
downloadgo-git-9befb514d83e22268d00ab2c0fdd797b3742f0e9.tar.gz
Merge pull request #501 from smola/config-multiple-urls
config: multiple values in RemoteConfig (URLs and Fetch)
Diffstat (limited to 'plumbing/format/config/section.go')
-rw-r--r--plumbing/format/config/section.go27
1 files changed, 24 insertions, 3 deletions
diff --git a/plumbing/format/config/section.go b/plumbing/format/config/section.go
index 547da1e..4a17e3b 100644
--- a/plumbing/format/config/section.go
+++ b/plumbing/format/config/section.go
@@ -1,6 +1,9 @@
package config
-import "strings"
+import (
+ "fmt"
+ "strings"
+)
// Section is the representation of a section inside git configuration files.
// Each Section contains Options that are used by both the Git plumbing
@@ -36,8 +39,26 @@ type Subsection struct {
type Sections []*Section
+func (s Sections) GoString() string {
+ var strs []string
+ for _, ss := range s {
+ strs = append(strs, fmt.Sprintf("%#v", ss))
+ }
+
+ return strings.Join(strs, ", ")
+}
+
type Subsections []*Subsection
+func (s Subsections) GoString() string {
+ var strs []string
+ for _, ss := range s {
+ strs = append(strs, fmt.Sprintf("%#v", ss))
+ }
+
+ return strings.Join(strs, ", ")
+}
+
// IsName checks if the name provided is equals to the Section name, case insensitive.
func (s *Section) IsName(name string) bool {
return strings.ToLower(s.Name) == strings.ToLower(name)
@@ -113,8 +134,8 @@ func (s *Subsection) AddOption(key string, value string) *Subsection {
// SetOption adds a new Option to the Subsection. If the option already exists, is replaced.
// The updated Subsection is returned.
-func (s *Subsection) SetOption(key string, value string) *Subsection {
- s.Options = s.Options.withSettedOption(key, value)
+func (s *Subsection) SetOption(key string, value ...string) *Subsection {
+ s.Options = s.Options.withSettedOption(key, value...)
return s
}