Add a default-enabled EnvResolver for the env tag.

This commit is contained in:
Alec Thomas
2018-06-12 20:54:29 +10:00
parent e9d88d6528
commit 0fb3de514f
4 changed files with 41 additions and 8 deletions
+7 -6
View File
@@ -52,12 +52,13 @@ type Kong struct {
// See the README (https://github.com/alecthomas/kong) for usage instructions.
func New(grammar interface{}, options ...Option) (*Kong, error) {
k := &Kong{
Exit: os.Exit,
Stdout: os.Stdout,
Stderr: os.Stderr,
before: map[reflect.Value]HookFunc{},
registry: NewRegistry().RegisterDefaults(),
help: PrintHelp,
Exit: os.Exit,
Stdout: os.Stdout,
Stderr: os.Stderr,
before: map[reflect.Value]HookFunc{},
registry: NewRegistry().RegisterDefaults(),
help: PrintHelp,
resolvers: []ResolverFunc{EnvResolver()},
}
for _, option := range options {