Commit Graph

12 Commits

Author SHA1 Message Date
Alec Thomas e75e1ca88a refactor: switch to alecthomas/assert 2022-06-21 20:58:10 +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 8cbf5a6c03 Validate short flags are a single rune.
Fixes #175.
2021-06-09 13:11:49 +10:00
Alec Thomas 6cebaa7b85 Hermitise and bump golangci-lint. 2021-06-09 12:48:47 +10:00
Joe Schmitt 2479d83cc0 Add support for command aliases (#130) 2021-01-11 07:36:13 +11:00
Alec Thomas 54338bd8b1 Add an "embed" tag. 2018-09-19 13:23:18 +10:00
Alec Thomas 2e29ff8981 Add support for setting variables via tag.
This provides much more convenient composition when reusing structs in
different parts of the command grammar.

eg.

	type Embedded struct {
		Key string `help:"A key from ${where}."`
	}

	var cli struct {
		Embedded `set:"where=somewhere"`
	}
2018-09-19 12:57:59 +10:00
Alec Thomas a2ec050947 Implement a robust Context.Run().
This helps when composing large applications from separate command
structs.
2018-06-21 21:50:30 +10:00
Alec Thomas e9d88d6528 Implement flag "resolvers". (#24)
* Propagate errors.
* Use junit test output.
* Expand role of DecodeContext to include Scanner.
* Inject resolved flags as Path elements in the Context.
  This allows all existing logic to apply seamlessly: hooks, required
flags, etc.
* Clarify that hooks can be called multiple times.
2018-06-12 07:20:55 +10:00
Alec Thomas 96fa9c43d5 Improved documentation and help. 2018-06-05 11:36:51 +10:00
Gerald Kaszuba 1426db8aa0 Added tag test for multiple separators. 2018-06-01 12:26:26 +10:00
Gerald Kaszuba ed123d1c06 Allow "bare" tags and moved tag tests into tag_test.go. Fixes #19 2018-06-01 12:26:26 +10:00