From 576e1c63c4d08fca04cf060392a8c3d8b0bba89a Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Wed, 24 Jun 2020 19:34:38 +0200 Subject: config: add missing functions for completeness --- plumbing/format/config/option.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'plumbing/format/config/option.go') diff --git a/plumbing/format/config/option.go b/plumbing/format/config/option.go index d4775e4..316ff52 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{} -- cgit