Bind Vars.

This commit is contained in:
Alec Thomas
2018-07-06 10:44:09 +10:00
parent 17e855bc47
commit 99ff32a85f
4 changed files with 46 additions and 27 deletions
+4 -2
View File
@@ -51,7 +51,7 @@ type Kong struct {
help HelpPrinter
helpOptions HelpOptions
helpFlag *Flag
vars map[string]string
vars Vars
// Set temporarily by Options. These are applied after build().
postBuildOptions []Option
@@ -67,7 +67,7 @@ func New(grammar interface{}, options ...Option) (*Kong, error) {
Stderr: os.Stderr,
registry: NewRegistry().RegisterDefaults(),
resolvers: []ResolverFunc{Envars()},
vars: map[string]string{},
vars: Vars{},
bindings: bindings{},
}
@@ -102,6 +102,8 @@ func New(grammar interface{}, options ...Option) (*Kong, error) {
return nil, err
}
k.bindings.add(k.vars)
return k, nil
}