diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2020-10-09 11:47:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-09 11:47:52 +0200 |
commit | b5b59f5fc9f9c0cd3ad1329c814b6a0d8126e675 (patch) | |
tree | 8e4aca9bf78a24e0c691e0bb4a478a0e5ca5e4ba /plumbing/format/config/option.go | |
parent | 63d92533b538cb380667deee5dc6d32f0946c737 (diff) | |
parent | b40ca794fe33a28f1ca4d6aedacc76b706ea8b04 (diff) | |
download | go-git-b5b59f5fc9f9c0cd3ad1329c814b6a0d8126e675.tar.gz |
Merge pull request #112 from MichaelMure/complete-config
config: add missing functions for completeness
Diffstat (limited to 'plumbing/format/config/option.go')
-rw-r--r-- | plumbing/format/config/option.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/plumbing/format/config/option.go b/plumbing/format/config/option.go index 218f992..cad3948 100644 --- a/plumbing/format/config/option.go +++ b/plumbing/format/config/option.go @@ -54,6 +54,16 @@ func (opts Options) Get(key string) string { return "" } +// Has checks if an Option exist with the given key. +func (opts Options) Has(key string) bool { + for _, o := range opts { + if o.IsKey(key) { + return true + } + } + return false +} + // GetAll returns all possible values for the same key. func (opts Options) GetAll(key string) []string { result := []string{} |