Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoFile = fmt.Errorf("file: no file")
ErrNoFile is an returned by Lookup implementation to report that lookup didn't find any file to parse.
Functions ¶
This section is empty.
Types ¶
type BytesLookup ¶
type BytesLookup []byte
BytesLookup succeeds source lookup with itself.
func (BytesLookup) Lookup ¶
func (b BytesLookup) Lookup() (io.ReadCloser, error)
Lookup implements Lookup interface.
type FlagLookup ¶
FlagLookup search for flag with equal name and interprets it as filename to open.
func LookupFlag ¶ added in v0.3.0
func LookupFlag(fs *flag.FlagSet, name string) *FlagLookup
LookupFlag is a shortcut to build up a FlagLookup structure.
func (*FlagLookup) Lookup ¶
func (f *FlagLookup) Lookup() (io.ReadCloser, error)
Lookup implements Lookup interface.
type Lookup ¶
type Lookup interface {
Lookup() (io.ReadCloser, error)
}
Lookup is an interface to search for syntax source.
type LookupFunc ¶
type LookupFunc func() (io.ReadCloser, error)
LookupFunc is an adapter that allows the use of ordinar functions as Lookup.
func (LookupFunc) Lookup ¶
func (f LookupFunc) Lookup() (io.ReadCloser, error)
Lookup implements Lookup interface.
type MultiLookup ¶
type MultiLookup []Lookup
MultiLookup holds Lookup implementations and their order.
func (MultiLookup) Lookup ¶
func (ls MultiLookup) Lookup() (io.ReadCloser, error)
Lookup implements Lookup interface.
type Parser ¶
type Parser struct { // Lookup contains logic of how configuration source must be opened. // Lookup must not be nil. Lookup Lookup // Requires makes Parser to fail if Lookup doesn't return any source. Required bool // Syntax contains logic of parsing source. Syntax Syntax }
Parser contains options of parsing source and filling flag values.
type PathLookup ¶
type PathLookup string
PathLookup prepares source search on a path. If path is not exits it doesn't fail.
func (PathLookup) Lookup ¶
func (p PathLookup) Lookup() (io.ReadCloser, error)
Lookup implements Lookup interface.