func (fs *FlagSet) Parse(args []string, sources ...Source) error {
	if fs.parsed {
		return nil
	}
	fs.parsed = true
	fs.sources = sources
	if fs.found == nil {
		fs.found = make(map[string]*Flag)
	}
	for {
		var err error
		args, err = fs.parseNext(args)
		if err != nil {
			if err == ErrHelp {
				fs.printUsage()
			} else {
				fs.printError(err)
			}
			switch fs.errorHandling {
			case ContinueOnError:
				return err
			case PanicOnError:
				panic(err)
			case ExitOnError:
				exit(2)
				return nil
			}
		}
		if len(args) == 0 {
			break
		}
	}
	defer func() {
		for _, s := range sources {
			_ = s.Close()
		}
	}()
	for _, s := range sources {
		if err := s.Open(); err != nil {
			return err
		}
	}
	for name, f := range fs.flags {
		if _, ok := fs.found[name]; !ok {
			var found bool
			for _, e := range f.Extractors {
				if ok, err := e.Get(sources, f.Value); err != nil {
					return err
				} else if ok {
					found = true
					break
				}
			}
			if !found {
				fs.found[name] = f
				if err := f.Value.Set(f.Default); err != nil {
					return err
				}
			}
		}
	}
	return nil
}
Parse fills the flags with values from the given arguments and sources.
package flagga
import (
	"fmt"
	"io"
	"os"
	"reflect"
	"strings"
	"time"
)
type Flag struct {
	Name       string
	Usage      string
	Value      Value
	Default    interface{}
	Extractors []Extractor
}
type FlagSet struct {
	name          string
	description   string
	parsed        bool
	args          []string
	nonFlags      []string
	sources       []Source
	flagOrder     []string
	flags         map[string]*Flag
	found         map[string]*Flag
	out           io.Writer
	errorHandling ErrorHandling
	Usage func()
}
type ErrorHandling byte
const (
	ContinueOnError ErrorHandling = iota
	ExitOnError
	PanicOnError
)
func NewFlagSet(name, description string, errorHandling ErrorHandling) *FlagSet {
	var fs FlagSet
	fs.Init(name, description, errorHandling)
	return &fs
}
func (fs *FlagSet) Init(name, description string, errorHandling ErrorHandling) {
	fs.args = nil
	fs.found = make(map[string]*Flag)
	fs.flags = make(map[string]*Flag)
	fs.description = description
	fs.name = name
	fs.errorHandling = errorHandling
}
var exit = os.Exit