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

Add a method to trigger reading of all config files #862

Closed

Conversation

VolkerChristian
Copy link
Contributor

This pull request did not change the behavior of application code if the newly introduced method
App *all_config_files(bool all = true) is not used.

  • Add a method App *all_config_files(bool all = true) to trigger reading of all config files in reverse order so that the last read config file takes precedence.
  • This is at least interesting when subcommand aliases are used and the same option names exist in different configuration files for these different subcommand names. This allows a combined option set to be constructed from different subcommand names and configuration files.

…so that the last read config file takes precedence.

This is at least interesting when subcommand aliases are used and the same option names exist in different configuration files for these different subcommand names. This allows a combined option set to be constructed from different subcommand names.
@codecov
Copy link

codecov bot commented Mar 12, 2023

Codecov Report

Patch coverage: 90.00% and project coverage change: -0.05 ⚠️

Comparison is base (7403921) 99.45% compared to head (546b8ac) 99.41%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #862      +/-   ##
==========================================
- Coverage   99.45%   99.41%   -0.05%     
==========================================
  Files          18       18              
  Lines        4069     4088      +19     
==========================================
+ Hits         4047     4064      +17     
- Misses         22       24       +2     
Impacted Files Coverage Δ
include/CLI/App.hpp 100.00% <ø> (ø)
include/CLI/impl/App_inl.hpp 99.16% <90.00%> (-0.15%) ⬇️

... and 2 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@VolkerChristian
Copy link
Contributor Author

I made three pull requests today. Perhaps they will be accepted to be integrated into the main branch of CLI11.

I use a CLI11 patched like this heavily in SNode.C to manage the whole configuration system. The changes have proven to be stable and functional.

Please contact me in case you have questions about that pull requests.

Kind regards
Volker Christian

@phlptp
Copy link
Collaborator

phlptp commented Jun 22, 2023

Is the main purpose of this to allow reading of the config files in reverse order? If that is the case there probably is an argument to be made that that should be the proper way of doing it. In which case would the new method be necessary?

henryiii pushed a commit that referenced this pull request Sep 15, 2023
use it for the default in `set_config` and simplify and add more
flexibility to the the config processing, and potentially in other
options as well.

The reverse policy returns a vector but in reversed order from normal.
This is what we want in the config processing

Inspired by #862, and updated with recent code changes.

---------

Co-authored-by: Volker Christian <me@vchrist.at>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@phlptp
Copy link
Collaborator

phlptp commented Oct 6, 2023

Going to close this unless @VolkerChristian has some other comment

@phlptp phlptp closed this Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants