Closed Softsun2 closed 1 year ago
I like it a lot! I was actually thinking of a way to allow users to include non-listed schemes or templates (without forking the sources), and I think you pretty much nailed it with a great design.
Code seems fine. I'm terribly sorry about the spaghetti code, it was my first real rust program. I should refactor it sometime (tm).
I will merge it as soon as I test it. Thanks a lot!
Seems to work nicely!
Something I think might be useful is setting the URLs to an empty string could perhaps skip cloning and write an empty list (for people who prefer to not use any list). I will see if I can implement this in a follow up commit.
Thanks again!
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.