Conversation
|
Thanks for the PR! Some thoughts:
|
|
Hi, Thank you for your helpful feedback. I'll make the changes within the next few days :-) With regards the inversion of the So, no surprises was my thoughts behind that one :-) -=david=- |
|
A question... You've recommended the attribute to be renamed to Thank you. |
|
Ah, yeah, good catch. In that case it should be |
70ebfec to
01c030d
Compare
|
Hi! I was wondering if you have had a chance to consider to merge in this PR? Anything else I can do? Thank you. -=david=- |
casey
left a comment
There was a problem hiding this comment.
Sorry I was slow getting to this! Check out my review comments.
README.md
Outdated
| <td><a href="https://www.gentoo.org">Gentoo Linux</a></td> | ||
| <td><a href="https://wiki.gentoo.org/wiki/Portage">Portage</a></td> | ||
| <td><a href="https://github.com/gentoo-mirror/guru/tree/master/sys-devel/just">guru/sys-devel/just</a></td> | ||
| <td><a href="https://github.com/gentoo-mirror/dm9pZCAq/tree/master/sys-devel/just">dm9pZCAq/sys-devel/just</a></td> |
There was a problem hiding this comment.
It looks like there are some unrelated changes, and merge conflicts in README.md.
README.md
Outdated
| | ----------------------------------- | ----------------------------------------------- | | ||
| | `[no-cd]`<sup>1.9.0</sup> | Don't change directory before executing recipe. | | ||
| | `[no-exit-message]`<sup>1.7.0</sup> | Don't print an error message if recipe fails. | | ||
| | `[no-quiet]`<sup>?</sup> | Override globally quiet recipes and always echo out the recipe | |
There was a problem hiding this comment.
There isn't a [quiet] attribute, just [no-quiet] which overrides the set quiet if that's been set.
README.md
Outdated
| In addition, an entire Justfile can be marked as being globally quiet by | ||
| setting `set quiet` in the Justfile. For example: |
There was a problem hiding this comment.
| In addition, an entire Justfile can be marked as being globally quiet by | |
| setting `set quiet` in the Justfile. For example: | |
| All recipes in a Justfile can be made quiet with `set quiet`: |
README.md
Outdated
| If the recipe has the attribute of `[no-quiet]`, then the setting is | ||
| ignored: For example: |
There was a problem hiding this comment.
| If the recipe has the attribute of `[no-quiet]`, then the setting is | |
| ignored: For example: | |
| If a recipe has`[no-quiet]`, then the setting is ignored: |
README.md
Outdated
|
|
||
| a: b | ||
| @echo A | ||
|
|
src/attribute.rs
Outdated
|
|
||
| #[test] | ||
| fn to_str() { | ||
| fn no_exit_message_to_str() { |
There was a problem hiding this comment.
| fn no_exit_message_to_str() { | |
| fn to_str() { |
src/attribute.rs
Outdated
| assert_eq!(Attribute::NoExitMessage.to_str(), "no-exit-message"); | ||
| } | ||
|
|
||
| #[test] |
There was a problem hiding this comment.
We can remove this test. The other test is there just to make sure that we're serializing attribute names in kebab-case, but we don't need to test every variant.
src/recipe.rs
Outdated
| } | ||
|
|
||
| fn no_quiet(&self) -> bool { | ||
| !self.attributes.contains(&Attribute::NoQuiet) |
There was a problem hiding this comment.
Should this be inverted, i.e.:
| !self.attributes.contains(&Attribute::NoQuiet) | |
| self.attributes.contains(&Attribute::NoQuiet) |
src/recipe.rs
Outdated
| let mut continued = false; | ||
| let quiet_command = lines.peek().map_or(false, |line| line.is_quiet()); | ||
|
|
||
| let quiet_command = self.no_quiet() && context.settings.quiet |
There was a problem hiding this comment.
This is used to determine if we should strip a leading @ from the line, so we should only do so if it starts with an @:
| let quiet_command = self.no_quiet() && context.settings.quiet | |
| let quiet_line = lines.peek().map_or(false, |line| line.is_quiet()); |
src/recipe.rs
Outdated
| || !((quiet_command ^ self.quiet) | ||
| || (context.settings.quiet && self.no_quiet()) | ||
| || config.verbosity.quiet()) |
There was a problem hiding this comment.
I think this should be something like:
| || !((quiet_command ^ self.quiet) | |
| || (context.settings.quiet && self.no_quiet()) | |
| || config.verbosity.quiet()) | |
| || !((quiet_line ^ self.quiet) || (context.settings.quiet && !self.no_quiet()) || config.verbosity.quiet()) |
a4b98cd to
c2d4d29
Compare
|
Hi! All changes asked for applied. When you can spare the time, have a looksee and see what you think :-) Thank you. -=david=- |
casey
left a comment
There was a problem hiding this comment.
Sorry for letting this sit! This looks good, it just needs integration tests, which can go in tests/quiet.rs. The tests in that file are using the test! macro, which I try to avoid these days, so for examples of how to write tests, check out tests/modules.rs. In particular, all the interactions with the quiet setting, the noquiet attribute, quiet lines, and the @ prefix to both recipes in lines, should be tested.
c2d4d29 to
9dcb13a
Compare
This commit brings the concept of globally quiet recipes to the Justfile. If the justfile has this setting: set quiet With this (implicitly true) setting, every recipe within the Justfile will be quiet - unless the recipe has the (new) attribute of [no-quiet]. closes casey#1698 -=david=-
9dcb13a to
fc22352
Compare
|
Hi, Additional integration tests done. I hope this is looking better. -=david=- |
|
Thanks for the PR! I tweaked it a little bit, simplifying the tests and removing an This is easily the worst conditional I've ever seen, amazingly using if config.dry_run
|| config.verbosity.loquacious()
|| !((quiet_line ^ self.quiet)
|| (context.settings.quiet && !self.no_quiet())
|| config.verbosity.quiet())
{But so be it! Functionality for making things quiet or not quiet has just evolved organically over time, so I guess that's just how it is 😂 |
Hi,
Here's a first pass at introducing
quiet recipes. I'm happy to take unboard any thoughts you may have. Not quite sure about the nameset quiet-recipes, but was struggling to come up with something better (maybeset globally-quiet?) :-)Tests pass (with my additional ones added).
Thank you for your consideration.
#Fixes 1698
-=david=-