Options: added docs
This commit is contained in:
parent
a48bf3f856
commit
a138e3dfcf
|
@ -41,11 +41,13 @@ func OptCheck() Option {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Config stores prediction options.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
complete.Predictor
|
complete.Predictor
|
||||||
check bool
|
check bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Options return a config from a list of options.
|
||||||
func Options(os ...Option) Config {
|
func Options(os ...Option) Config {
|
||||||
var op Config
|
var op Config
|
||||||
for _, f := range os {
|
for _, f := range os {
|
||||||
|
@ -61,6 +63,8 @@ func (c Config) Predict(prefix string) []string {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check checks that value is one of the predicted values, in case
|
||||||
|
// that the check field was set.
|
||||||
func (c Config) Check(value string) error {
|
func (c Config) Check(value string) error {
|
||||||
if !c.check || c.Predictor == nil {
|
if !c.check || c.Predictor == nil {
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue