This is a breaking change, but the previous behaviour was broken so I'm
not concerned.
Also made most programmer errors more useful by giving type.field
context information.
Fixes#179.
This new tag tells the parser to stop processing flags after the
positional argument is encountered.
This is particularly useful for subcommands that forward their arguments
to an external program, and makes it possible to implement commands
like `kubectl exec` or `docker run`.
Fixes#80.
Fixes a panic when attempting to make use of pointers to types that
implement encoding.BinaryUnmarshaler. e.g.:
type SomeBinaryFlag struct{}
func (f *SomeBinaryFlag) UnmarshalBinary(data []byte) error {
// ...
return nil
}
var cli struct {
Binary *SomeBinaryFlag
}
Will automatically set a boolean Struct field to false if the flag starts with `--no-`, even when the default is `true`.
For example:
```
type Cmd struct {
Output bool `default:"true"`
}
```
Calling
```
command
```
Will set `Output` to `true`, but
```
command --no-output
```
Will set `Output` to `false`.
Add kong.ShortUsageOnError() option similar to kong.UsageOnError().
Add tests for UsageOnError and ShortUsageOnError.
Remove the HelpOption summary reset at the beginning of DefaultHelpPrinter:
func DefaultHelpPrinter(options HelpOptions, ctx *Context) error {
- if ctx.Empty() {
- options.Summary = false
- }
⚠️ I'm not really sure what the implications of this are, tests still
seem to pass, but maybe this has unintended side effects.
This was breaking UsageOnMissing() when combined with validation of
positional arguments, in that it was allowing positional arguments to be
omitted. It also broke UsageOnMissing() somehow so that it did not work.
Refactors usageOnMissing option to not run parent commands after
printing usage when a child node is missing.
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>