Mitar
88dcc90dde
Document nested data structure.
2021-12-25 07:49:21 +11:00
Alec Thomas
7533b11d06
Differentiate between omitted and empty default.
...
Fixes #250 .
2021-12-13 19:03:23 +11:00
Alec Thomas
9c9b8ab50b
More enum fixes.
2021-12-13 18:54:06 +11:00
Alec Thomas
fa08e7027c
fix: overly enthusiastic validation of tags
2021-12-13 16:48:21 +11:00
Mitar
ece1f6d8cb
Allow more flexible callback return error type.
2021-12-13 12:00:13 +11:00
Mitar
deebf0b09b
Do not add environment variable to help it is already present.
...
Fixes #246 .
2021-12-05 06:23:18 +11:00
Alec Thomas
32b2f740c9
Support $$ for escaping $ in interpolated values.
...
Fixes #248
2021-12-04 21:06:33 +11:00
Alec Thomas
c5e464a367
Deprecate HelpFormatter.
2021-12-03 11:48:54 +11:00
Mitar
c3703cda7e
Fix that default should not override the placeholder.
...
Fixes #243 .
2021-12-02 23:06:44 +11:00
Alec Thomas
d564bd286f
Add test for #244 .
2021-12-02 12:59:34 +11:00
Alec Thomas
342263cb51
Fix docs re. Help() interface.
...
Fixes #241 .
2021-11-30 21:39:35 +11:00
Colin
ff839dc6db
Fix env var interpolation ( #236 )
2021-11-24 13:57:08 +11:00
Nate Parsons
f00d33b57c
Use reflect-compatible struct tags in examples
2021-11-23 15:19:08 +11:00
Colin
79f896f0c0
feat: add support for variable interpolation into env tag key ( #234 )
2021-11-19 08:56:39 +11:00
Connor Hindley
5090305bcb
Add help testcase for envprefix + no env.
2021-11-19 06:22:36 +11:00
Connor Hindley
ea18c73f11
Only prepend EnvPrefix if .Env is not empty.
...
Before this change the EnvPrefix was applied to fields without env
specified, which resulted in strange and confusing help output.
2021-11-19 06:22:36 +11:00
Dan
2770a34ce6
Add envprefix tag
2021-10-22 16:25:13 +11:00
Grant Monroe
749d3f0752
Allow root application to have a Run(...) error method.
...
Issue #209
2021-10-15 15:47:17 +11:00
Alec Thomas
5c7b038540
Rename IgnoreFieldsRegex -> IgnoreFields.
2021-09-27 16:31:54 +10:00
Alec Thomas
1d48b6f720
Allow Mappers to contribute Vars to interpolation.
...
See #218 .
2021-09-27 16:07:48 +10:00
Dilip Somavarapu
dd18549686
Update Help.go to make Sub Commands can be Hidden ( #207 )
2021-09-17 08:21:21 +10:00
Radon Rosborough
bf5e5e843d
[ #88 ] Use reflect-compatible struct tags in examples ( #202 )
...
=
2021-09-15 16:41:30 +10:00
Stan Rozenraukh
74cb5130e3
Adds Context.BindToProvider ( #201 )
2021-08-31 06:47:02 +10:00
Alec Thomas
d0c0180cec
Hydrate pointers to embedded structs.
2021-08-28 16:54:55 +10:00
Daniel Selans
07faa2e0d0
Add ability to ignore fields that match given regex pattern(s) ( #199 )
2021-08-28 15:41:08 +10:00
Alec Thomas
dd904ce961
Upgrade golangci-lint.
2021-08-27 20:58:22 +10:00
Alec Thomas
43616c6a6d
Hydrate sub-commands that are pointers.
...
Fixes #196 .
2021-08-27 20:57:38 +10:00
Yunchi Luo
b5bcf3579b
Support duration as nanosecond number when using a resolver
...
Duration is always marshaled as a nanosecond number when using JSON. Kong would only parse it as a string using ParseDuration. Now it can use the number version too.
2021-08-27 04:31:39 +10:00
Simon Frei
5a9c9c7864
Bubble errors instead of panicking ( #194 )
2021-08-19 18:00:53 +10:00
Nikita Semikov
f547618963
Add aliases to ALL help output ( #191 )
2021-08-07 22:04:51 +10:00
Alec Thomas
676890f22f
Switch to GHA.
2021-08-01 14:45:09 +10:00
Alec Thomas
d1a818b5a1
Allow DynamicCommand to specify arbitrary tags.
...
Fixes #185 .
2021-07-13 13:55:01 +10:00
Cam Hutchison
89315e74ad
Allow default commands with cmds/args/flags ( #188 )
...
* Move default command validation to build
Move the validation of default commands - checking if a node has
multiple default commands or a default command has children - to the
build phase rather than tracing. These errors are with the structure of
the CLI ast and are detectable before parsing the command line.
Add a couple of tests for some of the default command error cases.
* Disallow positional args on a default command
Do not allow a default command to have positional arguments. The current
check is only for branching args, but the error message implies that
positional args are not allowed either. So add a check for positional
args too, and add a test case for it.
This is breaking change to the API but is unlikely to have ill-effect as
positional args on a default command cannot be used without explicitly
naming the command (i.e. not using it as a default).
* Allow default commands with cmds/args/flags
Allow default commands to have sub-commands, args and flags when tagged
with `default:"withargs"`. This makes specifying the name of the
command on the CLI completely optional as long as the args to that
command are not ambiguous with other commands.
2021-07-12 14:19:37 +10:00
Alec Thomas
cfbe844aa4
Fix xor + required combo.
...
See #112 .
2021-07-11 21:23:18 +10:00
Evgeny
8b2821cc24
Added sub objects support in JSON resolver ( #178 )
2021-06-21 21:08:43 +10:00
Alec Thomas
247574041d
Enum fields must be required or have a default.
...
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 .
2021-06-21 20:35:41 +09:30
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