8000 Tags · alecthomas/kong · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Tags: alecthomas/kong

Tags

v1.11.0

Toggle v1.11.0's commit message
chore: optionally allow parsing of hyphen-prefixied flag parameters

This allows for eg. `foo --number -10`, `foo --flag -bar`.

Fixes #478, #315.

v1.10.0

Toggle v1.10.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
feat: Allow configuring global hooks via Kong's functional options (#511

)

Lets you pass `kong.WithBeforeApply` along with a function that supports dynamic bindings to register a `BeforeApply` hook without tying it directly to a node in the schema.

Co-authored-by: Sutina Wipawiwat <swipawiwat@squareup.com>

v1.9.0

Toggle v1.9.0's commit message
refactor: ParseError can carry an exit code

Reinstated use of ParseError for all error paths so as to retain existing semantics.

v1.8.1

Toggle v1.8.1's commit message
chore: add test for decoding

v1.8.0

Toggle v1.8.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Load environment variables as a resolver (#480)

v1.7.0

Toggle v1.7.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
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.

v1.6.1

Toggle v1.6.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix(Context.Run): Don't panic on unselected root node (#484)

v1.6.0

Toggle v1.6.0's commit message
feat: add support for `Provide*() (<type>, error)` methods on commands

v1.5.1

Toggle v1.5.1's commit message
fix: regression where all args became passthrough

Fixes #475

v1.5.0

Toggle v1.5.0's commit message
feat: add old "passthrough" behaviour back in as an option

`passthrough:""` or `passthrough:"all"` (the default) will pass through
all further arguments including unrecognised flags.

`passthrough:"partial"` will validate flags up until the `--` or the
first positional argument, then pass through all subsequent flags and
arguments.
0