Configurable sources (and source hierarchy) #62
Merged
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.
It appears a few people want support for configurable sources. As I mentioned in my previously closed pr I was thinking of doing so, I believe this is a more proper solution than my last pr but this is still my first time writing rust so I would review my additions if you're interested in this feature.
Configuration Hierarchy
The
config.toml
source lists take precedence over~/.local/share/flavours/base16/sources.yaml
and~/.local/share/flavours/base16/sources.yaml
takes precedence over the default source lists.Configuration Schema
The
config.toml
now supports configuring source lists and extra sources.schemes
: is a string of the link to a repo of a list of schemes of this formattemplates
: is a string of the link to a repo of a list of templates of this formatextra_scheme
: is a vector of extra schemes. Each extra scheme is added to the appropriatelist.yaml
, maintaining sorted order.extra_template
: is a vector of extra templates. Each extra scheme is added to the appropriatelist.yaml
, maintaining sorted order.Extra Schemes and Templates
In the case where a user would like to configure schemes and templates that are not included in their active source lists they may provide extra schemes and templates that will be inserted into the appropriate
list.yaml
file. TheConfig
struct fieldsextra_scheme
andextra_template
are vectors of the following extra source structure.name
: is a string of the name of the scheme or template, the key to the sources in thelist.yaml
files.source
: is a string of a link to a base16 scheme or template repo of the respective linked format. The source appears as the value to the source name in thelist.yaml
files.Example
I've attached a simple
config.toml
that shows the new features with some snippets of the resulting files after runningflavours update all
.Here I'm choosing to use a non-default scheme list, the default template list, and an extra scheme that's not included in the scheme list I've configured.
You can see that the configured source list was written as expected.
This is a snippet of the schemes list yaml file. Just shows that the extra scheme (tarko) made it's way into the list of schemes.
Notes
I haven't really tested this much, I plan on using this fork of flavours, I'll report/fix bugs I run into. I have zero rust experience, so I would review my changes closely if this is a feature you would like to implement.