Releases: andreimerlescu/figtree
v2.1.1
What's Changed
- Feature/viper comparison by @andreimerlescu in #20
- Added idempotent guard to New* methods by @andreimerlescu in #21
Full Changelog: v2.1.0...v2.1.1
v2.1.0
What's Changed
- Fix type errors, comment accuracy, test hygiene, and harvest normalization by @andreimerlescu in #19
v2.0.15
New Features
-
Alias Support — Register alternate flag names for any fig using
figs.WithAlias(name, alias). Aliases are fully integrated with validators,
callbacks, rules, getters, and setters — anything that works on the canonical
name works identically on the alias.figs := figtree.Grow() figs.NewString("verbose", "false", "enable verbose output") figs.WithAlias("verbose", "v") figs.Parse() // accepts both -verbose and -v figs.StoreString("v", "true") // store via alias *figs.String("verbose") // "true" — canonical reflects alias store *figs.String("v") // "true" — alias reflects alias store
-
WithValidators()— Register multiple validators against a fig in a
single call instead of chaining repeatedWithValidator()calls.figs.WithValidators("host", figtree.AssureStringNotEmpty, figtree.AssureStringHasPrefix("https://"), figtree.AssureStringLengthLessThan(253), )
-
Problems()— Inspect non-fatal registration errors accumulated during
tree construction (e.g. duplicate aliases, missing fig names). Available on
theDivineinterface without requiring a type assertion.if problems := figs.Problems(); len(problems) > 0 { for _, p := range problems { log.Println("figtree:", p) } }
Bug Fixes
-
AssureBoolTrue/AssureBoolFalse— Both previously returned
ErrInvalidType{tString, value}on non-bool input. Fixed to correctly return
ErrInvalidType{tBool, value}. -
AssureListMinLength— Error message previously said"list is empty"
even when the list was non-empty but shorter than the required minimum. Now
correctly reports the required minimum and the actual length. -
StoreMapwith=-containing values — Map values containing=
characters (e.g. URLs with query strings) were silently truncated during
persistence. Fixed by usingSplitN(..., 2)to preserve the full value. -
Recall()channel capacity —With()computed a normalized buffer size
(chBuf) for the initial mutations channel but stored the rawopts.Harvest
intree.harvest. SinceRecall()usestree.harvestto size the new
channel, a zero or negativeHarvestwould silently create an unbuffered
channel after aCurse()/Recall()cycle. Fixed by storing the normalized
value. -
Deadlock in
Store()—Store()heldtree.muwhile sending on
mutationsCh. If the channel buffer was full, the send would block
indefinitely, stalling all concurrent tree operations. Fixed by releasing
tree.mubefore the channel send and re-acquiring after. -
MutagenesisOfFig()— Was acquiring an exclusive write lock (Lock())
for a read-only operation. Changed toRLock()/RUnlock().
Test Coverage
- 317 tests passing across all platforms (Ubuntu, macOS, Windows) on Go 1.23
and 1.24. - New tests covering alias idempotency, alias conflict detection, validator
registration via alias, storing through an alias, concurrent pollinate reads
under alias resolution,Recall()channel capacity afterCurse(), and
map values containing separator characters.
Full Changelog: v2.0.14...v2.1.0
v2.0.14
What's Changed
- Updated error handling and value assignment tests by @andreimerlescu in #14
Full Changelog: v2.0.13...v2.0.14
v2.0.13
What's Changed
- Adjusted error handling and moved flag.Var to tree.flagSet.Var by @andreimerlescu in #12
Full Changelog: v2.0.12...v2.0.13
v2.0.12
What's Changed
- Removed duplicate entries for WithAlias from UsageString by @andreimerlescu in #11
Full Changelog: v2.0.11...v2.0.12
v2.0.11
What's Changed
- Added WithAlias to Figtree by @andreimerlescu in #10
Full Changelog: v2.0.10...v2.0.11
v2.0.10
What's Changed
- Activated the Usage func in the flag package on the tree by @andreimerlescu in #9
Full Changelog: v2.0.9...v2.0.10
v2.0.9
v2.0.8
What's Changed
- Implemented PolicyMapAppend and added tests for PolicyFlagAppend by @andreimerlescu in #7
Full Changelog: v2.0.7...v2.0.8
v2.0.7
What's Changed
- Fixed issue with lists by adding a policy by @andreimerlescu in #6
Full Changelog: v2.0.6...v2.0.7