Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent definition of options and their defaults #339

Merged
merged 18 commits into from
Jul 27, 2021
Merged

Conversation

krlmlr
Copy link
Member

@krlmlr krlmlr commented Jul 24, 2021

Ideas borrowed from renv, CC @kevinushey.

Bundles all options under ?pillar_options.

This proposal uses a tiny bit of metaprogramming. It allows accessing options via pillar_options$bold() and setting them via pillar_options$bold(value) . Local options are supported too. In addition, there are internal accessors of the form get_pillar_option_bold(), set_pillar_option_bold() and local_pillar_option_bold().

The infastructure file aaa-options.R is package-agnostic, the options.R file contains only a little boilerplate code and the definition of the option getters; to use e.g. in tibble I'd replace pillar with tibble in the file and tweak the tibble_options object.

Tests were created and edited using the multi-cursor feature of RStudio.

@krlmlr krlmlr merged commit f5f4852 into master Jul 27, 2021
@krlmlr krlmlr deleted the docs-options branch July 27, 2021 02:05
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant