summaryrefslogtreecommitdiff
path: root/vendor/github.com/spf13/viper/finder.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/spf13/viper/finder.go')
-rw-r--r--vendor/github.com/spf13/viper/finder.go55
1 files changed, 0 insertions, 55 deletions
diff --git a/vendor/github.com/spf13/viper/finder.go b/vendor/github.com/spf13/viper/finder.go
deleted file mode 100644
index 9b203ea69..000000000
--- a/vendor/github.com/spf13/viper/finder.go
+++ /dev/null
@@ -1,55 +0,0 @@
-package viper
-
-import (
- "errors"
-
- "github.com/spf13/afero"
-)
-
-// WithFinder sets a custom [Finder].
-func WithFinder(f Finder) Option {
- return optionFunc(func(v *Viper) {
- if f == nil {
- return
- }
-
- v.finder = f
- })
-}
-
-// Finder looks for files and directories in an [afero.Fs] filesystem.
-type Finder interface {
- Find(fsys afero.Fs) ([]string, error)
-}
-
-// Finders combines multiple finders into one.
-func Finders(finders ...Finder) Finder {
- return &combinedFinder{finders: finders}
-}
-
-// combinedFinder is a Finder that combines multiple finders.
-type combinedFinder struct {
- finders []Finder
-}
-
-// Find implements the [Finder] interface.
-func (c *combinedFinder) Find(fsys afero.Fs) ([]string, error) {
- var results []string
- var errs []error
-
- for _, finder := range c.finders {
- if finder == nil {
- continue
- }
-
- r, err := finder.Find(fsys)
- if err != nil {
- errs = append(errs, err)
- continue
- }
-
- results = append(results, r...)
- }
-
- return results, errors.Join(errs...)
-}