-
-
Notifications
You must be signed in to change notification settings - Fork 39
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 a -s
/--silent
option to silence user-facing messages
#362
Conversation
Hmmm... I intentionally made them For that we'd change the default verbosity value to be fn verbosity() -> impl Parser<usize> {
let verbose = short('v')
.long("verbose")
.help("more verbose output, can be specified multiple times")
.req_flag(())
.count();
let quiet = short('q')
.long("quiet")
.help("pls think of something reasonable")
.req_flag(())
.count();
construct!(verbose, quiet).map(|(v, q)| (v + 1).saturating_sub(q))
} |
Sounds reasonable to me 👍 I can do that |
Actually, any thoughts about having |
I think currently all the errors go to |
Some of the stuff that shows up with verbosity greater than zero are warnings and I think it's okay to keep them in stdout - to make debugging easier. |
12b0af9
to
0d32d3b
Compare
-s
/--silent
option to silence user-facing messages
0d32d3b
to
3a4ea46
Compare
Alright, updated with a new flag to reduce verbosity.
There were a couple instances where this didn't seem to be the case, so added a patch that updates this. |
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 think you need to drop one of the unused imports, but looks good other than that.
Replace uses of `safeprintln!` with `esafeprintln!` whenever a message is printed before exiting.
3a4ea46
to
9539c01
Compare
For what it's worth, this is somewhat less convenient for use via tools - if running That being said, I understand this is primarily a user-friendly utility and use via scripting isn't really a common usecase, so the changes here work for me 👍 (I just want to be able to have CI automatically generate a diff of changed assembly for specific symbols). |
You need to run tests locally and commit changes to the readme |
9539c01
to
594e89b
Compare
Sorry, thought I did that. Done. |
Need to reduce this by 1 with saturating sub |
I have a usecase where it would be nice to use cargo-show-asm programmatically, since it does a nicer job of filtering and demangling than most builtin utilities. However, UI messages currently print to stdout, meaning they need to be manually filtered: $ cargo asm -p libm --lib 2>/dev/null | cat Try one of those by name or a sequence number 0 "<f32 as libm::math::support::float_traits::Float>::abs" [9] 1 "<f32 as libm::math::support::float_traits::Float>::copysign" [18] 2 "<f32 as libm::math::support::float_traits::Float>::normalize" [21] 3 "<f64 as libm::math::support::float_traits::Float>::abs" [9] Introduce a `-s`/`--silent` flag that reduces the verbosity level, effectively being the the opposite of `-v`: $ path/cargo-asm asm -p libm --lib -s 2>/dev/null | cat 0 "<f32 as libm::math::support::float_traits::Float>::abs" [9] 1 "<f32 as libm::math::support::float_traits::Float>::copysign" [18] 2 "<f32 as libm::math::support::float_traits::Float>::normalize" [21] 3 "<f64 as libm::math::support::float_traits::Float>::abs" [9] `-s` was chosen to mirror Curl, since `-q` is already used as the flag to quieten Cargo's output.
594e89b
to
a5b7922
Compare
Makes sense, done. |
Thank you for the quick review! |
Looks good, thank you for your contribution ❤️ I'll try to make a new release shortly. While this tool started as a user facing - I'm not opposed to making it easier to use it from scripts, just need to decide what and how... |
0.2.46 is out |
Thank you very much! |
I have a usecase where it would be nice to use cargo-show-asm programmatically, since it does a nicer job of filtering and demangling than most builtin utilities. However, UI messages currently print to stdout, meaning they need to be manually filtered:
Introduce a
-s
/--silent
flag that reduces the verbosity level, effectively being the the opposite of-v
:-s
was chosen to mirror Curl, since-q
is already used as the flag to quieten Cargo's output.