-
Notifications
You must be signed in to change notification settings - Fork 114
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
Added ability to include directories as an extension of the config file #421
Merged
Merged
Changes from 9 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
2e0e9ba
Add the ability to have the config file in $XDG_CONFIG_HOME/topgrade/…
PolpOnline 3842ab6
Added ability to include directories as an extension of the config file
PolpOnline e8a77e2
Removed useless dependency "serde_json"
PolpOnline a02cdd2
Merge branch 'topgrade-rs:master' into master
PolpOnline 7f2a57c
fmt
PolpOnline a3c7b64
Merge remote-tracking branch 'origin/master'
PolpOnline e895bbb
Implemented merge strategy for the Commands type
PolpOnline aaf71f7
Merge branch 'master' into master
PolpOnline 5b387b5
Do not stop loading included files if these are invalid/can't be load…
PolpOnline daae5d9
Merge branch 'master' into master
PolpOnline 84ab841
Process includes in the order they are declared. Move all global scop…
PolpOnline 8753736
remove unused import
PolpOnline afe9e9b
Auto-migrate configs without [misc]
PolpOnline ab6987a
Merge branch 'master' into master
PolpOnline 07d3919
Update config.example.toml to reflect changes made to the code
PolpOnline ef33500
Merge remote-tracking branch 'origin/master'
PolpOnline 33d1fc6
Read all files in $CONFIG_DIR/topgrade/topgrade.d/ as part of the con…
PolpOnline b514dfd
Merge branch 'master' into master
s34m 2c45801
Refactor PR code, fmt
PolpOnline c232541
Merge branch 'master' into master
PolpOnline File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your interest in this issue.
This part caught my attention. If consistency with other tools is important, it might be good to look at how other tools handle this. It's my understanding that Git, Vim, Bash, and others don't have the main configuration file take precedence. Instead, settings at the bottom of those configuration files take precedence over settings at the tops of those files, and included files are treated as though their contents are inlined.
For example, with the following setup, the effective email address would be included@example.com:
However, if the include is moved up, the effective email address would be main@example.com:
As far as I know, the same principle is true for Bash, Vim, and others. Settings at the bottom override settings at the top, and included files are treated as if their contents exist at the location of the include.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't be done, not without a breaking change in the way the misc config entries are handled.
This is because as of now these entries are handled in the global scope, and adding an
[include]
section in between these breaks the following ones, because there is currently no way to specify a return to global scope in TOML files.The simplest way to fix this is to add a section named
[misc]
and move all the currently-in-global-scope entries to it.The problem with this approach is that it breaks all the previously-created config files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DottoDev since you are the maintainer of this repository, I'm asking you to tell me how to proceed.
If we are going to migrate all currently-in-global-scope entries to the new
[misc]
section, I'm available to adapttopgrade
to auto migrate the config file.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If config files can be auto migrated it would be a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just pushed a commit to resolve this. I've already tested it myself, but you might want to check it out too @openjck.