-
Notifications
You must be signed in to change notification settings - Fork 41
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 colors to tar check menu #163
Conversation
src/tar_check.rs
Outdated
if has_install { | ||
eprint!("{}", "[I]=show install file, ".bright_red().bold()); | ||
eprint!("{}, ", "[I]=show install file".bright_red().bold()); |
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.
Hey, here I'm somewhat unsure here. The install file itself could be dangerous, but showing the file is not a dangerous operation.
Should we change it to something like [I]=show [red]install file[/red]
? Or something else?
Alternatively, make all actions except installation to be slightly green or even neutral? As far as my preferences go, I think I'd consider making everything neutral except install file
text and ok, proceed
-- because those are the only things or operations that "could harm"
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'll give that a try.
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.
Just mentioning yellow can look quite bad on a light terminal. |
Looking at the screenshots, I think I'm definitely aligning more to the "traffic lights" rule you mentioned before. In this case it'd be one potentially dangerous operation |
Using the same color scheme as review menu in commit a800fb2
My initial reason for creating these pull requests was that I found it hard to tell, where one option ends and the next one starts. So I'd prefer to have something that more clearly separates the options. Color and bolding the keyboard shortcut made them quite distinct. But without color, the effect is less pronounced: I agree that the colors (like in #163 (comment)) do seem excessive. On the other hand, it slightly bothers me that the colors in the menus work differently now (compared to #161). But I can live with that. :) |
f1e7f6c
to
5e186df
Compare
I've finally got back to the MR 😅 (sorry, it's been a really long time, I acknowledge). I'm trying the PR out at the moment, I have a few questions |
"[S]".bold(), | ||
"SUID files".bold().bright_red() | ||
); | ||
//}; |
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 tried it out now, I think I actually like to keep the old if
condition above. Without it, my terminal alarms me: "hey, you have both SUID and an installation file at your hands, be sure to review it!" (see screenshot)
However, after clicking on checking these warnings, you see Package packagename-1.0.0-x86_64.pkg.tar.zst has no SUID files.
That's confusing to me, I like the old conditional display better
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 willing to restore the if
condition and try it out then, maybe that'll be good to keep everyone satisfied and improve the display :)
@@ -111,17 +111,26 @@ fn tar_check_archive<R: Read>(mut archive: Archive<R>, path_str: &str) { | |||
if suid_files.is_empty() { | |||
eprintln!("Package {} has no SUID files.", path_str); | |||
} | |||
eprint!("{}{}, ", "[E]".bold(), "=list executable files"); | |||
eprint!("{}{}, ", "[L]".bold(), "=list all files"); | |||
eprint!("{}{}, ", "[T]".bold(), "=run shell to inspect"); |
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 gives a compiler warning:
error: literal with an empty format string
--> src/tar_check.rs:114:35
|
114 | eprint!("{}{}, ", "[E]".bold(), "=list executable files");
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::print-literal` implied by `-D warnings`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#print_literal
help: try this
|
114 - eprint!("{}{}, ", "[E]".bold(), "=list executable files");
114 + eprint!("{}=list executable files, ", "[E]".bold());
|
I'll revert to inlining the "static" text as the compiler suggests, but will keep the .bold()
part you've introduced
Thanks! :) I'm fine with this, it makes the available choices clearer without excessive color.
Yeah, I think I commented the |
Using the same color scheme as review menu
in commit a800fb2 (PR #161)