-
-
Notifications
You must be signed in to change notification settings - Fork 152
Closed
Description
I am trying to hook myself into my application after the default is set but before the resolvers got triggered.
However, when using the env
notation, the resolver has populated my structure before the BeforeResolve
hook.
Here is an example to trigger:
package main
import (
"fmt"
"github.com/alecthomas/kong"
)
type CLI struct {
Dev bool `env:"DEV"`
}
func (c CLI) BeforeResolve() error {
fmt.Printf("%+v\n", c)
return nil
}
func (c CLI) Run() error {
return nil
}
func main() {
cli := CLI{}
ctx := kong.Parse(&cli)
err := ctx.Run()
ctx.FatalIfErrorf(err)
}
If I run: DEV=1 go run main.go
, the Dev
attribute is already populated.
It may be expected, however, the README state that the env
annotation is implemented as a resolver.
Metadata
Metadata
Assignees
Labels
No labels