-
-
Notifications
You must be signed in to change notification settings - Fork 152
Comparing changes
Open a pull request
base repository: alecthomas/kong
base: v1.6.0
head repository: alecthomas/kong
compare: v1.7.0
- 15 commits
- 19 files changed
- 4 contributors
Commits on Dec 7, 2024
-
Configuration menu - View commit details
-
Copy full SHA for f2fcd34 - Browse repository at this point
Copy the full SHA f2fcd34View commit details
Commits on Dec 12, 2024
-
chore(deps): update all non-major dependencies (#476)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 565ae9b - Browse repository at this point
Copy the full SHA 565ae9bView commit details
Commits on Dec 27, 2024
-
feat: allow hooks to be declared on embedded fields
Specifically, on Go embedded fields, not on fields tagged with `embed`. Fixes #90.
Configuration menu - View commit details
-
Copy full SHA for 840220c - Browse repository at this point
Copy the full SHA 840220cView commit details
Commits on Dec 28, 2024
-
For some reason this was called by `Run()`. All tests pass without it, so I'm not sure why it was there. Fixes #481
Configuration menu - View commit details
-
Copy full SHA for a14bb20 - Browse repository at this point
Copy the full SHA a14bb20View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3625768 - Browse repository at this point
Copy the full SHA 3625768View commit details -
Configuration menu - View commit details
-
Copy full SHA for a32b94b - Browse repository at this point
Copy the full SHA a32b94bView commit details
Commits on Dec 29, 2024
-
Configuration menu - View commit details
-
Copy full SHA for cacaace - Browse repository at this point
Copy the full SHA cacaaceView commit details -
Configuration menu - View commit details
-
Copy full SHA for 47b090f - Browse repository at this point
Copy the full SHA 47b090fView commit details -
Configuration menu - View commit details
-
Copy full SHA for b811e32 - Browse repository at this point
Copy the full SHA b811e32View commit details
Commits on Jan 4, 2025
-
Configuration menu - View commit details
-
Copy full SHA for 7ca8467 - Browse repository at this point
Copy the full SHA 7ca8467View commit details
Commits on Jan 13, 2025
-
chore(deps): update all non-major dependencies (#485)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 8d238c8 - Browse repository at this point
Copy the full SHA 8d238c8View commit details
Commits on Jan 24, 2025
-
Configuration menu - View commit details
-
Copy full SHA for 042a325 - Browse repository at this point
Copy the full SHA 042a325View commit details
Commits on Jan 29, 2025
-
Support hooks on
embed:""
fields (#493)Relates to 840220c (#90) This change adds support for hooks to be called on fields that are tagged with `embed:""`. ### Use case If a command has several subcommands, many (but not all) of which need the same external resource, this allows defining the flag-level inputs for that resource centrally, and then using `embed:""` in any command that needs that resource. For example, imagine: ```go type githubClientProvider struct { Token string `name:"github-token" env:"GITHUB_TOKEN"` URL string `name:"github-url" env:"GITHUB_URL"` } func (g *githubClientProvider) BeforeApply(kctx *kong.Context) error { return kctx.BindToProvider(func() (*github.Client, error) { return github.NewClient(...), nil }) } ``` Then, any command that needs GitHub client will add this field, any other resource providers it needs, and add parameters to its `Run` method to accept those resources: ```go type listUsersCmd struct { GitHub githubClientProvider `embed:""` S3 s3ClientProvider `embed:""` } func (l *listUsersCmd) Run(gh *github.Client, s3 *s3.Client) error { ... } ``` ### Alternatives It is possible to do the same today if the `*Provider` struct above is actually a Go embed instead of a Kong embed, *and* it is exported. ``` type GitHubClientProvider struct{ ... } type listUsersCmd struct { GithubClientProvider S3ClientProvider } ``` The difference is whether the struct defining the flags is required to be exported or not.
Configuration menu - View commit details
-
Copy full SHA for 9c08a58 - Browse repository at this point
Copy the full SHA 9c08a58View commit details
Commits on Jan 30, 2025
-
Configuration menu - View commit details
-
Copy full SHA for 4e1757c - Browse repository at this point
Copy the full SHA 4e1757cView commit details -
hooks: Recursively search embedded fields for methods (#494)
* hooks: Recursively search embedded fields for methods Follow up to #493 and 840220c Kong currently supports hooks on embedded fields of a parsed node, but only at the first level of embedding: ``` type mainCmd struct { FooOptions } type FooOptions struct { BarOptions } func (f *FooOptions) BeforeApply() error { // this will be called } type BarOptions struct { } func (b *BarOptions) BeforeApply() error { // this will not be called } ``` This change adds support for hooks to be defined on embedded fields of embedded fields so that the above example would work as expected. Per #493, the definition of "embedded" field is adjusted to mean: - Any anonymous (Go-embedded) field that is exported - Any non-anonymous field that is tagged with `embed:""` *Testing*: Includes a test case for embedding an anonymous field in an `embed:""` and an `embed:""` field in an anonymous field. * Use recursion to build up the list of receivers The 'receivers' parameter helps avoid constant memory allocation as the backing storage for the slice is reused across recursive calls.
Configuration menu - View commit details
-
Copy full SHA for 4be6ae6 - Browse repository at this point
Copy the full SHA 4be6ae6View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff v1.6.0...v1.7.0