Alec Thomas
c494f8b8f3
Support required combined with xor groups.
...
Fixes #112 .
2021-06-21 19:25:54 +09:30
Alec Thomas
54558f65e8
Allow multiple xor:"" groups to be defined.
...
Fixes #113 .
2021-06-21 19:04:54 +09:30
Alec Thomas
8aa52739ea
Don't fail on required positional arguments that have envars.
...
Fixes #153 .
Fixes #120 .
2021-06-21 17:13:39 +09:30
Evgeny
a8244400e3
DefaultEnvars option ( #177 )
2021-06-20 20:27:56 +10:00
Kartikaya Gupta
2d879d2037
Add an option to clamp the help wrap width
...
This is nice to have because on really wide screens the default
terminal-width wrapping can be a little unpleasant to read.
2021-06-16 23:06:43 +10:00
Alec Thomas
33ce628ecd
Hermitise CI.
2021-06-09 13:13:50 +10:00
Alec Thomas
8cbf5a6c03
Validate short flags are a single rune.
...
Fixes #175 .
2021-06-09 13:11:49 +10:00
Alec Thomas
ff93d67a8d
Validate duplicate short flags.
...
Fixes #174 .
2021-06-09 13:01:16 +10:00
Alec Thomas
6cebaa7b85
Hermitise and bump golangci-lint.
2021-06-09 12:48:47 +10:00
Alec Thomas
c4a8cb03a7
Update docs.
2021-06-07 08:56:11 +10:00
Mary Fesenko
1f5bbd5559
Fix issue with negatable flag being negated twice ( #171 )
2021-05-22 21:50:50 +10:00
andrewbaxter
b3bdeb18e2
Fixes #125 : Support custom per-mapper placeholder text ( #169 )
2021-05-17 21:31:07 +10:00
Toshimaru
9c81441ae0
Update go modules ( #165 )
2021-05-03 14:16:08 +10:00
Alec Thomas
2e611623a7
Don't display placeholder for counters.
...
Fixes #164 .
2021-04-18 10:05:26 +10:00
Fabian Gutierrez
8d859b918f
Add some details to the ignore field example
2021-04-15 06:28:14 +10:00
Rene Zbinden
5fd7249c69
fix panic resolver's configuration file does not have read permission
2021-04-14 19:39:32 +10:00
Franklin "Snaipe" Mathieu
d4dd709445
tag: add passthrough for positional arguments
...
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 .
2021-04-06 07:53:16 +10:00
Alec Thomas
49417fe966
Add support for dynamically registered commands.
2021-04-02 11:38:24 +11:00
Saj Goonatilleke
57bfb058d5
mapper: correct text/binary typo
...
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
}
2021-03-18 06:11:20 +11:00
Alec Thomas
0c83d0f8dc
Lint fix.
2021-03-13 21:13:23 +11:00
Alec Thomas
93f73cf38c
Display multiple optional args in a more expected way.
...
Previously:
Usage: command [<one>] [<two>]
Now:
Usage: command [<one> [<two>]]
Thanks to @juliaogris for the inspiration!
2021-03-13 20:30:28 +11:00
Dustin Spicuzza
09467435e1
Add option to not expand subcommand help
2021-03-13 16:41:08 +11:00
Andrew Haines
456575db97
Allow - for stdout in path mapper ( #147 )
2021-03-02 16:26:10 +11:00
Joe Schmitt
d48f4e59c3
Add negatable output when using short flag names
2021-03-02 10:36:13 +11:00
Joe Schmitt
ed24960916
Implement code review feedback
2021-03-02 10:36:13 +11:00
Joe Schmitt
454f2c067e
Add test case for inverting the negation
...
Not sure why anyone would do this, but it's covered now.
2021-03-02 10:36:13 +11:00
Joe Schmitt
2fdddc4f51
Add negatable tag to set a bool to be negatable.
...
If negatable, add `--[no-]` prefix to help.
2021-03-02 10:36:13 +11:00
Joe Schmitt
2a0d7af9c5
Add support for negated boolean flags
...
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`.
2021-03-02 10:36:13 +11:00
Alec Thomas
541ee3302f
Create FUNDING.yml
2021-03-01 16:59:26 +11:00
Julia Ogris
1300b2a3bd
options: Add kong.ShortUsageOnError() option
...
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.
2021-02-16 16:25:07 +11:00
Joe Schmitt
f306ae1529
Add aliases to tree help output
2021-02-13 06:37:48 +11:00
Jaco Coetzee
405b2f4fd9
Help Option to position flags in help output
...
When FlagsLast is set to true, flags are printed after commands.
- Added HelpOptions.FlagsLast bool
- Added test TestFlagsLast
2021-02-09 19:25:17 +11:00
Alec Thomas
abbc2dfc2c
More group formatting tweaks.
2021-02-09 15:23:05 +11:00
Alec Thomas
294d1d1717
Add a bit of extra spacing if group description is provided.
...
See #135 .
2021-02-09 15:17:29 +11:00
Alec Thomas
7e27c8ecf5
Support a simplified kong.Groups{<key>: <title>} way of specifiying groups.
...
See #135 .
2021-02-09 15:08:22 +11:00
Mickaël Menu
b68e1aba63
Add support for groups in the default HelpPrinter ( #135 )
2021-02-09 06:58:43 +11:00
Joe Schmitt
2479d83cc0
Add support for command aliases ( #130 )
2021-01-11 07:36:13 +11:00
Alec Thomas
d78d607800
Fully describe how help is generated.
...
See #29 .
2020-12-06 14:59:38 +11:00
Alec Thomas
3d57e73d11
Ensure values aren't nil before decoding.
2020-12-04 16:20:06 +11:00
Sarah Franc
5a9b3ae012
Fix return err for PrintUsage
2020-11-12 11:32:37 +11:00
Alec Thomas
26524e0cc1
Actually test filename.
2020-10-30 15:36:16 +11:00
Alec Thomas
8bf0a335db
Add NamedFileContentFlag.
2020-10-30 15:26:38 +11:00
Alec Thomas
097bba54ec
Revert UsageOnMissing.
...
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.
2020-10-27 17:33:46 +11:00
Alec Thomas
73064c7b8f
Fix README again.
2020-10-21 20:26:16 +11:00
Alec Thomas
74d8f6d21b
Unbreak README.
2020-10-21 19:38:05 +11:00
Alec Thomas
38db823367
Call Validate() functions on nodes if present.
2020-10-21 19:14:31 +11:00
hasheddan
a062611ecf
Do not run parent node on missing child err with usageOnMissing option
...
Refactors usageOnMissing option to not run parent commands after
printing usage when a child node is missing.
Signed-off-by: hasheddan <georgedanielmangum@gmail.com >
2020-10-20 09:44:46 +11:00
Sven Nebel
5b3fd5476a
Refactor k.FatalIfErrorf to use k.Fatalf
2020-10-11 07:44:14 +11:00
hasheddan
5cf89d77b1
Fix minor typo in README
...
Corrects mapperss to mappers.
Signed-off-by: hasheddan <georgedanielmangum@gmail.com >
2020-10-08 12:29:02 +11:00
Alec Thomas
259d19076d
Add support for plugins.
2020-09-16 16:41:18 +10:00