-
Notifications
You must be signed in to change notification settings - Fork 479
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
Feat/issue 1698 global quiet #1704
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=- |
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.
Sorry I was slow getting to this! Check out my review comments.
README.md
Outdated
@@ -188,10 +188,10 @@ You can also set the shell using command-line arguments. For example, to use Pow | |||
<tr> | |||
<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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like there are some unrelated changes, and merge conflicts in README.md.
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.
Fixed
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also add [quiet]
.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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`: |
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.
done
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: |
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.
done
README.md
Outdated
@@ -2338,6 +2364,7 @@ import 'foo/bar.just' | |||
|
|||
a: b | |||
@echo A | |||
|
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.
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.
done
src/attribute.rs
Outdated
@@ -31,7 +32,12 @@ mod tests { | |||
use super::*; | |||
|
|||
#[test] | |||
fn to_str() { | |||
fn no_exit_message_to_str() { |
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.
fn no_exit_message_to_str() { | |
fn to_str() { |
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.
done
src/attribute.rs
Outdated
assert_eq!(Attribute::NoExitMessage.to_str(), "no-exit-message"); | ||
} | ||
|
||
#[test] |
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.
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.
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.
done
src/recipe.rs
Outdated
@@ -103,6 +103,10 @@ impl<'src, D> Recipe<'src, D> { | |||
!self.attributes.contains(&Attribute::NoExitMessage) | |||
} | |||
|
|||
fn no_quiet(&self) -> bool { | |||
!self.attributes.contains(&Attribute::NoQuiet) |
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.
Should this be inverted, i.e.:
!self.attributes.contains(&Attribute::NoQuiet) | |
self.attributes.contains(&Attribute::NoQuiet) |
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.
done
src/recipe.rs
Outdated
@@ -150,7 +154,10 @@ impl<'src, D> Recipe<'src, D> { | |||
} | |||
let mut evaluated = String::new(); | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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()); |
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.
done
src/recipe.rs
Outdated
|| !((quiet_command ^ self.quiet) | ||
|| (context.settings.quiet && self.no_quiet()) | ||
|| config.verbosity.quiet()) |
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 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()) |
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.
done
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=- |
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.
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=- |
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.
Looks good to me!
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=-