forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support adding to dict-valued options in config files. (pantsbuild#16481
) Previously you could use the "+" prefix on a stringified dict to add to the value across different sources (flag, env var, config, default), but this did not work across multiple config files. Instead, the last config file would stomp the values in previous ones. This change: - Adds support for "+" across config files. - Also supports using the ".add" affordance, similar to list-valued options, so that the value can be a toml map instead of a stringified python dict. Note that, unlike with lists, "add" could actually be a valid dict key, in which case we will do the wrong thing. In that case, the escape hatch is to use "+" with a stringified value. - Ensures that the above works for `cli.alias`, which we special-case in the options bootstrapper. - Streamlines some of the config machinery. In particular, simplifies how we do interpolation. Instead of interpolating individual values in lists and then manually stringifying them, we interpolate after stringification. This is safe in practice, as for `%(name)s` to span two list items, `name` would have to contain forbidden characters like a quote or double-quote. - As a byproduct of the above, adds support for interpolation inside dicts, following the same post-stringification principle. Fixes pantsbuild#15922 [ci skip-rust] [ci skip-build-wheels]
- Loading branch information
Showing
7 changed files
with
225 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.