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

info fails to parse non-existent scheme #47

Open
pcgjerde opened this issue Feb 22, 2022 · 2 comments
Open

info fails to parse non-existent scheme #47

pcgjerde opened this issue Feb 22, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@pcgjerde
Copy link

Hi,

I recently started getting an error when trying to run flavours info. After listing a few schemes it gives the following error:

Error: Couldn't parse scheme toast. Check if it's syntatically correct.

Caused by:
    missing field `scheme` at line 1 column 6

This seems especially odd to me since as far as I can tell there is no theme named 'toast' in Base16, and the next theme alphabetically should be "classic". have tried deleting ~/.local/share/flavours and running flavours update all, but I still get the same error.

I am still able to use the other subcommands as expected.

@Misterio77 Misterio77 self-assigned this Feb 22, 2022
@Misterio77 Misterio77 added the bug Something isn't working label Feb 22, 2022
@Misterio77
Copy link
Owner

Hey, thanks for reporting this!

It seems base16-circus introduced a CI file (named toast.yml): https://github.com/stepchowfun/base16-circus-scheme... Sigh

Flavours can't possibly know this is not supposed to be parsed as a scheme (as we currently consider anything *.y{a,}ml to be one).

I really dislike base16's fragmentation and impossibility of tracking changes. I mean, why would a scheme possibly need CI?

Well, as to your issue. You can either delete schemes/circus/toast.yml, or remove base16-circus from sources/schemes/list.yaml. I'll probably have to hardcode this to be deleted when update is ran.

@pcgjerde
Copy link
Author

Thanks, deleting that file fixed the problem.
I think it would be a good idea to let info.rs fail gracefully if it finds an invalid scheme file. This is a really gross hack, but something like this on line 80 in info.rs would allow you to skip over invalid scheme files and preserve an error message:

let scheme;
match Scheme::from_str(&scheme_contents, scheme_slug) {
            Ok(t) => scheme = t,
            Err(e) => {
                eprintln!("Error: {}", e);
                eprintln!();
                eprintln!("Caused by:");
                e.chain().skip(1).for_each(|cause| eprintln!("    {}", cause));
                continue;
            }
        };

There's probably a better way to do this, but it does build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants