-
-
Notifications
You must be signed in to change notification settings - Fork 236
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
Add coloring to repo names and version diff #1292
base: master
Are you sure you want to change the base?
Conversation
4f497a4
to
166beed
Compare
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'm not 100% sure on this. It's a lot of code (though i think can be shrunk down considerably).
The main issue is paru's goal is to look like pacman and this breaks away from that. It's not too outlandish like the upgrade menu and other yay formatting so I''m just unsure at the moment.
Maybe if for the diffs we used the gray pacman does when printing versions it would fit in more.
@@ -114,15 +114,11 @@ pub fn color_repo(enabled: bool, name: &str) -> String { | |||
return name.to_string(); | |||
} | |||
|
|||
let mut col: u32 = 5; |
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 was a small hash function. Meaning colours should be different for similar strings. As there's only 6 possibilities we're bound to get conflicts.
Maybe we can adjust it to avoid this known conflict but just using the length would be a big no.
@@ -443,13 +439,38 @@ pub fn print_install_verbose(config: &Config, actions: &Actions, devel: &HashSet | |||
}); | |||
|
|||
for pkg in &install { | |||
println!( |
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 println is going to overpad by the amount of characters we added by colouring. Can't we just do package_len -= pkg_str.len() - pkg.pkg.db().unwrap().name().len() - pkg.pkg.name().len() - 1
to calculate the difference like you have but keep using the {:<package_len$}
and similar formatters instead of repeating strings.
closes #1291
I have also the cachyOS repositories installed
and the colors are too often the same.
Therefore, I changed to use the repo name length, which appears to be different for each repo.
I had to add some code to calculate the length without the ANSI, so the padding would still be working as intended.
wait aur is missing