Macchina-CLI / macchina

A system information frontend with an emphasis on performance.
https://crates.io/crates/macchina
MIT License
1.49k stars 52 forks source link

Show parsing errors and switch error handling to anyhow crate. #208

Closed uttarayan21 closed 2 years ago

uttarayan21 commented 3 years ago

Show errors while parsing the theme files.

Screenshot from 2021-11-07 20-10-20

uttarayan21 commented 3 years ago

Need to merge after #193 is merged to v6

grtcdr commented 3 years ago

Very nice!!

Although the formatting could be better, maybe play around with it and print something cool looking, in the sense that, "you broke macchina", but the error output is clean.

grtcdr commented 3 years ago

Should I review it?

uttarayan21 commented 3 years ago

Not yet I need to make some major changes to make it pretty-print the errors, I think.

grtcdr commented 3 years ago

Ah, okay :)

I'm working on rewriting some stuff on the Linux side; mostly experimenting with some optimizations.

(I've also brought back the flag that allows switching between logical/physical cores, which I removed, for some reason)

And some of the other optimizations broke aarch64 linux.

And I'm proud to say I've started tackling the Window Manager readout reimplementation (with the winman module), it's only a Wayland (and Sway to be specific) thing for now.

uttarayan21 commented 3 years ago

I'll be busy with work this week I'll try to complete the changes on the weekend.

If you complete your changes you can push it ot v6 and I'll rebase this branch.

grtcdr commented 3 years ago

Hey, any progress?

uttarayan21 commented 3 years ago

Sorry didn't really have time this weekend. I'll try to complete it after work today or tomorrow.

Nov 15, 2021 7:16:57 PM Aziz Ben Ali @.***>:

Hey, any progress?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub[https://github.com/Macchina-CLI/macchina/pull/208#issuecomment-968926037], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AEO5NHEQTLOTGRC3VXWU4F3UMEFMTANCNFSM5HQ4NVYA]. [data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAABCCAYAAADjVADoAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAaCSURBVHic7Zu7bhtHFIa/sysgkhvzDcIUKeMwT2AabkLGjOkmKS2XqUS1SYDIRWpTVUrJZdKIDm3SRQBTTxAJLlOYegOpiWjAuyfFji7kzu7MUrw4AH/AhrCz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github.com/notifications/beacon/AEO5NHCJHZRG5B3AJPK2BO3UMEFMTA5CNFSM5HQ4NVYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHHAKGVI.gif]

grtcdr commented 3 years ago

Take your time ;) I was just asking to get an idea of how things are going for v6, I've also halted my work as of this week because there's too much going on for me to focus on writing quality code.

uttarayan21 commented 3 years ago

Yeah same for me been a busy week. Didn't really feel like working with rust after working the whole week with it.

-- Uttarayan Mondal

grtcdr commented 3 years ago

Yeah, don't burn yourself out :)

grtcdr commented 3 years ago

Not sure if we can customize anyhow's error reports, there's a crate called eyre which allows for this customization, but it hasn't been updated in over 4 months.

Edit: the maintainer is still active, though.

uttarayan21 commented 3 years ago

Yeah I figured that. I have local changes removing anyhow and using thiserror crate and making a new error type containing all possible errors emitted by macchina.

Nov 19, 2021 10:15:57 PM Aziz Ben Ali @.***>:

Not sure if we can customize anyhow's error reports, there's a crate called eyre[https://github.com/yaahc/eyre] which allows for this customization, but it hasn't been updated in over 4 months.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub[https://github.com/Macchina-CLI/macchina/pull/208#issuecomment-974232756], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AEO5NHA6M2VPXPERRQCTKW3UMZ5LZANCNFSM5HQ4NVYA]. [data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAABCCAYAAADjVADoAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAaCSURBVHic7Zu7bhtHFIa/sysgkhvzDcIUKeMwT2AabkLGjOkmKS2XqUS1SYDIRWpTVUrJZdKIDm3SRQBTTxAJLlOYegOpiWjAuyfFji7kzu7MUrw4AH/AhrCzM3P237PnNoewwgrXIcvaWF/VK0h4e/xidCbf9I6WIc/aMjYFIAjbwN2xaxIeAtWliLOMTT9GrIgwWBFhsCLCYOFeQ3uNuwRSQbUFlCeGh4i0ifVI6t3DRco1dyK03ywj0RZIFdVKockiR6ADNNyV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+P4MnS/JMJYz5Sx1F6jhTDuTZSSHjRLjhzA7jWUnxB+ypkHqj9npEG5QVwSZ0SWAdpS79pDcAP3pyFq9xCfRPkeZhR2krOLFO4Q86t56+NQbhHzK8gX6Wl6lqyZgyyZsp7hGpxEZOcTmktEoi1B1lu4g/I7MT+g3Ee5b/7+HbiTIWrbnYXaZfKpVPkaS5vhS6v9JEZB2zr3CnWUFkoLu0242n+USapLJi8D65t02Rgtu2J4edQ5ZRRWMz4RT+gZo7Dq0gbtNZrYgia77Cn4ESFrGW9DfnFOfdQ5ZbRWZjrXd8xorexVpRIyzjqyZB+HFxGmwmNzrVWfzO5KM+Spn3boGchTH02Ay+zSJseh7/lGkZrlPlYfLXvAZ67J5oF29KDZNlnkhSpfxBrHJL6+w2itU6R4m1ld96xXQuFzjYxq8RyP+FzIOQI8llrXOzcpGGJnVKxFtky5f6FIWhIyzkHRQi+mEBHGH7/IGN5bJBmO0/jnRU/hp0i6wlaOwVsIGY6jvjMIndX1SRQmQmqdIXGcFxvs6etG4UNYX5i1s0mI4+o0fVXzbBQZgj6ZcaOIq1tvsY0iF/BsHRogtOXrbpZtyd/jdeOhCcFd8cpyWocukJChbY9uuCFCBxhwHh7mNpNtRHeBqmlVdBww6xlIa6nNZJeivKpXCIJB4dZAZTI9Ltila2zCx9BeeAFzUNzGVoyZD55DuPNRNZxehzFqbWxV7NngGLT10bYgT8IY0k3c/ZG+OAT259WZs5ifKeiHFiJVimvJMaoDZK39v/2ZQha0/6CKSgWhRTqBO0FpI3o0a9V3YXm/+7R3uHh14MwDq5MugxURBisiDFZEGCzvt+Fx1Lren5BciwvUKVdYYZ74D42XwuyLSXcAAAAAAElFTkSuQmCC###24x24:true###][Tracking image][https://github.com/notifications/beacon/AEO5NHETLTDK2FE7LI7WCILUMZ5LZA5CNFSM5HQ4NVYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHIIZZNA.gif]

uttarayan21 commented 3 years ago

So digging into the serde source code here https://docs.rs/serde/1.0.130/src/serde/de/mod.rs.html#282-284 it seems that the `hide_delimiters` for key `bar` at line 36 column 1 part of the error is a &'static str. So how should I proceed ?

Making string operations on it doesn't really seem like good idea.

grtcdr commented 3 years ago

So digging into the serde source code here https://docs.rs/serde/1.0.130/src/serde/de/mod.rs.html#282-284 it seems that the `hide_delimiters` for key `bar` at line 36 column 1 part of the error is a &'static str. So how should I proceed ?

I'm not sure what's happening, can I get some more context around the problem?

uttarayan21 commented 3 years ago

I meant that I can't modify any of the output of the mentioned line. But I can change other stuff.

Can you give a example of exactly what you want to show in the errors ?

grtcdr commented 3 years ago

Can you give a example of exactly what you want to show in the errors ?

Nothing specific, really. Just a different kind of formatting (or colors).

grtcdr commented 2 years ago

I've tested your recent commit, and it seems like we're set!

Shall I merge?

uttarayan21 commented 2 years ago

Yeah sure. IIRC it is done you can customize the output if you want, it is mostly inside main.

Edit: I'll make some changes to fix the new config functions.

grtcdr commented 2 years ago

Before merging, we've got a report that config detection is failing again on macOS, just thought I'd let you know in case you have an idea why this might be occurring.

I got no clue why, I don't even think we modified any of v5's config logic.

uttarayan21 commented 2 years ago

I looked through the source I have no clue as to what might have caused this. I also don't have a MacOS vm in which I might test on currently.

Also I modified the logic a little bit in this pr. I made it so that the config is opened and read directly by std::fs::read instead of opening using std::fs::File then reading to a buffer. It makes the login a bit cleaner but that's only for read_config.

grtcdr commented 2 years ago

I also don't have a MacOS vm in which I might test on currently.

Neither do I, but I made some refactoring work to simplify (or make the bug apparent), not sure if that'll get it fixed.